factor.c (526473251ee3dd5ab71975d6b9780e00a4660b64) | factor.c (537cd766435c80e61e72bb9369f77aa9630a1537) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Landon Curt Noll. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 195 unchanged lines hidden (view full) --- 204#ifdef HAVE_OPENSSL 205 BIGNUM *bnfact; 206 207 bnfact = BN_new(); 208 BN_set_word(bnfact, *(fact - 1)); 209 if (!BN_sqr(bnfact, bnfact, ctx)) 210 errx(1, "error in BN_sqr()"); 211 if (BN_cmp(bnfact, val) > 0 || | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Landon Curt Noll. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 195 unchanged lines hidden (view full) --- 204#ifdef HAVE_OPENSSL 205 BIGNUM *bnfact; 206 207 bnfact = BN_new(); 208 BN_set_word(bnfact, *(fact - 1)); 209 if (!BN_sqr(bnfact, bnfact, ctx)) 210 errx(1, "error in BN_sqr()"); 211 if (BN_cmp(bnfact, val) > 0 || |
212#if OPENSSL_VERSION_NUMBER >= 0x30000000L 213 BN_check_prime(val, NULL, NULL) == 1) 214#else |
|
212 BN_is_prime_ex(val, PRIME_CHECKS, NULL, NULL) == 1) | 215 BN_is_prime_ex(val, PRIME_CHECKS, NULL, NULL) == 1) |
216#endif |
|
213 pr_print(val); 214 else 215 pollard_pminus1(val); 216#else 217 pr_print(val); 218#endif 219 break; 220 } --- 56 unchanged lines hidden (view full) --- 277 goto newbase; 278 279 BN_copy(x, base); 280 BN_sub_word(x, 1); 281 if (!BN_gcd(x, x, val, ctx)) 282 errx(1, "error in BN_gcd()"); 283 284 if (!BN_is_one(x)) { | 217 pr_print(val); 218 else 219 pollard_pminus1(val); 220#else 221 pr_print(val); 222#endif 223 break; 224 } --- 56 unchanged lines hidden (view full) --- 281 goto newbase; 282 283 BN_copy(x, base); 284 BN_sub_word(x, 1); 285 if (!BN_gcd(x, x, val, ctx)) 286 errx(1, "error in BN_gcd()"); 287 288 if (!BN_is_one(x)) { |
289#if OPENSSL_VERSION_NUMBER >= 0x30000000L 290 if (BN_check_prime(x, NULL, NULL) == 1) 291#else |
|
285 if (BN_is_prime_ex(x, PRIME_CHECKS, NULL, NULL) == 1) | 292 if (BN_is_prime_ex(x, PRIME_CHECKS, NULL, NULL) == 1) |
293#endif |
|
286 pr_print(x); 287 else 288 pollard_pminus1(x); 289 fflush(stdout); 290 291 BN_div(num, NULL, val, x, ctx); 292 if (BN_is_one(num)) 293 return; | 294 pr_print(x); 295 else 296 pollard_pminus1(x); 297 fflush(stdout); 298 299 BN_div(num, NULL, val, x, ctx); 300 if (BN_is_one(num)) 301 return; |
294 if (BN_is_prime_ex(num, PRIME_CHECKS, NULL, 295 NULL) == 1) { | 302#if OPENSSL_VERSION_NUMBER >= 0x30000000L 303 if (BN_check_prime(num, NULL, NULL) == 1) 304#else 305 if (BN_is_prime_ex(num, PRIME_CHECKS, NULL, NULL) 306 == 1) 307#endif 308 { |
296 pr_print(num); 297 fflush(stdout); 298 return; 299 } 300 BN_copy(val, num); 301 } 302 if (!BN_add_word(i, 1)) 303 errx(1, "error in BN_add_word()"); --- 106 unchanged lines hidden --- | 309 pr_print(num); 310 fflush(stdout); 311 return; 312 } 313 BN_copy(val, num); 314 } 315 if (!BN_add_word(i, 1)) 316 errx(1, "error in BN_add_word()"); --- 106 unchanged lines hidden --- |