@@ -9530,8 +9530,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
95309530 return MEMORY_E;
95319531
95329532 if (wc_falcon_init(falcon) == 0) {
9533- tmpIdx = 0;
9534- if (wc_falcon_set_level(falcon, 1) == 0) {
9533+ if ((*algoID == 0) && (wc_falcon_set_level(falcon, 1) == 0)) {
9534+ tmpIdx = 0;
95359535 if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz)
95369536 == 0) {
95379537 *algoID = FALCON_LEVEL1k;
@@ -9540,7 +9540,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
95409540 WOLFSSL_MSG("Not Falcon Level 1 DER key");
95419541 }
95429542 }
9543- else if (wc_falcon_set_level(falcon, 5) == 0) {
9543+ if ((*algoID == 0) && (wc_falcon_set_level(falcon, 5) == 0)) {
9544+ tmpIdx = 0;
95449545 if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz)
95459546 == 0) {
95469547 *algoID = FALCON_LEVEL5k;
@@ -9549,8 +9550,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
95499550 WOLFSSL_MSG("Not Falcon Level 5 DER key");
95509551 }
95519552 }
9552- else {
9553- WOLFSSL_MSG("GetKeyOID falcon initialization failed ");
9553+ if (*algoID == 0) {
9554+ WOLFSSL_MSG("GetKeyOID could not match Falcon DER key ");
95549555 }
95559556 wc_falcon_free(falcon);
95569557 }
0 commit comments