Merge branch 'pr/133' into develop

This closes #133
This commit is contained in:
Steffen Jaeckel 2017-02-21 16:45:12 +01:00
commit a8df316581
2 changed files with 6 additions and 0 deletions

View File

@ -84,6 +84,9 @@ retry:
if (mp_iszero(r) == LTC_MP_YES) { goto retry; }
/* 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; }
if ((err = mp_mul(key->x, r, s)) != CRYPT_OK) { goto error; }

View File

@ -54,6 +54,9 @@ int dsa_verify_hash_raw( void *r, void *s,
goto error;
}
/* FIPS 186-4 4.7: use leftmost min(bitlen(q), bitlen(hash)) bits of 'hash' */
hashlen = MIN(hashlen, (unsigned long)(key->qord));
/* w = 1/s mod q */
if ((err = mp_invmod(s, key->q, w)) != CRYPT_OK) { goto error; }