Skip to content

Commit 584ded1

Browse files
committed
validate falcon level before check
1 parent 31278ee commit 584ded1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

wolfcrypt/src/falcon.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,14 @@ int wc_falcon_check_key(falcon_key* key)
700700
return BAD_FUNC_ARG;
701701
}
702702

703+
if ((key->level != 1) && (key->level != 5)) {
704+
return BAD_FUNC_ARG;
705+
}
706+
707+
if (!key->pubKeySet || !key->prvKeySet) {
708+
return PUBLIC_KEY_E;
709+
}
710+
703711
/* The public key is also decoded and stored within the private key buffer
704712
* behind the private key. Hence, we can compare both stored public keys. */
705713
if (key->level == 1) {

0 commit comments

Comments
 (0)