do dsa_int_validate_* in dsa_import
This commit is contained in:
parent
fd94e9540f
commit
444d9f3fb7
@ -24,7 +24,7 @@
|
||||
*/
|
||||
int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key)
|
||||
{
|
||||
int err;
|
||||
int err, stat;
|
||||
unsigned long zero = 0;
|
||||
unsigned char* tmpbuf = NULL;
|
||||
unsigned char flags[1];
|
||||
@ -118,8 +118,19 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key)
|
||||
LBL_OK:
|
||||
key->qord = mp_unsigned_bin_size(key->q);
|
||||
|
||||
if (key->qord >= LTC_MDSA_MAX_GROUP || key->qord <= 15 ||
|
||||
(unsigned long)key->qord >= mp_unsigned_bin_size(key->p) || (mp_unsigned_bin_size(key->p) - key->qord) >= LTC_MDSA_DELTA) {
|
||||
/* quick p, q, g validation, without primality testing */
|
||||
if ((err = dsa_int_validate_pqg(key, &stat)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
if (stat == 0) {
|
||||
err = CRYPT_INVALID_PACKET;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
/* validate x, y */
|
||||
if ((err = dsa_int_validate_xy(key, &stat)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
if (stat == 0) {
|
||||
err = CRYPT_INVALID_PACKET;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user