From 6b5fa9d0ae7f81a9245a00ace5e5fa035c578738 Mon Sep 17 00:00:00 2001 From: Anthony Hu Date: Thu, 9 Dec 2021 17:12:42 -0500 Subject: [PATCH] remove consistency check; let it fail elsewhere. --- wolfcrypt/src/asn.c | 4 +--- wolfcrypt/src/falcon.c | 22 +++++----------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index be961f8b8..fdc852552 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -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; } diff --git a/wolfcrypt/src/falcon.c b/wolfcrypt/src/falcon.c index 8de9148bc..a18442331 100644 --- a/wolfcrypt/src/falcon.c +++ b/wolfcrypt/src/falcon.c @@ -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.