From fd14a458d71f23c1e39e449661fd309d70492486 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 6 Nov 2017 20:19:50 +0100 Subject: [PATCH] Use verbose prototypes Having only parameter types in prototypes is confusing. So, include parameter names as well. --- .../curve25519/ref10/curve25519_ref10.c | 4 +- .../include/sodium/private/curve25519_ref10.h | 42 +++++++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c b/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c index 32b9a921..e82465d7 100644 --- a/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +++ b/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c @@ -1006,8 +1006,8 @@ ge25519_has_small_order(const unsigned char s[32]) */ void -sc25519_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, - const unsigned char *c) +sc25519_muladd(unsigned char *s, const unsigned char *a, + const unsigned char *b, const unsigned char *c) { int64_t a0 = 2097151 & load_3(a); int64_t a1 = 2097151 & (load_4(a + 2) >> 5); diff --git a/src/libsodium/include/sodium/private/curve25519_ref10.h b/src/libsodium/include/sodium/private/curve25519_ref10.h index acb5451d..7e325208 100644 --- a/src/libsodium/include/sodium/private/curve25519_ref10.h +++ b/src/libsodium/include/sodium/private/curve25519_ref10.h @@ -73,22 +73,35 @@ typedef struct { fe25519 T2d; } ge25519_cached; -void ge25519_tobytes(unsigned char *,const ge25519_p2 *); -void ge25519_p3_tobytes(unsigned char *,const ge25519_p3 *); -int ge25519_frombytes(ge25519_p3 *,const unsigned char *); -int ge25519_frombytes_negate_vartime(ge25519_p3 *,const unsigned char *); +void ge25519_tobytes(unsigned char *s, const ge25519_p2 *h); -void ge25519_p3_to_cached(ge25519_cached *,const ge25519_p3 *); -void ge25519_p1p1_to_p2(ge25519_p2 *,const ge25519_p1p1 *); +void ge25519_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +int ge25519_frombytes(ge25519_p3 *h, const unsigned char *s); + +int ge25519_frombytes_negate_vartime(ge25519_p3 *h, const unsigned char *s); + +void ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p); + +void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p); + +void ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a); + +void ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a, + const ge25519_p3 *A, + const unsigned char *b); + +void ge25519_scalarmult(ge25519_p3 *h, const unsigned char *a, + const ge25519_p3 *p); -void ge25519_add(ge25519_p1p1 *,const ge25519_p3 *,const ge25519_cached *); -void ge25519_scalarmult_base(ge25519_p3 *,const unsigned char *); -void ge25519_double_scalarmult_vartime(ge25519_p2 *,const unsigned char *,const ge25519_p3 *,const unsigned char *); -void ge25519_scalarmult(ge25519_p3 *,const unsigned char *,const ge25519_p3 *); -void ge25519_scalarmult_vartime(ge25519_p3 *,const unsigned char *,const ge25519_p3 *); int ge25519_is_canonical(const unsigned char *s); + int ge25519_is_on_curve(const ge25519_p3 *p); + int ge25519_is_on_main_subgroup(const ge25519_p3 *p); + int ge25519_has_small_order(const unsigned char s[32]); /* @@ -96,8 +109,11 @@ int ge25519_has_small_order(const unsigned char s[32]); where l = 2^252 + 27742317777372353535851937790883648493. */ -void sc25519_reduce(unsigned char *); -void sc25519_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); +void sc25519_reduce(unsigned char *s); + +void sc25519_muladd(unsigned char *s, const unsigned char *a, + const unsigned char *b, const unsigned char *c); + int sc25519_is_canonical(const unsigned char *s); #endif