From 780974a10927fdbb294fae3145ea75b5eb238faa Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 6 Nov 2017 20:13:47 +0100 Subject: [PATCH] sc_* -> sc25519_* --- .../crypto_core/curve25519/ref10/curve25519_ref10.c | 10 +++++----- src/libsodium/crypto_sign/ed25519/ref10/obsolete.c | 8 ++++---- src/libsodium/crypto_sign/ed25519/ref10/open.c | 4 ++-- src/libsodium/crypto_sign/ed25519/ref10/sign.c | 6 +++--- .../include/sodium/private/curve25519_ref10.h | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c b/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c index 228966c9..32b9a921 100644 --- a/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +++ b/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c @@ -605,8 +605,8 @@ ge25519_tobytes(unsigned char *s, const ge25519_p2 *h) */ void -ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a, const ge25519_p3 *A, - const unsigned char *b) +ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a, + const ge25519_p3 *A, const unsigned char *b) { static const ge25519_precomp Bi[8] = { #ifdef HAVE_TI_MODE @@ -1006,7 +1006,7 @@ ge25519_has_small_order(const unsigned char s[32]) */ void -sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, +sc25519_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, const unsigned char *c) { int64_t a0 = 2097151 & load_3(a); @@ -1493,7 +1493,7 @@ sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, */ void -sc_reduce(unsigned char *s) +sc25519_reduce(unsigned char *s) { int64_t s0 = 2097151 & load_3(s); int64_t s1 = 2097151 & (load_4(s + 2) >> 5); @@ -1817,7 +1817,7 @@ sc_reduce(unsigned char *s) } int -sc_is_canonical(const unsigned char *s) +sc25519_is_canonical(const unsigned char *s) { /* 2^252+27742317777372353535851937790883648493 */ static const unsigned char L[32] = { diff --git a/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c b/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c index 0ef6b04c..8f7e3104 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c @@ -47,15 +47,15 @@ crypto_sign_edwards25519sha512batch(unsigned char *sm, crypto_hash_sha512_final(&hs, nonce); ge25519_scalarmult_base(&A, sk); ge25519_p3_tobytes(sig + 32, &A); - sc_reduce(nonce); + sc25519_reduce(nonce); ge25519_scalarmult_base(&R, nonce); ge25519_p3_tobytes(sig, &R); crypto_hash_sha512_init(&hs); crypto_hash_sha512_update(&hs, sig, 32); crypto_hash_sha512_update(&hs, m, mlen); crypto_hash_sha512_final(&hs, hram); - sc_reduce(hram); - sc_muladd(sig + 32, hram, nonce, sk); + sc25519_reduce(hram); + sc25519_muladd(sig + 32, hram, nonce, sk); sodium_memzero(hram, sizeof hram); memmove(sm + 32, m, (size_t) mlen); memcpy(sm, sig, 32); @@ -98,7 +98,7 @@ crypto_sign_edwards25519sha512batch_open(unsigned char *m, } ge25519_p3_to_cached(&Ai, &A); crypto_hash_sha512(h, sm, mlen + 32); - sc_reduce(h); + sc25519_reduce(h); ge25519_scalarmult(&cs3, h, &R); ge25519_add(&csa, &cs3, &Ai); ge25519_p1p1_to_p2(&cs, &csa); diff --git a/src/libsodium/crypto_sign/ed25519/ref10/open.c b/src/libsodium/crypto_sign/ed25519/ref10/open.c index 2b13ec62..2e527d03 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/open.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/open.c @@ -25,7 +25,7 @@ _crypto_sign_ed25519_verify_detached(const unsigned char *sig, ge25519_p2 R; #ifndef ED25519_COMPAT - if (sc_is_canonical(sig + 32) == 0 || + if (sc25519_is_canonical(sig + 32) == 0 || ge25519_has_small_order(sig) != 0) { return -1; } @@ -46,7 +46,7 @@ _crypto_sign_ed25519_verify_detached(const unsigned char *sig, crypto_hash_sha512_update(&hs, pk, 32); crypto_hash_sha512_update(&hs, m, mlen); crypto_hash_sha512_final(&hs, h); - sc_reduce(h); + sc25519_reduce(h); ge25519_double_scalarmult_vartime(&R, h, &A, sig + 32); ge25519_tobytes(rcheck, &R); diff --git a/src/libsodium/crypto_sign/ed25519/ref10/sign.c b/src/libsodium/crypto_sign/ed25519/ref10/sign.c index d09117c0..1131dbd4 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/sign.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/sign.c @@ -87,7 +87,7 @@ _crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, memmove(sig + 32, sk + 32, 32); - sc_reduce(nonce); + sc25519_reduce(nonce); ge25519_scalarmult_base(&R, nonce); ge25519_p3_tobytes(sig, &R); @@ -96,9 +96,9 @@ _crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, crypto_hash_sha512_update(&hs, m, mlen); crypto_hash_sha512_final(&hs, hram); - sc_reduce(hram); + sc25519_reduce(hram); _crypto_sign_ed25519_clamp(az); - sc_muladd(sig + 32, hram, az, nonce); + sc25519_muladd(sig + 32, hram, az, nonce); sodium_memzero(az, sizeof az); sodium_memzero(nonce, sizeof nonce); diff --git a/src/libsodium/include/sodium/private/curve25519_ref10.h b/src/libsodium/include/sodium/private/curve25519_ref10.h index 4c4f36b8..acb5451d 100644 --- a/src/libsodium/include/sodium/private/curve25519_ref10.h +++ b/src/libsodium/include/sodium/private/curve25519_ref10.h @@ -96,8 +96,8 @@ int ge25519_has_small_order(const unsigned char s[32]); where l = 2^252 + 27742317777372353535851937790883648493. */ -void sc_reduce(unsigned char *); -void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); -int sc_is_canonical(const unsigned char *s); +void sc25519_reduce(unsigned char *); +void sc25519_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); +int sc25519_is_canonical(const unsigned char *s); #endif