22 lines
311 B
C++
Raw Normal View History

2015-11-17 17:22:37 +01:00
#include <openssl/rand.h>
int main()
{
// return value
int retval = 1;
// bytes buffer
unsigned char buf[1024];
// random bytes
int rezval = RAND_bytes(buf, sizeof(buf)); /* 1 succes, 0 otherwise */
// check result
2016-07-09 11:21:54 +02:00
if (rezval == 1) {
2015-11-17 17:22:37 +01:00
retval = 0;
}
// return code
return retval;
}