From 9e43ee5b4ca3650ecd9c4ee8a1b77843b273d480 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 26 Aug 2014 14:55:08 -0400 Subject: 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. --- src/common/crypto_ed25519.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src/common') 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 checkable, which contains -- cgit v1.2.3-54-g00ecf