Debian Codegraph @

crypto_mGnP/ed25519/ref10/fe_isnonzero.c

raw
1 // linker define fe_isnonzero
2 // linker use fe_tobytes
3
4 #include "fe.h"
5 #include "crypto_verify_32.h"
6
7 /*
8 return 1 if f == 0
9 return 0 if f != 0
10
11 Preconditions:
12 |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
13 */
14
15 static const unsigned char zero[32];
16
17 int fe_isnonzero(const fe f)
18 {
19 unsigned char s[32];
20 fe_tobytes(s,f);
21 return crypto_verify_32(s,zero);
22 }