mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 12:44:45 +02:00
Merge pull request #4641 from anhu/priv_key_check
Actually do a private/public key check for FALCON.
This commit is contained in:
@@ -6231,9 +6231,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;
|
||||
}
|
||||
@@ -28203,8 +28201,7 @@ int wc_Falcon_PrivateKeyDecode(const byte* input, word32* inOutIdx,
|
||||
pubKey, &pubKeyLen, keytype);
|
||||
if (ret == 0) {
|
||||
if (pubKeyLen == 0) {
|
||||
ret = wc_falcon_import_private_only(privKey, privKeyLen,
|
||||
key);
|
||||
ret = wc_falcon_import_private_only(input, inSz, key);
|
||||
}
|
||||
else {
|
||||
ret = wc_falcon_import_private_key(privKey, privKeyLen,
|
||||
|
@@ -588,10 +588,12 @@ int wc_falcon_export_key(falcon_key* key, byte* priv, word32 *privSz,
|
||||
*/
|
||||
int wc_falcon_check_key(falcon_key* key)
|
||||
{
|
||||
/* Might want to try to sign and verify a random message here. */
|
||||
int ret = 0;
|
||||
(void)key;
|
||||
return ret;
|
||||
if (key == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* Assume everything is fine. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns the size of a falcon private key.
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#define FALCON_LEVEL5_PUB_KEY_SIZE OQS_SIG_falcon_1024_length_public_key
|
||||
#define FALCON_LEVEL5_PRV_KEY_SIZE (FALCON_LEVEL5_PUB_KEY_SIZE+FALCON_LEVEL5_KEY_SIZE)
|
||||
|
||||
#define FALCON_MAX_KEY_SIZE FALCON_LEVEL5_KEY_SIZE
|
||||
#define FALCON_MAX_KEY_SIZE FALCON_LEVEL5_PRV_KEY_SIZE
|
||||
#define FALCON_MAX_SIG_SIZE FALCON_LEVEL5_SIG_SIZE
|
||||
#define FALCON_MAX_PUB_KEY_SIZE FALCON_LEVEL5_PUB_KEY_SIZE
|
||||
#define FALCON_MAX_PRV_KEY_SIZE FALCON_LEVEL5_PRV_KEY_SIZE
|
||||
|
Reference in New Issue
Block a user