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>
This commit is contained in:
parent
c0ca1215dc
commit
099054d735
@ -928,8 +928,7 @@ int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ecdh_make_pub_key(unsigned int curve_id, unsigned int ndigits,
|
int ecdh_make_pub_key(unsigned int curve_id, unsigned int ndigits,
|
||||||
const u8 *private_key, unsigned int private_key_len,
|
const u8 *private_key, u8 *public_key)
|
||||||
u8 *public_key, unsigned int public_key_len)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct ecc_point *pk;
|
struct ecc_point *pk;
|
||||||
@ -967,9 +966,8 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
|
int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
|
||||||
const u8 *private_key, unsigned int private_key_len,
|
const u8 *private_key, const u8 *public_key,
|
||||||
const u8 *public_key, unsigned int public_key_len,
|
u8 *secret)
|
||||||
u8 *secret, unsigned int secret_len)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct ecc_point *product, *pk;
|
struct ecc_point *product, *pk;
|
||||||
|
13
crypto/ecc.h
13
crypto/ecc.h
@ -49,16 +49,13 @@ int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
|
|||||||
* @curve_id: id representing the curve to use
|
* @curve_id: id representing the curve to use
|
||||||
* @ndigits: curve's number of digits
|
* @ndigits: curve's number of digits
|
||||||
* @private_key: pregenerated private key for the given curve
|
* @private_key: pregenerated private key for the given curve
|
||||||
* @private_key_len: length of private_key
|
|
||||||
* @public_key: buffer for storing the generated public key
|
* @public_key: buffer for storing the generated public key
|
||||||
* @public_key_len: length of the public_key buffer
|
|
||||||
*
|
*
|
||||||
* Returns 0 if the public key was generated successfully, a negative value
|
* Returns 0 if the public key was generated successfully, a negative value
|
||||||
* if an error occurred.
|
* if an error occurred.
|
||||||
*/
|
*/
|
||||||
int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
|
int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
|
||||||
const u8 *private_key, unsigned int private_key_len,
|
const u8 *private_key, u8 *public_key);
|
||||||
u8 *public_key, unsigned int public_key_len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crypto_ecdh_shared_secret() - Compute a shared secret
|
* 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,
|
|||||||
* @curve_id: id representing the curve to use
|
* @curve_id: id representing the curve to use
|
||||||
* @ndigits: curve's number of digits
|
* @ndigits: curve's number of digits
|
||||||
* @private_key: private key of part A
|
* @private_key: private key of part A
|
||||||
* @private_key_len: length of private_key
|
|
||||||
* @public_key: public key of counterpart B
|
* @public_key: public key of counterpart B
|
||||||
* @public_key_len: length of public_key
|
|
||||||
* @secret: buffer for storing the calculated shared secret
|
* @secret: buffer for storing the calculated shared secret
|
||||||
* @secret_len: length of the secret buffer
|
|
||||||
*
|
*
|
||||||
* Note: It is recommended that you hash the result of crypto_ecdh_shared_secret
|
* Note: It is recommended that you hash the result of crypto_ecdh_shared_secret
|
||||||
* before using it for symmetric encryption or HMAC.
|
* 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,
|
|||||||
* if an error occurred.
|
* if an error occurred.
|
||||||
*/
|
*/
|
||||||
int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
|
int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
|
||||||
const u8 *private_key, unsigned int private_key_len,
|
const u8 *private_key, const u8 *public_key,
|
||||||
const u8 *public_key, unsigned int public_key_len,
|
u8 *secret);
|
||||||
u8 *secret, unsigned int secret_len);
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,16 +81,15 @@ static int ecdh_compute_value(struct kpp_request *req)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits,
|
ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits,
|
||||||
(const u8 *)ctx->private_key, nbytes,
|
(const u8 *)ctx->private_key,
|
||||||
(const u8 *)ctx->public_key, 2 * nbytes,
|
(const u8 *)ctx->public_key,
|
||||||
(u8 *)ctx->shared_secret, nbytes);
|
(u8 *)ctx->shared_secret);
|
||||||
|
|
||||||
buf = ctx->shared_secret;
|
buf = ctx->shared_secret;
|
||||||
} else {
|
} else {
|
||||||
ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits,
|
ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits,
|
||||||
(const u8 *)ctx->private_key, nbytes,
|
(const u8 *)ctx->private_key,
|
||||||
(u8 *)ctx->public_key,
|
(u8 *)ctx->public_key);
|
||||||
sizeof(ctx->public_key));
|
|
||||||
buf = ctx->public_key;
|
buf = ctx->public_key;
|
||||||
/* Public part is a point thus it has both coordinates */
|
/* Public part is a point thus it has both coordinates */
|
||||||
nbytes *= 2;
|
nbytes *= 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user