tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

fe_isnonzero.c (315B)


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