Mercurial > dropbear
comparison demos/test/pkcs_1_test.c @ 143:5d99163f7e32 libtomcrypt-orig
import of libtomcrypt 0.99
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 19 Dec 2004 11:34:45 +0000 |
parents | 6362d3854bb4 |
children |
comparison
equal
deleted
inserted
replaced
15:6362d3854bb4 | 143:5d99163f7e32 |
---|---|
1 #include "test.h" | 1 #include "test.h" |
2 | |
3 #ifdef PKCS_1 | |
2 | 4 |
3 int pkcs_1_test(void) | 5 int pkcs_1_test(void) |
4 { | 6 { |
5 unsigned char buf[3][128]; | 7 unsigned char buf[3][128]; |
6 int res1, res2, res3, prng_idx, hash_idx; | 8 int res1, res2, res3, prng_idx, hash_idx; |
15 printf("pkcs_1 tests require sha1/yarrow"); | 17 printf("pkcs_1 tests require sha1/yarrow"); |
16 return 1; | 18 return 1; |
17 } | 19 } |
18 | 20 |
19 /* do many tests */ | 21 /* do many tests */ |
20 for (x = 0; x < 10000; x++) { | 22 for (x = 0; x < 100; x++) { |
21 zeromem(buf, sizeof(buf)); | 23 zeromem(buf, sizeof(buf)); |
22 | 24 |
23 /* make a dummy message (of random length) */ | 25 /* make a dummy message (of random length) */ |
24 l3 = (rand() & 31) + 8; | 26 l3 = (rand() & 31) + 8; |
25 for (y = 0; y < l3; y++) buf[0][y] = rand() & 255; | 27 for (y = 0; y < l3; y++) buf[0][y] = rand() & 255; |
99 return 1; | 101 return 1; |
100 } | 102 } |
101 } | 103 } |
102 return 0; | 104 return 0; |
103 } | 105 } |
106 | |
107 #else | |
108 | |
109 int pkcs_1_test(void) | |
110 { | |
111 printf("NOP"); | |
112 return 0; | |
113 } | |
114 | |
115 #endif | |
116 |