aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2016-06-24 02:20:22 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-06-24 09:24:59 -0400
commit8f44df154de79a61b0e86734f51737b8cccf8dfe (patch)
tree4ffc5e1fdc13187cb48bd0cf850af1bccca19128
parent52140993d4fccde6004df9e282a81580d9d5e4da (diff)
crypto: ecdh - make ecdh_shared_secret unique
There is another ecdh_shared_secret in net/bluetooth/ecc.c Fixes: 3c4b23901a0c ("crypto: ecdh - Add ECDH software support") Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/ecc.c2
-rw-r--r--crypto/ecc.h6
-rw-r--r--crypto/ecdh.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/crypto/ecc.c b/crypto/ecc.c
index 9aedec6bbe72..414c78a9c214 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -966,7 +966,7 @@ out:
966 return ret; 966 return ret;
967} 967}
968 968
969int ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, 969int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
970 const u8 *private_key, unsigned int private_key_len, 970 const u8 *private_key, unsigned int private_key_len,
971 const u8 *public_key, unsigned int public_key_len, 971 const u8 *public_key, unsigned int public_key_len,
972 u8 *secret, unsigned int secret_len) 972 u8 *secret, unsigned int secret_len)
diff --git a/crypto/ecc.h b/crypto/ecc.h
index b5db4b989f3c..663d598c7406 100644
--- a/crypto/ecc.h
+++ b/crypto/ecc.h
@@ -60,7 +60,7 @@ int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
60 u8 *public_key, unsigned int public_key_len); 60 u8 *public_key, unsigned int public_key_len);
61 61
62/** 62/**
63 * ecdh_shared_secret() - Compute a shared secret 63 * crypto_ecdh_shared_secret() - Compute a shared secret
64 * 64 *
65 * @curve_id: id representing the curve to use 65 * @curve_id: id representing the curve to use
66 * @private_key: private key of part A 66 * @private_key: private key of part A
@@ -70,13 +70,13 @@ int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
70 * @secret: buffer for storing the calculated shared secret 70 * @secret: buffer for storing the calculated shared secret
71 * @secret_len: length of the secret buffer 71 * @secret_len: length of the secret buffer
72 * 72 *
73 * Note: It is recommended that you hash the result of ecdh_shared_secret 73 * Note: It is recommended that you hash the result of crypto_ecdh_shared_secret
74 * before using it for symmetric encryption or HMAC. 74 * before using it for symmetric encryption or HMAC.
75 * 75 *
76 * Returns 0 if the shared secret was generated successfully, a negative value 76 * Returns 0 if the shared secret was generated successfully, a negative value
77 * if an error occurred. 77 * if an error occurred.
78 */ 78 */
79int ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, 79int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
80 const u8 *private_key, unsigned int private_key_len, 80 const u8 *private_key, unsigned int private_key_len,
81 const u8 *public_key, unsigned int public_key_len, 81 const u8 *public_key, unsigned int public_key_len,
82 u8 *secret, unsigned int secret_len); 82 u8 *secret, unsigned int secret_len);
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index d3a9eeca4b32..3de289806d67 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -79,7 +79,7 @@ static int ecdh_compute_value(struct kpp_request *req)
79 if (copied != 2 * nbytes) 79 if (copied != 2 * nbytes)
80 return -EINVAL; 80 return -EINVAL;
81 81
82 ret = ecdh_shared_secret(ctx->curve_id, ctx->ndigits, 82 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits,
83 (const u8 *)ctx->private_key, nbytes, 83 (const u8 *)ctx->private_key, nbytes,
84 (const u8 *)ctx->public_key, 2 * nbytes, 84 (const u8 *)ctx->public_key, 2 * nbytes,
85 (u8 *)ctx->shared_secret, nbytes); 85 (u8 *)ctx->shared_secret, nbytes);