skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

trygrndinsecure.c (271B)


      1 /* ISC license. */
      2 
      3 #include <features.h>
      4 
      5 #ifdef __stub_getrandom
      6 #error getrandom() appears to be a stub function, we won't use it.
      7 #endif
      8 
      9 #include <sys/random.h>
     10 
     11 int main (void)
     12 {
     13   char buf[4] ;
     14   if (getrandom(buf, 4, GRND_INSECURE) < 0) return 1 ;
     15   return 0 ;
     16 }