summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2022-11-09 17:40:51 +0000
committerjsing <>2022-11-09 17:40:51 +0000
commitb20429423f8d9e40cd60842bbbb5fa6cb9281287 (patch)
treed701e94ebbc5ed8f8f153a2b4e826e0052538be9
parent390601a304fd7ed95013cfc05628a1a33f115b25 (diff)
downloadopenbsd-b20429423f8d9e40cd60842bbbb5fa6cb9281287.tar.gz
openbsd-b20429423f8d9e40cd60842bbbb5fa6cb9281287.tar.bz2
openbsd-b20429423f8d9e40cd60842bbbb5fa6cb9281287.zip
Rename public_value to public_key for consistency.
ok tb@
-rw-r--r--src/lib/libcrypto/curve25519/curve25519.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/curve25519/curve25519.c b/src/lib/libcrypto/curve25519/curve25519.c
index 56373db923..2618e1a3e7 100644
--- a/src/lib/libcrypto/curve25519/curve25519.c
+++ b/src/lib/libcrypto/curve25519/curve25519.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: curve25519.c,v 1.11 2022/11/09 17:39:29 jsing Exp $ */ 1/* $OpenBSD: curve25519.c,v 1.12 2022/11/09 17:40:51 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2015, Google Inc. 3 * Copyright (c) 2015, Google Inc.
4 * 4 *
@@ -4841,7 +4841,7 @@ x25519_scalar_mult_generic(uint8_t out[32], const uint8_t scalar[32],
4841 4841
4842#ifdef unused 4842#ifdef unused
4843void 4843void
4844x25519_public_from_private_generic(uint8_t out_public_value[32], 4844x25519_public_from_private_generic(uint8_t out_public_key[32],
4845 const uint8_t private_key[32]) 4845 const uint8_t private_key[32])
4846{ 4846{
4847 uint8_t e[32]; 4847 uint8_t e[32];
@@ -4861,21 +4861,21 @@ x25519_public_from_private_generic(uint8_t out_public_value[32],
4861 fe_sub(zminusy, A.Z, A.Y); 4861 fe_sub(zminusy, A.Z, A.Y);
4862 fe_invert(zminusy_inv, zminusy); 4862 fe_invert(zminusy_inv, zminusy);
4863 fe_mul(zplusy, zplusy, zminusy_inv); 4863 fe_mul(zplusy, zplusy, zminusy_inv);
4864 fe_tobytes(out_public_value, zplusy); 4864 fe_tobytes(out_public_key, zplusy);
4865} 4865}
4866#endif 4866#endif
4867 4867
4868void 4868void
4869x25519_public_from_private(uint8_t out_public_value[32], 4869x25519_public_from_private(uint8_t out_public_key[32],
4870 const uint8_t private_key[32]) 4870 const uint8_t private_key[32])
4871{ 4871{
4872 static const uint8_t kMongomeryBasePoint[32] = {9}; 4872 static const uint8_t kMongomeryBasePoint[32] = {9};
4873 4873
4874 x25519_scalar_mult(out_public_value, private_key, kMongomeryBasePoint); 4874 x25519_scalar_mult(out_public_key, private_key, kMongomeryBasePoint);
4875} 4875}
4876 4876
4877void 4877void
4878X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH], 4878X25519_keypair(uint8_t out_public_key[X25519_KEY_LENGTH],
4879 uint8_t out_private_key[X25519_KEY_LENGTH]) 4879 uint8_t out_private_key[X25519_KEY_LENGTH])
4880{ 4880{
4881 /* All X25519 implementations should decode scalars correctly (see 4881 /* All X25519 implementations should decode scalars correctly (see
@@ -4897,17 +4897,17 @@ X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH],
4897 out_private_key[31] &= 63; 4897 out_private_key[31] &= 63;
4898 out_private_key[31] |= 128; 4898 out_private_key[31] |= 128;
4899 4899
4900 x25519_public_from_private(out_public_value, out_private_key); 4900 x25519_public_from_private(out_public_key, out_private_key);
4901} 4901}
4902 4902
4903int 4903int
4904X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], 4904X25519(uint8_t out_shared_key[X25519_KEY_LENGTH],
4905 const uint8_t private_key[X25519_KEY_LENGTH], 4905 const uint8_t private_key[X25519_KEY_LENGTH],
4906 const uint8_t peer_public_value[X25519_KEY_LENGTH]) 4906 const uint8_t peer_public_key[X25519_KEY_LENGTH])
4907{ 4907{
4908 static const uint8_t kZeros[32] = {0}; 4908 static const uint8_t kZeros[32] = {0};
4909 4909
4910 x25519_scalar_mult(out_shared_key, private_key, peer_public_value); 4910 x25519_scalar_mult(out_shared_key, private_key, peer_public_key);
4911 4911
4912 /* The all-zero output results when the input is a point of small order. */ 4912 /* The all-zero output results when the input is a point of small order. */
4913 return timingsafe_memcmp(kZeros, out_shared_key, 32) != 0; 4913 return timingsafe_memcmp(kZeros, out_shared_key, 32) != 0;