summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/curve25519/curve25519.c
diff options
context:
space:
mode:
authorjsing <>2016-12-17 16:20:03 +0000
committerjsing <>2016-12-17 16:20:03 +0000
commit8def53432c03f833e2f2c79b876710d1cf8d60ea (patch)
tree78d02484222416141f064d4da7a44d5a2b927f14 /src/lib/libcrypto/curve25519/curve25519.c
parentdc68dcd4b258775d66dc217e629ee1cba9bd476d (diff)
downloadopenbsd-8def53432c03f833e2f2c79b876710d1cf8d60ea.tar.gz
openbsd-8def53432c03f833e2f2c79b876710d1cf8d60ea.tar.bz2
openbsd-8def53432c03f833e2f2c79b876710d1cf8d60ea.zip
Define X25519_KEY_LENGTH and use it so we have fewer magic numbers.
ok beck@
Diffstat (limited to 'src/lib/libcrypto/curve25519/curve25519.c')
-rw-r--r--src/lib/libcrypto/curve25519/curve25519.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/curve25519/curve25519.c b/src/lib/libcrypto/curve25519/curve25519.c
index f24adc1fbe..994b804af5 100644
--- a/src/lib/libcrypto/curve25519/curve25519.c
+++ b/src/lib/libcrypto/curve25519/curve25519.c
@@ -4895,7 +4895,8 @@ x25519_public_from_private(uint8_t out_public_value[32],
4895} 4895}
4896 4896
4897void 4897void
4898X25519_keypair(uint8_t out_public_value[32], uint8_t out_private_key[32]) 4898X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH],
4899 uint8_t out_private_key[X25519_KEY_LENGTH])
4899{ 4900{
4900 /* All X25519 implementations should decode scalars correctly (see 4901 /* All X25519 implementations should decode scalars correctly (see
4901 * https://tools.ietf.org/html/rfc7748#section-5). However, if an 4902 * https://tools.ietf.org/html/rfc7748#section-5). However, if an
@@ -4920,8 +4921,9 @@ X25519_keypair(uint8_t out_public_value[32], uint8_t out_private_key[32])
4920} 4921}
4921 4922
4922int 4923int
4923X25519(uint8_t out_shared_key[32], const uint8_t private_key[32], 4924X25519(uint8_t out_shared_key[X25519_KEY_LENGTH],
4924 const uint8_t peer_public_value[32]) 4925 const uint8_t private_key[X25519_KEY_LENGTH],
4926 const uint8_t peer_public_value[X25519_KEY_LENGTH])
4925{ 4927{
4926 static const uint8_t kZeros[32] = {0}; 4928 static const uint8_t kZeros[32] = {0};
4927 4929