From ad5a165f94f087d04a648e56839227fcbafa00d5 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 21 Sep 2014 22:06:45 -0700 Subject: [PATCH] crypto_sign(): read the copy, not the message, to properly handle overlaps --- src/libsodium/crypto_sign/ed25519/ref10/sign.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libsodium/crypto_sign/ed25519/ref10/sign.c b/src/libsodium/crypto_sign/ed25519/ref10/sign.c index 80f64955..1ee5d6c4 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/sign.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/sign.c @@ -63,7 +63,8 @@ crypto_sign(unsigned char *sm, unsigned long long *smlen, memmove(sm + crypto_sign_ed25519_BYTES, m, mlen); /* LCOV_EXCL_START */ - if (crypto_sign_detached(sm, &siglen, m, mlen, sk) != 0 || + if (crypto_sign_detached(sm, &siglen, sm + crypto_sign_ed25519_BYTES, + mlen, sk) != 0 || siglen != crypto_sign_ed25519_BYTES) { if (smlen != NULL) { *smlen = 0;