mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
A double verification of 32 bytes is fast; so is comparing 2 pointers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user