diff mbox

[v4,04/14] crypto: ecc - don't be selfish on pubkeys

Message ID 1495696696-22580-5-git-send-email-tudor.ambarus@microchip.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show

Commit Message

Tudor Ambarus May 25, 2017, 7:18 a.m. UTC
Rename ecdh_make_pub_key() to ecc_make_pub_key().
This function might as well be used by ecdsa.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 crypto/ecc.c  | 4 ++--
 crypto/ecc.h  | 4 ++--
 crypto/ecdh.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Horia Geanta May 28, 2017, 5:22 p.m. UTC | #1
On 5/25/2017 10:18 AM, Tudor Ambarus wrote:
> Rename ecdh_make_pub_key() to ecc_make_pub_key().
> This function might as well be used by ecdsa.

Where exactly is ecdsa used in the kernel?
https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg23235.html

Thanks,
Horia
Tudor Ambarus May 29, 2017, 2:11 p.m. UTC | #2
Hi, Horia,

On 28.05.2017 20:22, Horia Geantă wrote:
> On 5/25/2017 10:18 AM, Tudor Ambarus wrote:
>> Rename ecdh_make_pub_key() to ecc_make_pub_key().
>> This function might as well be used by ecdsa.
> 
> Where exactly is ecdsa used in the kernel?
> https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg23235.html

Nowhere. Maybe I should have dropped the reference to ecdsa.
ecdh_make_pub_key() is not dh specific and the reference to dh is wrong.

Thanks for the review,
ta
diff mbox

Patch

diff --git a/crypto/ecc.c b/crypto/ecc.c
index e3a2b8f..6c33c43 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -927,8 +927,8 @@  int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
 	return 0;
 }
 
-int ecdh_make_pub_key(unsigned int curve_id, unsigned int ndigits,
-		      const u64 *private_key, u64 *public_key)
+int ecc_make_pub_key(unsigned int curve_id, unsigned int ndigits,
+		     const u64 *private_key, u64 *public_key)
 {
 	int ret = 0;
 	struct ecc_point *pk;
diff --git a/crypto/ecc.h b/crypto/ecc.h
index af2ffdb..673c834 100644
--- a/crypto/ecc.h
+++ b/crypto/ecc.h
@@ -54,8 +54,8 @@  int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
  * Returns 0 if the public key was generated successfully, a negative value
  * if an error occurred.
  */
-int ecdh_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
-		      const u64 *private_key, u64 *public_key);
+int ecc_make_pub_key(const unsigned int curve_id, unsigned int ndigits,
+		     const u64 *private_key, u64 *public_key);
 
 /**
  * crypto_ecdh_shared_secret() - Compute a shared secret
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index c1f0163..ed1464a 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -87,8 +87,8 @@  static int ecdh_compute_value(struct kpp_request *req)
 
 		buf = ctx->shared_secret;
 	} else {
-		ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits,
-					ctx->private_key, ctx->public_key);
+		ret = ecc_make_pub_key(ctx->curve_id, ctx->ndigits,
+				       ctx->private_key, ctx->public_key);
 		buf = ctx->public_key;
 		/* Public part is a point thus it has both coordinates */
 		nbytes *= 2;