diff --git a/src/libsodium/crypto_sign/ed25519/ref10/sign.c b/src/libsodium/crypto_sign/ed25519/ref10/sign.c index f9d47fdc..6ea94fff 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/sign.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/sign.c @@ -5,6 +5,7 @@ #include "crypto_sign_ed25519.h" #include "ed25519_ref10.h" #include "private/curve25519_ref10.h" +#include "randombytes.h" #include "utils.h" void @@ -40,6 +41,10 @@ _crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, az[31] |= 64; _crypto_sign_ed25519_ref10_hinit(&hs, prehashed); +#ifdef ED25519_NONDETERMINISTIC + randombytes_buf(nonce, 32); + crypto_hash_sha512_update(&hs, nonce, 32); +#endif crypto_hash_sha512_update(&hs, az + 32, 32); crypto_hash_sha512_update(&hs, m, mlen); crypto_hash_sha512_final(&hs, nonce); diff --git a/test/default/sign.c b/test/default/sign.c index a577df80..1b782633 100644 --- a/test/default/sign.c +++ b/test/default/sign.c @@ -1311,5 +1311,9 @@ int main(void) == crypto_sign_ed25519_secretkeybytes()); assert(crypto_sign_statebytes() == crypto_sign_ed25519ph_statebytes()); +#ifdef ED25519_NONDETERMINISTIC + exit(0); +#endif + return 0; }