summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/crypto/test/TestCryptoRand.c
blob: 7dde55e958e29213120433a533e94868d1f6bafd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/crypto.h>

int TestCryptoRand(int argc, char* argv[])
{
	char* str = NULL;
	BYTE rnd[16] = { 0 };

	WINPR_UNUSED(argc);
	WINPR_UNUSED(argv);

	winpr_RAND(rnd, sizeof(rnd));

	str = winpr_BinToHexString(rnd, sizeof(rnd), FALSE);
	// fprintf(stderr, "Rand: %s\n", str);
	free(str);

	if (memcmp(rnd, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) == 0)
	{
		return -1;
	}

	return 0;
}