remove consistency check; let it fail elsewhere.

This commit is contained in:
Anthony Hu
2021-12-09 17:12:42 -05:00
parent 494abde3eb
commit 6b5fa9d0ae
2 changed files with 6 additions and 20 deletions

View File

@ -6217,9 +6217,7 @@ int wc_CheckPrivateKey(const byte* privKey, word32 privKeySz,
keyIdx = 0;
if ((ret = wc_falcon_import_public(pubKey, pubKeySz,
key_pair)) == 0) {
/* public and private extracted successfully no check if is
* a pair and also do sanity checks on key. wc_ecc_check_key
* checks that private * base generator equals pubkey */
/* Public and private extracted successfully. Sanity check. */
if ((ret = wc_falcon_check_key(key_pair)) == 0)
ret = 1;
}

View File

@ -588,24 +588,12 @@ int wc_falcon_export_key(falcon_key* key, byte* priv, word32 *privSz,
*/
int wc_falcon_check_key(falcon_key* key)
{
/* Sign and verify a message. */
int ret = 0;
int res = 0;
const byte *msg = (const byte *)"The wolfSSL team is here to make you "
"ready for quantum computers!!";
word32 msglen = (word32)sizeof(msg);
byte sig[FALCON_MAX_SIG_SIZE];
word32 siglen = (word32)sizeof(sig);
ret = wc_falcon_sign_msg(msg, msglen, sig, &siglen, key);
if (ret == 0) {
ret = wc_falcon_verify_msg(sig, siglen, msg, msglen, &res, key);
if ((ret != 0) || (res != 1)) {
ret = SIG_VERIFY_E;
if (key == NULL) {
return BAD_FUNC_ARG;
}
}
return ret;
/* Assume everything is fine. */
return 0;
}
/* Returns the size of a falcon private key.