summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/crypto/test/TestCryptoRand.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
commita9bcc81f821d7c66f623779fa5147e728eb3c388 (patch)
tree98676963bcdd537ae5908a067a8eb110b93486a6 /winpr/libwinpr/crypto/test/TestCryptoRand.c
parentInitial commit. (diff)
downloadfreerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz
freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'winpr/libwinpr/crypto/test/TestCryptoRand.c')
-rw-r--r--winpr/libwinpr/crypto/test/TestCryptoRand.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/winpr/libwinpr/crypto/test/TestCryptoRand.c b/winpr/libwinpr/crypto/test/TestCryptoRand.c
new file mode 100644
index 0000000..7dde55e
--- /dev/null
+++ b/winpr/libwinpr/crypto/test/TestCryptoRand.c
@@ -0,0 +1,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;
+}