vlm | d3da851 | 2004-08-19 13:26:54 +0000 | [diff] [blame] | 1 | #include <OBJECT_IDENTIFIER.c> |
| 2 | #include <RELATIVE-OID.c> |
| 3 | #include <INTEGER.c> |
| 4 | #include <ber_decoder.c> |
| 5 | #include <ber_tlv_length.c> |
| 6 | #include <ber_tlv_tag.c> |
| 7 | #include <der_encoder.c> |
| 8 | #include <constraints.c> |
| 9 | |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 10 | #include <sys/time.h> |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 11 | |
| 12 | static int |
| 13 | _print(const void *buffer, size_t size, void *app_key) { |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 14 | (void)app_key; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 15 | fwrite(buffer, size, 1, stdout); |
| 16 | return 0; |
| 17 | } |
| 18 | |
| 19 | static void |
| 20 | check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) { |
| 21 | OBJECT_IDENTIFIER_t *oid; |
| 22 | ber_dec_rval_t rval; |
| 23 | unsigned long arcs[10]; |
| 24 | int alen; |
| 25 | int i; |
| 26 | |
| 27 | printf("Checking {"); |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 28 | for(i = 0; i < (int)len; i++) { printf("%s%02x", i?" ":"", buf[i]); } |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 29 | printf("} against {"); |
| 30 | for(i = 0; i < ck_len; i++) { printf("%s%d", i?" ":"", ck_buf[i]); } |
| 31 | printf("}\n"); |
| 32 | |
| 33 | oid = NULL; |
| 34 | rval = ber_decode(&asn1_DEF_OBJECT_IDENTIFIER, (void *)&oid, buf, len); |
| 35 | assert(rval.code == RC_OK); |
| 36 | |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 37 | assert(oid->size == (ssize_t)len - 2); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 38 | |
| 39 | /* |
| 40 | * Print the contents for visual debugging. |
| 41 | */ |
| 42 | printf("OBJECT_IDENTIFIER_print() => "); |
| 43 | OBJECT_IDENTIFIER_print(&asn1_DEF_OBJECT_IDENTIFIER, oid, 0, _print, 0); |
| 44 | printf("\n"); |
| 45 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 46 | memset(arcs, 'A', sizeof(arcs)); |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 47 | alen = OBJECT_IDENTIFIER_get_arcs(oid, |
| 48 | arcs, sizeof(arcs[0]), sizeof(arcs)/sizeof(arcs[0])); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 49 | assert(alen > 0); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 50 | |
vlm | 903a213 | 2004-08-22 03:01:37 +0000 | [diff] [blame] | 51 | printf("OBJECT_IDENTIFIER_get_arcs() => {"); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 52 | /* |
| 53 | * Make sure they are equivalent. |
| 54 | */ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 55 | for(i = 0; i < alen; i++) { |
| 56 | printf(" %lu", arcs[i]); |
vlm | 903a213 | 2004-08-22 03:01:37 +0000 | [diff] [blame] | 57 | if(alen == ck_len) { |
| 58 | assert(arcs[i] == (unsigned long)ck_buf[i]); |
| 59 | } |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 60 | } |
| 61 | printf(" }\n"); |
vlm | 903a213 | 2004-08-22 03:01:37 +0000 | [diff] [blame] | 62 | assert(alen == ck_len); |
| 63 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | static void |
| 67 | check_ROID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) { |
| 68 | RELATIVE_OID_t *oid; |
| 69 | ber_dec_rval_t rval; |
| 70 | unsigned long arcs[10]; |
| 71 | int alen; |
| 72 | int i; |
| 73 | |
| 74 | printf("Checking {"); |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 75 | for(i = 0; i < (ssize_t)len; i++) { printf("%s%02x", i?" ":"", buf[i]); } |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 76 | printf("} against {"); |
| 77 | for(i = 0; i < ck_len; i++) { printf("%s%d", i?" ":"", ck_buf[i]); } |
| 78 | printf("}\n"); |
| 79 | |
| 80 | oid = NULL; |
| 81 | rval = ber_decode(&asn1_DEF_RELATIVE_OID, (void *)&oid, buf, len); |
| 82 | assert(rval.code == RC_OK); |
| 83 | |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 84 | assert(oid->size == (ssize_t)len - 2); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 85 | |
| 86 | /* |
| 87 | * Print the contents for visual debugging. |
| 88 | */ |
| 89 | printf("RELATIVE_OID_print() => "); |
| 90 | RELATIVE_OID_print(&asn1_DEF_RELATIVE_OID, oid, 0, _print, 0); |
| 91 | printf("\n"); |
| 92 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 93 | memset(arcs, 'A', sizeof(arcs)); |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 94 | alen = RELATIVE_OID_get_arcs(oid, |
| 95 | arcs, sizeof(arcs[0]), sizeof(arcs)/sizeof(arcs[0])); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 96 | assert(alen > 0); |
| 97 | assert(alen == ck_len); |
| 98 | |
| 99 | /* |
| 100 | * Make sure they are equivalent. |
| 101 | */ |
| 102 | printf("RELATIVE_OID_get_arcs() => {"); |
| 103 | for(i = 0; i < alen; i++) { |
| 104 | printf(" %lu", (unsigned long)arcs[i]); |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 105 | assert(arcs[i] == (unsigned long)ck_buf[i]); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 106 | } |
| 107 | printf(" }\n"); |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * Encode the specified array of arcs as RELATIVE-OID, decode it and compare. |
| 112 | */ |
| 113 | static void |
| 114 | check_REGEN(int *arcs, int acount) { |
| 115 | static RELATIVE_OID_t oid; |
| 116 | unsigned long tmp_arcs[10]; |
| 117 | int tmp_alen = 10; |
| 118 | int alen; |
| 119 | int ret; |
| 120 | int i; |
| 121 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 122 | printf("Encoding (R) {"); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 123 | for(i = 0; i < acount; i++) { |
| 124 | printf(" %u", arcs[i]); |
| 125 | } |
| 126 | printf(" }\n"); |
| 127 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 128 | ret = RELATIVE_OID_set_arcs(&oid, arcs, sizeof(arcs[0]), acount); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 129 | assert(ret == 0); |
| 130 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 131 | memset(tmp_arcs, 'A', sizeof(tmp_arcs)); |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 132 | alen = RELATIVE_OID_get_arcs(&oid, tmp_arcs, |
| 133 | sizeof(tmp_arcs[0]), tmp_alen); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 134 | assert(alen >= 0); |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 135 | assert(alen <= tmp_alen); |
| 136 | assert(alen == acount); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 137 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 138 | printf("Encoded (R) {"); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 139 | for(i = 0; i < alen; i++) { |
| 140 | printf(" %lu", tmp_arcs[i]); |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 141 | assert((unsigned long)arcs[i] == tmp_arcs[i]); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 142 | } |
| 143 | printf(" }\n"); |
| 144 | } |
| 145 | |
| 146 | /* |
| 147 | * Encode the specified array of arcs as OBJECT IDENTIFIER, |
| 148 | * decode it and compare. |
| 149 | */ |
| 150 | static void |
| 151 | check_REGEN_OID(int *arcs, int acount) { |
| 152 | static OBJECT_IDENTIFIER_t oid; |
| 153 | unsigned long tmp_arcs[10]; |
| 154 | int tmp_alen = 10; |
| 155 | int alen; |
| 156 | int ret; |
| 157 | int i; |
| 158 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 159 | printf("Encoding (O) {"); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 160 | for(i = 0; i < acount; i++) { |
| 161 | printf(" %u", arcs[i]); |
| 162 | } |
| 163 | printf(" }\n"); |
| 164 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 165 | ret = OBJECT_IDENTIFIER_set_arcs(&oid, arcs, sizeof(arcs[0]), acount); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 166 | assert(ret == 0); |
| 167 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 168 | memset(tmp_arcs, 'A', sizeof(tmp_arcs)); |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 169 | alen = OBJECT_IDENTIFIER_get_arcs(&oid, |
| 170 | tmp_arcs, sizeof(tmp_arcs[0]), tmp_alen); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 171 | assert(alen >= 0); |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 172 | assert(alen <= tmp_alen); |
| 173 | assert(alen == acount); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 174 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 175 | printf("Encoded (O) { "); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 176 | for(i = 0; i < alen; i++) { |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 177 | printf("%lu ", tmp_arcs[i]); fflush(stdout); |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 178 | assert((unsigned long)arcs[i] == tmp_arcs[i]); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 179 | } |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 180 | printf("}\n"); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 181 | } |
| 182 | |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 183 | static int |
| 184 | check_speed() { |
| 185 | uint8_t buf[] = { 0x80 | 7, 0x80 | 2, 0x80 | 3, 0x80 | 4, 13 }; |
| 186 | int ret = 0; |
| 187 | int cycles = 100000000; |
| 188 | double a, b, c; |
| 189 | struct timeval tv; |
| 190 | unsigned long value; |
| 191 | int i; |
| 192 | |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 193 | ret = OBJECT_IDENTIFIER_get_single_arc(buf, sizeof(buf), 0, &value, sizeof(value)); |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 194 | assert(ret == 0); |
| 195 | assert(value == 0x7040c20d); |
| 196 | |
| 197 | gettimeofday(&tv, 0); |
| 198 | a = tv.tv_sec + tv.tv_usec / 1000000.0; |
| 199 | for(i = 0; i < cycles; i++) { |
| 200 | ret = OBJECT_IDENTIFIER_get_single_arc(buf, sizeof(buf), 0, |
| 201 | &value, sizeof(value)); |
| 202 | } |
| 203 | assert(ret == 0); |
| 204 | assert(value == 0x7040c20d); |
| 205 | gettimeofday(&tv, 0); |
| 206 | b = tv.tv_sec + tv.tv_usec / 1000000.0; |
| 207 | for(i = 0; i < cycles; i++) { |
| 208 | ret = OBJECT_IDENTIFIER_get_single_arc(buf, sizeof(buf), 0, |
| 209 | &value, sizeof(value)); |
| 210 | } |
| 211 | assert(ret == 0); |
| 212 | assert(value == 0x7040c20d); |
| 213 | gettimeofday(&tv, 0); |
| 214 | c = tv.tv_sec + tv.tv_usec / 1000000.0; |
| 215 | |
| 216 | a = b - a; |
| 217 | b = c - b; |
| 218 | printf("Time for single_arc(): %f\n", a); |
| 219 | printf("Time for get_arc_l(): %f\n", b); |
| 220 | |
| 221 | return 0; |
| 222 | } |
| 223 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 224 | #define CHECK_OID(n) check_OID(buf ## n, sizeof(buf ## n), \ |
| 225 | buf ## n ## _check, \ |
| 226 | sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) |
| 227 | #define CHECK_ROID(n) check_ROID(buf ## n, sizeof(buf ## n), \ |
| 228 | buf ## n ## _check, \ |
| 229 | sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) |
| 230 | #define CHECK_REGEN(n) check_REGEN(buf ## n ## _check, \ |
| 231 | sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) |
| 232 | #define CHECK_REGEN_OID(n) check_REGEN_OID(buf ## n ## _check, \ |
| 233 | sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) |
| 234 | |
| 235 | int |
vlm | a97e224 | 2004-06-14 07:40:17 +0000 | [diff] [blame] | 236 | main() { |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 237 | int i; |
| 238 | |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 239 | /* {joint-iso-itu-t 230 3} */ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 240 | uint8_t buf1[] = { |
| 241 | 0x06, /* OBJECT IDENTIFIER */ |
| 242 | 0x03, /* Length */ |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 243 | 0x82, 0x36, 0x03 |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 244 | }; |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 245 | int buf1_check[] = { 2, 230, 3 }; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 246 | |
| 247 | /* {8571 3 2} */ |
| 248 | uint8_t buf2[] = { |
| 249 | 0x0D, /* RELATIVE-OID */ |
| 250 | 0x04, /* Length */ |
| 251 | 0xC2, 0x7B, 0x03, 0x02 |
| 252 | }; |
| 253 | int buf2_check[] = { 8571, 3, 2 }; |
| 254 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 255 | /* {joint-iso-itu-t 42 } */ |
| 256 | uint8_t buf3[] = { |
| 257 | 0x06, /* OBJECT IDENTIFIER */ |
| 258 | 0x01, /* Length */ |
| 259 | 0x7A |
| 260 | }; |
| 261 | int buf3_check[] = { 2, 42 }; |
| 262 | |
| 263 | /* {joint-iso-itu-t 25957 } */ |
| 264 | uint8_t buf4[] = { |
| 265 | 0x06, /* OBJECT IDENTIFIER */ |
| 266 | 0x03, /* Length */ |
| 267 | 0x81, 0x80 + 0x4B, 0x35 |
| 268 | }; |
| 269 | int buf4_check[] = { 2, 25957 }; |
| 270 | |
| 271 | int buf5_check[] = { 0 }; |
| 272 | int buf6_check[] = { 1 }; |
| 273 | int buf7_check[] = { 80, 40 }; |
| 274 | int buf8_check[] = { 127 }; |
| 275 | int buf9_check[] = { 128 }; |
| 276 | int buf10_check[] = { 65535, 65536 }; |
| 277 | int buf11_check[] = { 100000, 0x20000, 1234, 256, 127, 128 }; |
| 278 | int buf12_check[] = { 0, 0xffffffff, 0xff00ff00, 0 }; |
| 279 | int buf13_check[] = { 0, 1, 2 }; |
| 280 | int buf14_check[] = { 1, 38, 3 }; |
| 281 | int buf15_check[] = { 0, 0, 0xf000 }; |
| 282 | int buf16_check[] = { 0, 0, 0, 1, 0 }; |
| 283 | int buf17_check[] = { 2, 0xffffffAf, 0xff00ff00, 0 }; |
vlm | 903a213 | 2004-08-22 03:01:37 +0000 | [diff] [blame] | 284 | int buf18_check[] = { 2, 2, 1, 1 }; |
| 285 | |
| 286 | /* { joint-iso-itu-t 2 1 1 } */ |
| 287 | uint8_t buf19[] = { |
| 288 | 0x06, /* OBJECT IDENTIFIER */ |
| 289 | 0x03, /* Length */ |
| 290 | 0x52, 0x01, 0x01 |
| 291 | }; |
| 292 | int buf19_check[] = { 2, 2, 1, 1 }; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 293 | |
vlm | 3fff06b | 2004-08-23 09:23:02 +0000 | [diff] [blame] | 294 | /* { joint-iso-itu-t 2 1 0 1 } */ |
| 295 | uint8_t buf20[] = { |
| 296 | 0x06, /* OBJECT IDENTIFIER */ |
| 297 | 0x04, /* Length */ |
| 298 | 0x52, 0x01, 0x00, 0x01 |
| 299 | }; |
| 300 | int buf20_check[] = { 2, 2, 1, 0, 1 }; |
| 301 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 302 | |
| 303 | CHECK_OID(1); /* buf1, buf1_check */ |
| 304 | CHECK_ROID(2); /* buf2, buf2_check */ |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 305 | CHECK_OID(3); /* buf3, buf3_check */ |
| 306 | CHECK_OID(4); /* buf4, buf4_check */ |
vlm | 903a213 | 2004-08-22 03:01:37 +0000 | [diff] [blame] | 307 | CHECK_OID(19); /* buf19, buf19_check */ |
vlm | 3fff06b | 2004-08-23 09:23:02 +0000 | [diff] [blame] | 308 | CHECK_OID(20); /* buf20, buf20_check */ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 309 | |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 310 | CHECK_REGEN(5); /* Regenerate RELATIVE-OID */ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 311 | CHECK_REGEN(6); |
| 312 | CHECK_REGEN(7); |
| 313 | CHECK_REGEN(8); |
| 314 | CHECK_REGEN(9); |
| 315 | CHECK_REGEN(10); |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 316 | CHECK_REGEN(11); |
| 317 | CHECK_REGEN(12); |
| 318 | CHECK_REGEN(13); |
| 319 | CHECK_REGEN(14); |
| 320 | CHECK_REGEN(15); |
| 321 | CHECK_REGEN(16); |
| 322 | CHECK_REGEN(17); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 323 | CHECK_REGEN_OID(1); /* Regenerate OBJECT IDENTIFIER */ |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 324 | CHECK_REGEN_OID(3); /* Regenerate OBJECT IDENTIFIER */ |
| 325 | CHECK_REGEN_OID(4); /* Regenerate OBJECT IDENTIFIER */ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 326 | CHECK_REGEN_OID(13); |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 327 | CHECK_REGEN_OID(14); |
| 328 | CHECK_REGEN_OID(15); |
| 329 | CHECK_REGEN_OID(16); |
| 330 | CHECK_REGEN_OID(17); |
vlm | 903a213 | 2004-08-22 03:01:37 +0000 | [diff] [blame] | 331 | CHECK_REGEN_OID(18); |
vlm | 3fff06b | 2004-08-23 09:23:02 +0000 | [diff] [blame] | 332 | CHECK_REGEN_OID(19); |
| 333 | CHECK_REGEN_OID(20); |
vlm | 1255771 | 2004-06-17 23:43:39 +0000 | [diff] [blame] | 334 | |
| 335 | for(i = 0; i < 100000; i++) { |
| 336 | int bufA_check[3] = { 2, i, rand() }; |
| 337 | int bufB_check[2] = { rand(), i * 121 }; |
| 338 | CHECK_REGEN(A); |
| 339 | CHECK_REGEN_OID(A); |
| 340 | CHECK_REGEN(B); |
| 341 | if(i > 100) i++; |
| 342 | if(i > 500) i++; |
| 343 | if(i > 1000) i += 3; |
| 344 | if(i > 5000) i += 151; |
| 345 | } |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 346 | |
vlm | 3717fb3 | 2004-06-14 08:17:27 +0000 | [diff] [blame] | 347 | if(getenv("CHECK_SPEED")) { |
| 348 | /* Useful for developers only */ |
| 349 | check_speed(); |
| 350 | } |
vlm | 2e3dd3b | 2004-06-14 07:24:36 +0000 | [diff] [blame] | 351 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 352 | return 0; |
| 353 | } |