fix fast_mp_invmod() not being able to handle case where b=1
This closes #67
This commit is contained in:
		
							parent
							
								
									bc11ea7585
								
							
						
					
					
						commit
						393a527364
					
				| @ -25,7 +25,7 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) | |||||||
| 
 | 
 | ||||||
| #ifdef BN_FAST_MP_INVMOD_C | #ifdef BN_FAST_MP_INVMOD_C | ||||||
|   /* if the modulus is odd we can use a faster routine instead */ |   /* if the modulus is odd we can use a faster routine instead */ | ||||||
|   if (mp_isodd (b) == MP_YES) { |   if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { | ||||||
|     return fast_mp_invmod (a, b, c); |     return fast_mp_invmod (a, b, c); | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user