aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-06-19 18:54:50 +0200
committerRich Salz <rsalz@openssl.org>2016-07-25 08:20:00 -0400
commit25d57dc71b7b2d024588eb3831a73cb32fc069bf (patch)
tree407da964f3801adb1e53cfe8eb5127363c36e0b2 /crypto/ec
parentc17dd597ac5ac687b4cc7b585d7f8fb0cf987a20 (diff)
downloadopenssl-25d57dc71b7b2d024588eb3831a73cb32fc069bf.tar.gz
Constify EC_KEY_*_oct2priv() input buffer
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1300)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec_25519.c2
-rw-r--r--crypto/ec/ec_key.c7
-rw-r--r--crypto/ec/ec_lcl.h4
3 files changed, 7 insertions, 6 deletions
diff --git a/crypto/ec/ec_25519.c b/crypto/ec/ec_25519.c
index 035a415347..df0ad8a0c0 100644
--- a/crypto/ec/ec_25519.c
+++ b/crypto/ec/ec_25519.c
@@ -155,7 +155,7 @@ static int x25519_keycopy(EC_KEY *dest, const EC_KEY *src)
return x25519_init_private(dest, src->custom_data);
}
-static int x25519_oct2priv(EC_KEY *eckey, unsigned char *buf, size_t len)
+static int x25519_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
{
if (len != EC_X25519_KEYLEN)
return 0;
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index b3ea1b046d..01faa62163 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -546,7 +546,8 @@ int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len,
return 1;
}
-size_t EC_KEY_priv2oct(const EC_KEY *eckey, unsigned char *buf, size_t len)
+size_t EC_KEY_priv2oct(const EC_KEY *eckey,
+ unsigned char *buf, size_t len)
{
if (eckey->group == NULL || eckey->group->meth == NULL)
return 0;
@@ -581,7 +582,7 @@ size_t ec_key_simple_priv2oct(const EC_KEY *eckey,
return buf_len;
}
-int EC_KEY_oct2priv(EC_KEY *eckey, unsigned char *buf, size_t len)
+int EC_KEY_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
{
if (eckey->group == NULL || eckey->group->meth == NULL)
return 0;
@@ -592,7 +593,7 @@ int EC_KEY_oct2priv(EC_KEY *eckey, unsigned char *buf, size_t len)
return eckey->group->meth->oct2priv(eckey, buf, len);
}
-int ec_key_simple_oct2priv(EC_KEY *eckey, unsigned char *buf, size_t len)
+int ec_key_simple_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
{
if (eckey->priv_key == NULL)
eckey->priv_key = BN_secure_new();
diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h
index 2cef3bced4..5b79340a14 100644
--- a/crypto/ec/ec_lcl.h
+++ b/crypto/ec/ec_lcl.h
@@ -159,7 +159,7 @@ struct ec_method_st {
int (*field_set_to_one) (const EC_GROUP *, BIGNUM *r, BN_CTX *);
/* private key operations */
size_t (*priv2oct)(const EC_KEY *eckey, unsigned char *buf, size_t len);
- int (*oct2priv)(EC_KEY *eckey, unsigned char *buf, size_t len);
+ int (*oct2priv)(EC_KEY *eckey, const unsigned char *buf, size_t len);
int (*set_private)(EC_KEY *eckey, const BIGNUM *priv_key);
int (*keygen)(EC_KEY *eckey);
int (*keycheck)(const EC_KEY *eckey);
@@ -553,7 +553,7 @@ const EC_METHOD *EC_GFp_nistz256_method(void);
size_t ec_key_simple_priv2oct(const EC_KEY *eckey,
unsigned char *buf, size_t len);
-int ec_key_simple_oct2priv(EC_KEY *eckey, unsigned char *buf, size_t len);
+int ec_key_simple_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len);
int ec_key_simple_generate_key(EC_KEY *eckey);
int ec_key_simple_generate_public_key(EC_KEY *eckey);
int ec_key_simple_check_key(const EC_KEY *eckey);