summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTudor-Dan Ambarus <tudor.ambarus@microchip.com>2017-05-25 03:18:04 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-10 00:04:25 -0400
commit099054d735a5e4cfc8e90b03b7422c9b48209d8b (patch)
tree92f3c7bcf046e5f07e646b941708b58a4dd7e06f
parentc0ca1215dc92ee6a0f975c95a92fb7f9fb31e9e1 (diff)
crypto: ecc - remove unused function arguments
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/ecc.c8
-rw-r--r--crypto/ecc.h13
-rw-r--r--crypto/ecdh.c11
3 files changed, 11 insertions, 21 deletions
diff --git a/crypto/ecc.c b/crypto/ecc.c
index 414c78a9c214..69b4cc4303aa 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -928,8 +928,7 @@ int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
928} 928}
929 929
930int ecdh_make_pub_key(unsigned int curve_id, unsigned int ndigits, 930int ecdh_make_pub_key(unsigned int curve_id, unsigned int ndigits,
931 const u8 *private_key, unsigned int private_key_len, 931 const u8 *private_key, u8 *public_key)
932 u8 *public_key, unsigned int public_key_len)
933{ 932{
934 int ret = 0; 933 int ret = 0;
935 struct ecc_point *pk; 934 struct ecc_point *pk;
@@ -967,9 +966,8 @@ out:
967} 966}
968 967
969int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, 968int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
970 const u8 *private_key, unsigned int private_key_len, 969 const u8 *private_key, const u8 *public_key,
971 const u8 *public_key, unsigned int public_key_len, 970 u8 *secret)
972 u8 *secret, unsigned int secret_len)
973{ 971{
974 int ret = 0; 972 int ret = 0;
975 struct ecc_point *product, *pk; 973 struct ecc_point *product, *pk;
diff --git a/crypto/ecc.h b/crypto/ecc.h
index 37f438500255..1ca9bf7437d7 100644
--- a/crypto/ecc.h
+++ b/crypto/ecc.h
@@ -49,16 +49,13 @@ int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
49 * @curve_id: id representing the curve to use 49 * @curve_id: id representing the curve to use
50 * @ndigits: curve's number of digits 50 * @ndigits: curve's number of digits
51 * @private_key: pregenerated private key for the given curve 51 * @private_key: pregenerated private key for the given curve
52 * @private_key_len: length of private_key
53 * @public_key: buffer for storing the generated public key 52 * @public_key: buffer for storing the generated public key
54 * @public_key_len: length of the public_key buffer
55 * 53 *
56 * Returns 0 if the public key was generated successfully, a negative value 54 * Returns 0 if the public key was generated successfully, a negative value
57 * if an error occurred. 55 * if an error occurred.
58 */ 56 */
59int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits, 57int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
60 const u8 *private_key, unsigned int private_key_len, 58 const u8 *private_key, u8 *public_key);
61 u8 *public_key, unsigned int public_key_len);
62 59
63/** 60/**
64 * crypto_ecdh_shared_secret() - Compute a shared secret 61 * crypto_ecdh_shared_secret() - Compute a shared secret
@@ -66,11 +63,8 @@ int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
66 * @curve_id: id representing the curve to use 63 * @curve_id: id representing the curve to use
67 * @ndigits: curve's number of digits 64 * @ndigits: curve's number of digits
68 * @private_key: private key of part A 65 * @private_key: private key of part A
69 * @private_key_len: length of private_key
70 * @public_key: public key of counterpart B 66 * @public_key: public key of counterpart B
71 * @public_key_len: length of public_key
72 * @secret: buffer for storing the calculated shared secret 67 * @secret: buffer for storing the calculated shared secret
73 * @secret_len: length of the secret buffer
74 * 68 *
75 * Note: It is recommended that you hash the result of crypto_ecdh_shared_secret 69 * Note: It is recommended that you hash the result of crypto_ecdh_shared_secret
76 * before using it for symmetric encryption or HMAC. 70 * before using it for symmetric encryption or HMAC.
@@ -79,7 +73,6 @@ int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
79 * if an error occurred. 73 * if an error occurred.
80 */ 74 */
81int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, 75int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
82 const u8 *private_key, unsigned int private_key_len, 76 const u8 *private_key, const u8 *public_key,
83 const u8 *public_key, unsigned int public_key_len, 77 u8 *secret);
84 u8 *secret, unsigned int secret_len);
85#endif 78#endif
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index 36233077a552..69c3951f0a03 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -81,16 +81,15 @@ static int ecdh_compute_value(struct kpp_request *req)
81 return -EINVAL; 81 return -EINVAL;
82 82
83 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits, 83 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits,
84 (const u8 *)ctx->private_key, nbytes, 84 (const u8 *)ctx->private_key,
85 (const u8 *)ctx->public_key, 2 * nbytes, 85 (const u8 *)ctx->public_key,
86 (u8 *)ctx->shared_secret, nbytes); 86 (u8 *)ctx->shared_secret);
87 87
88 buf = ctx->shared_secret; 88 buf = ctx->shared_secret;
89 } else { 89 } else {
90 ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits, 90 ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits,
91 (const u8 *)ctx->private_key, nbytes, 91 (const u8 *)ctx->private_key,
92 (u8 *)ctx->public_key, 92 (u8 *)ctx->public_key);
93 sizeof(ctx->public_key));
94 buf = ctx->public_key; 93 buf = ctx->public_key;
95 /* Public part is a point thus it has both coordinates */ 94 /* Public part is a point thus it has both coordinates */
96 nbytes *= 2; 95 nbytes *= 2;