comparison libtommath/mtest/mtest.c @ 1511:5916af64acd4 fuzz

merge from main
author Matt Johnston <matt@ucc.asn.au>
date Sat, 17 Feb 2018 19:29:51 +0800
parents 8bba51a55704
children
comparison
equal deleted inserted replaced
1457:32f990cc96b1 1511:5916af64acd4
305 printf("%s\n", buf); 305 printf("%s\n", buf);
306 mp_to64(&d, buf); 306 mp_to64(&d, buf);
307 printf("%s\n", buf); 307 printf("%s\n", buf);
308 } else if (n == 10) { 308 } else if (n == 10) {
309 /* invmod test */ 309 /* invmod test */
310 do {
310 rand_num2(&a); 311 rand_num2(&a);
311 rand_num2(&b); 312 rand_num2(&b);
312 b.sign = MP_ZPOS; 313 b.sign = MP_ZPOS;
313 a.sign = MP_ZPOS; 314 a.sign = MP_ZPOS;
314 mp_gcd(&a, &b, &c); 315 mp_gcd(&a, &b, &c);
315 if (mp_cmp_d(&c, 1) != 0) continue; 316 } while (mp_cmp_d(&c, 1) != 0 || mp_cmp_d(&b, 1) == 0);
316 if (mp_cmp_d(&b, 1) == 0) continue;
317 mp_invmod(&a, &b, &c); 317 mp_invmod(&a, &b, &c);
318 printf("invmod\n"); 318 printf("invmod\n");
319 mp_to64(&a, buf); 319 mp_to64(&a, buf);
320 printf("%s\n", buf); 320 printf("%s\n", buf);
321 mp_to64(&b, buf); 321 mp_to64(&b, buf);