Tests/FindOpenSSL/rand/main.cc
raw| 1 | #include <openssl/rand.h> |
| 2 | |
| 3 | int main() |
| 4 | { |
| 5 | // return value |
| 6 | int retval = 1; |
| 7 | |
| 8 | // bytes buffer |
| 9 | unsigned char buf[1024]; |
| 10 | |
| 11 | // random bytes |
| 12 | int rezval = RAND_bytes(buf, sizeof(buf)); /* 1 success, 0 otherwise */ |
| 13 | |
| 14 | // check result |
| 15 | if (rezval == 1) { |
| 16 | retval = 0; |
| 17 | } |
| 18 | |
| 19 | // return code |
| 20 | return retval; |
| 21 | } |