A double verification of 32 bytes is fast; so is comparing 2 pointers

This commit is contained in:
Frank Denis
2014-07-10 23:57:57 -07:00
parent 2bb8ae26d5
commit 931ce38f61
@@ -7,6 +7,7 @@
#include "crypto_verify_32.h"
#include "ge.h"
#include "sc.h"
#include "utils.h"
int
crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
@@ -45,6 +46,12 @@ crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
if (crypto_verify_32(rcheck, sig) != 0) {
return -1;
}
if (sig == rcheck) {
return -1;
}
if (sodium_memcmp(sig, rcheck, 32) != 0) {
return -1;
}
return 0;
}