Parcourir la source

predictable rand() values please

Steffen Jaeckel il y a 11 ans
Parent
commit
64f887e8f3
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      testprof/pkcs_1_test.c

+ 7 - 1
testprof/pkcs_1_test.c

@@ -2,6 +2,12 @@
 
 
 #ifdef LTC_PKCS_1
 #ifdef LTC_PKCS_1
 
 
+#ifdef LTC_TEST_REAL_RAND
+#define LTC_TEST_RAND_SEED  time(NULL)
+#else
+#define LTC_TEST_RAND_SEED  23
+#endif
+
 int pkcs_1_test(void)
 int pkcs_1_test(void)
 {
 {
    unsigned char buf[3][128];
    unsigned char buf[3][128];
@@ -18,7 +24,7 @@ int pkcs_1_test(void)
       return 1;
       return 1;
    }
    }
 
 
-   srand(time(NULL));
+   srand(LTC_TEST_RAND_SEED);
    /* do many tests */
    /* do many tests */
    for (x = 0; x < 100; x++) {
    for (x = 0; x < 100; x++) {
       zeromem(buf, sizeof(buf));
       zeromem(buf, sizeof(buf));