diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-08-26 14:55:08 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-25 15:08:31 -0400 |
commit | 9e43ee5b4ca3650ecd9c4ee8a1b77843b273d480 (patch) | |
tree | 3f4d62dd70ad058e964f3ce7f7d17cae7f673aab /src/common/crypto_ed25519.c | |
parent | e0097a8839c9dc8e56a7304b84482155dccd0af0 (diff) | |
download | tor-9e43ee5b4ca3650ecd9c4ee8a1b77843b273d480.tar.gz tor-9e43ee5b4ca3650ecd9c4ee8a1b77843b273d480.zip |
Fix API for ed25519_ref10_open()
This is another case where DJB likes sticking the whole signature
prepended to the message, and I don't think that's the hottest idea.
The unit tests still pass.
Diffstat (limited to 'src/common/crypto_ed25519.c')
-rw-r--r-- | src/common/crypto_ed25519.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c index 90a5fa970f..5486c8977a 100644 --- a/src/common/crypto_ed25519.c +++ b/src/common/crypto_ed25519.c @@ -80,24 +80,8 @@ ed25519_checksig(const ed25519_signature_t *signature, const uint8_t *msg, size_t len, const ed25519_public_key_t *pubkey) { - uint8_t *smtmp; - uint8_t *tmp; - uint64_t tmplen; - int r; - - tor_assert(len < SIZE_T_CEILING - 64); - tmplen = len + 64; - tmp = tor_malloc(tmplen); - smtmp = tor_malloc(tmplen); - memcpy(smtmp, signature->sig, 64); - memcpy(smtmp+64, msg, len); - - r = ed25519_ref10_open(tmp, &tmplen, smtmp, tmplen, pubkey->pubkey); - - tor_free(tmp); - tor_free(smtmp); - - return r; + return + ed25519_ref10_open(signature->sig, msg, len, pubkey->pubkey) < 0 ? -1 : 0; } /** Validate every signature among those in <b>checkable</b>, which contains |