summaryrefslogtreecommitdiff
path: root/crypto/ecdh.c
diff options
context:
space:
mode:
authorTudor-Dan Ambarus <tudor.ambarus@microchip.com>2017-05-25 10:18:05 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-10 12:04:26 +0800
commit23f8999822c5c5feec5b3f91e3fbb60e48b381b1 (patch)
treee54fab1a065a05dc9e8f78bb7cb65ad9f9e45fd9 /crypto/ecdh.c
parent5ed65cf80b8c07cd082a8cf09a5468b301d10b2a (diff)
downloadlinux-crypto-23f8999822c5c5feec5b3f91e3fbb60e48b381b1.tar.gz
linux-crypto-23f8999822c5c5feec5b3f91e3fbb60e48b381b1.zip
crypto: ecc - remove unnecessary casts
ecc software implementation works with chunks of u64 data. There were some unnecessary casts to u8 and then back to u64 for the ecc keys. This patch removes the unnecessary casts. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/ecdh.c')
-rw-r--r--crypto/ecdh.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index 69c3951f..c1f01630 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -56,7 +56,7 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
ctx->ndigits = ndigits;
if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits,
- (const u8 *)params.key, params.key_size) < 0)
+ (const u64 *)params.key, params.key_size) < 0)
return -EINVAL;
memcpy(ctx->private_key, params.key, params.key_size);
@@ -81,15 +81,14 @@ static int ecdh_compute_value(struct kpp_request *req)
return -EINVAL;
ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits,
- (const u8 *)ctx->private_key,
- (const u8 *)ctx->public_key,
- (u8 *)ctx->shared_secret);
+ ctx->private_key,
+ ctx->public_key,
+ ctx->shared_secret);
buf = ctx->shared_secret;
} else {
ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits,
- (const u8 *)ctx->private_key,
- (u8 *)ctx->public_key);
+ ctx->private_key, ctx->public_key);
buf = ctx->public_key;
/* Public part is a point thus it has both coordinates */
nbytes *= 2;