6 static int consttime_equal(const unsigned char *x, const unsigned char *y) {
10 #define F(i) r |= x[i] ^ y[i]
47 int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key) {
49 unsigned char checker[32];
54 if (signature[63] & 224) {
58 if (ge_frombytes_negate_vartime(&A, public_key) != 0) {
63 sha512_update(&hash, signature, 32);
64 sha512_update(&hash, public_key, 32);
65 sha512_update(&hash, message, message_len);
66 sha512_final(&hash, h);
69 ge_double_scalarmult_vartime(&R, h, &A, signature + 32);
70 ge_tobytes(checker, &R);
72 if (!consttime_equal(checker, signature)) {