dsa_sign_hash: testing k < q

This commit is contained in:
Karel Miko 2013-10-09 20:34:28 +02:00 committed by Steffen Jaeckel
parent 72022edb8d
commit e600ab9d35

View File

@ -73,8 +73,8 @@ retry:
/* read k */ /* read k */
if ((err = mp_read_unsigned_bin(k, buf, key->qord)) != CRYPT_OK) { goto error; } if ((err = mp_read_unsigned_bin(k, buf, key->qord)) != CRYPT_OK) { goto error; }
/* k > 1 ? */ /* k > 1 and k < q ? */
if (mp_cmp_d(k, 1) != LTC_MP_GT) { goto retry; } if (mp_cmp_d(k, 1) != LTC_MP_GT || mp_cmp(k, key->q) != LTC_MP_LT) { goto retry; }
/* test gcd */ /* test gcd */
if ((err = mp_gcd(k, key->q, tmp)) != CRYPT_OK) { goto error; } if ((err = mp_gcd(k, key->q, tmp)) != CRYPT_OK) { goto error; }