From b4617940f391fc470d12b06ab8cb2649ad66630f Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 23 Dec 2018 18:45:28 +0100 Subject: [PATCH] Correct sc25519_reduce() prototype --- src/libsodium/crypto_core/ed25519/core_ed25519.c | 8 ++++---- src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c | 2 +- src/libsodium/include/sodium/crypto_core_ed25519.h | 6 +++--- src/libsodium/include/sodium/private/ed25519_ref10.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libsodium/crypto_core/ed25519/core_ed25519.c b/src/libsodium/crypto_core/ed25519/core_ed25519.c index f05364a8..e9fce5bb 100644 --- a/src/libsodium/crypto_core/ed25519/core_ed25519.c +++ b/src/libsodium/crypto_core/ed25519/core_ed25519.c @@ -68,7 +68,7 @@ crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r) return - ge25519_has_small_order(p); } -int +void crypto_core_ed25519_scalar_random(unsigned char *r) { do { @@ -86,13 +86,13 @@ crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s) } void -crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s) +crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char s[64]) { - unsigned char t[crypto_core_ed25519_SCALARBYTES]; + unsigned char t[64]; memcpy(t, s, sizeof t); sc25519_reduce(t); - memcpy(r, t, sizeof t); + memcpy(r, t, crypto_core_ed25519_SCALARBYTES); sodium_memzero(t, sizeof t); } diff --git a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c index 22f20db6..fb0d15fd 100644 --- a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c +++ b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c @@ -2108,7 +2108,7 @@ sc25519_invert(unsigned char recip[32], const unsigned char s[32]) */ void -sc25519_reduce(unsigned char s[32]) +sc25519_reduce(unsigned char s[64]) { int64_t s0 = 2097151 & load_3(s); int64_t s1 = 2097151 & (load_4(s + 2) >> 5); diff --git a/src/libsodium/include/sodium/crypto_core_ed25519.h b/src/libsodium/include/sodium/crypto_core_ed25519.h index ac7ebe61..6ab043ce 100644 --- a/src/libsodium/include/sodium/crypto_core_ed25519.h +++ b/src/libsodium/include/sodium/crypto_core_ed25519.h @@ -39,15 +39,15 @@ int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r) __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_core_ed25519_scalar_random(unsigned char *r) +void crypto_core_ed25519_scalar_random(unsigned char *r) __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s) +int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char s[64]) __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s) +void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char s[64]) __attribute__ ((nonnull)); #ifdef __cplusplus diff --git a/src/libsodium/include/sodium/private/ed25519_ref10.h b/src/libsodium/include/sodium/private/ed25519_ref10.h index 3fd6cfbc..5af41591 100644 --- a/src/libsodium/include/sodium/private/ed25519_ref10.h +++ b/src/libsodium/include/sodium/private/ed25519_ref10.h @@ -117,7 +117,7 @@ void ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]); void sc25519_invert(unsigned char recip[32], const unsigned char s[32]); -void sc25519_reduce(unsigned char s[32]); +void sc25519_reduce(unsigned char s[64]); void sc25519_muladd(unsigned char s[32], const unsigned char a[32], const unsigned char b[32], const unsigned char c[32]);