mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
remove consistency check; let it fail elsewhere.
This commit is contained in:
@@ -6217,9 +6217,7 @@ int wc_CheckPrivateKey(const byte* privKey, word32 privKeySz,
|
|||||||
keyIdx = 0;
|
keyIdx = 0;
|
||||||
if ((ret = wc_falcon_import_public(pubKey, pubKeySz,
|
if ((ret = wc_falcon_import_public(pubKey, pubKeySz,
|
||||||
key_pair)) == 0) {
|
key_pair)) == 0) {
|
||||||
/* public and private extracted successfully no check if is
|
/* Public and private extracted successfully. Sanity check. */
|
||||||
* a pair and also do sanity checks on key. wc_ecc_check_key
|
|
||||||
* checks that private * base generator equals pubkey */
|
|
||||||
if ((ret = wc_falcon_check_key(key_pair)) == 0)
|
if ((ret = wc_falcon_check_key(key_pair)) == 0)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
@@ -588,24 +588,12 @@ int wc_falcon_export_key(falcon_key* key, byte* priv, word32 *privSz,
|
|||||||
*/
|
*/
|
||||||
int wc_falcon_check_key(falcon_key* key)
|
int wc_falcon_check_key(falcon_key* key)
|
||||||
{
|
{
|
||||||
/* Sign and verify a message. */
|
if (key == NULL) {
|
||||||
int ret = 0;
|
return BAD_FUNC_ARG;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
/* Assume everything is fine. */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the size of a falcon private key.
|
/* Returns the size of a falcon private key.
|
||||||
|
Reference in New Issue
Block a user