Merge pull request #9979 from anhu/falcon_no_elseif

Fixes Falcon else-if chain key detection
This commit is contained in:
David Garske
2026-03-16 15:03:43 -07:00
committed by GitHub
+5 -4
View File
@@ -9582,8 +9582,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
return MEMORY_E;
if (wc_falcon_init(falcon) == 0) {
tmpIdx = 0;
if (wc_falcon_set_level(falcon, 1) == 0) {
if ((*algoID == 0) && (wc_falcon_set_level(falcon, 1) == 0)) {
tmpIdx = 0;
if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz)
== 0) {
*algoID = FALCON_LEVEL1k;
@@ -9592,7 +9592,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
WOLFSSL_MSG("Not Falcon Level 1 DER key");
}
}
else if (wc_falcon_set_level(falcon, 5) == 0) {
if ((*algoID == 0) && (wc_falcon_set_level(falcon, 5) == 0)) {
tmpIdx = 0;
if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz)
== 0) {
*algoID = FALCON_LEVEL5k;
@@ -9601,7 +9602,7 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
WOLFSSL_MSG("Not Falcon Level 5 DER key");
}
}
else {
if (*algoID == 0) {
WOLFSSL_MSG("GetKeyOID falcon initialization failed");
}
wc_falcon_free(falcon);