use MIN macro
This commit is contained in:
		
							parent
							
								
									ecbac7324e
								
							
						
					
					
						commit
						bcf7753a26
					
				| @ -84,8 +84,8 @@ retry: | ||||
| 
 | ||||
|    if (mp_iszero(r) == LTC_MP_YES)                                                     { goto retry; } | ||||
| 
 | ||||
|    /* FIPS 186-4 4.6: use leftmost min(bitlen(q), bitlen(hash)) */ | ||||
|    if (inlen > (unsigned long)(key->qord)) inlen = (unsigned long)(key->qord); | ||||
|    /* FIPS 186-4 4.6: use leftmost min(bitlen(q), bitlen(hash)) bits of 'hash'*/ | ||||
|    inlen = MIN(inlen, (unsigned long)(key->qord)); | ||||
| 
 | ||||
|    /* now find s = (in + xr)/k mod q */ | ||||
|    if ((err = mp_read_unsigned_bin(tmp, (unsigned char *)in, inlen)) != CRYPT_OK)      { goto error; } | ||||
|  | ||||
| @ -55,7 +55,7 @@ int dsa_verify_hash_raw(         void   *r,          void   *s, | ||||
|    } | ||||
|     | ||||
|    /* FIPS 186-4 4.7: use leftmost min(bitlen(q), bitlen(hash)) bits of 'hash' */ | ||||
|    if (hashlen > (unsigned long)(key->qord)) hashlen = (unsigned long)(key->qord); | ||||
|    hashlen = MIN(hashlen, (unsigned long)(key->qord)); | ||||
| 
 | ||||
|    /* w = 1/s mod q */ | ||||
|    if ((err = mp_invmod(s, key->q, w)) != CRYPT_OK)                                       { goto error; } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user