| 1 |
|
| 2 |
#include <winpr/crt.h> |
| 3 |
#include <winpr/print.h> |
| 4 |
#include <winpr/crypto.h> |
| 5 |
|
| 6 |
int TestCryptoRand(int argc, char* argv[]) |
| 7 |
{ |
| 8 |
char* str = nullptr; |
| 9 |
BYTE rnd[16] = WINPR_C_ARRAY_INIT; |
| 10 |
|
| 11 |
WINPR_UNUSED(argc); |
| 12 |
WINPR_UNUSED(argv); |
| 13 |
|
| 14 |
if (winpr_RAND(rnd, sizeof(rnd)) < 0) |
| 15 |
return -1; |
| 16 |
|
| 17 |
str = winpr_BinToHexString(rnd, sizeof(rnd), FALSE); |
| 18 |
// (void)fprintf(stderr, "Rand: %s\n", str); |
| 19 |
free(str); |
| 20 |
|
| 21 |
if (memcmp(rnd, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) == 0) |
| 22 |
{ |
| 23 |
return -1; |
| 24 |
} |
| 25 |
|
| 26 |
return 0; |
| 27 |
} |