diff options
| author | jsing <> | 2022-11-09 17:40:51 +0000 |
|---|---|---|
| committer | jsing <> | 2022-11-09 17:40:51 +0000 |
| commit | ff5faa687445f18e922b9b5263b369e9e7f5a57c (patch) | |
| tree | d701e94ebbc5ed8f8f153a2b4e826e0052538be9 /src | |
| parent | a9fdcf2b38e7f119a0b1e428a0f9cae93f210ed4 (diff) | |
| download | openbsd-ff5faa687445f18e922b9b5263b369e9e7f5a57c.tar.gz openbsd-ff5faa687445f18e922b9b5263b369e9e7f5a57c.tar.bz2 openbsd-ff5faa687445f18e922b9b5263b369e9e7f5a57c.zip | |
Rename public_value to public_key for consistency.
ok tb@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/curve25519/curve25519.c | 18 |
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 |
| 4843 | void | 4843 | void |
| 4844 | x25519_public_from_private_generic(uint8_t out_public_value[32], | 4844 | x25519_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 | ||
| 4868 | void | 4868 | void |
| 4869 | x25519_public_from_private(uint8_t out_public_value[32], | 4869 | x25519_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 | ||
| 4877 | void | 4877 | void |
| 4878 | X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH], | 4878 | X25519_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 | ||
| 4903 | int | 4903 | int |
| 4904 | X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], | 4904 | X25519(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; |
