From 134eb2c29dcf9a0940a8c1911b322974fa9a00b2 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 23 Oct 2017 16:27:04 +0200 Subject: [PATCH] Add a comment on scalarmult usage --- src/libsodium/include/sodium/crypto_scalarmult.h | 8 ++++++++ .../include/sodium/crypto_scalarmult_curve25519.h | 8 ++++++++ src/libsodium/include/sodium/crypto_scalarmult_ed25519.h | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/src/libsodium/include/sodium/crypto_scalarmult.h b/src/libsodium/include/sodium/crypto_scalarmult.h index 830c10f6..f7fa6f8f 100644 --- a/src/libsodium/include/sodium/crypto_scalarmult.h +++ b/src/libsodium/include/sodium/crypto_scalarmult.h @@ -25,6 +25,14 @@ const char *crypto_scalarmult_primitive(void); SODIUM_EXPORT int crypto_scalarmult_base(unsigned char *q, const unsigned char *n); +/* + * NOTE: Do not use the result of this function directly. + * + * Hash the result with the public keys in order to compute a shared + * secret key: H(q || client_pk || server_pk) + * + * Or unless this is not an option, use the crypto_kx() API instead. + */ SODIUM_EXPORT int crypto_scalarmult(unsigned char *q, const unsigned char *n, const unsigned char *p) diff --git a/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h b/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h index d96840c7..ae85eadc 100644 --- a/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +++ b/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h @@ -17,6 +17,14 @@ size_t crypto_scalarmult_curve25519_bytes(void); SODIUM_EXPORT size_t crypto_scalarmult_curve25519_scalarbytes(void); +/* + * NOTE: Do not use the result of this function directly. + * + * Hash the result with the public keys in order to compute a shared + * secret key: H(q || client_pk || server_pk) + * + * Or unless this is not an option, use the crypto_kx() API instead. + */ SODIUM_EXPORT int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n, const unsigned char *p) diff --git a/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h b/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h index 46b8ef69..3d512351 100644 --- a/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h +++ b/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h @@ -18,6 +18,14 @@ size_t crypto_scalarmult_ed25519_bytes(void); SODIUM_EXPORT size_t crypto_scalarmult_ed25519_scalarbytes(void); +/* + * NOTE: Do not use the result of this function directly. + * + * Hash the result with the public keys in order to compute a shared + * secret key: H(q || client_pk || server_pk) + * + * Or unless this is not an option, use the crypto_kx() API instead. + */ SODIUM_EXPORT int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n, const unsigned char *p)