@@ -9815,8 +9815,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
98159815 return MEMORY_E;
98169816
98179817 if (wc_falcon_init(falcon) == 0) {
9818- tmpIdx = 0;
9819- if (wc_falcon_set_level(falcon, 1) == 0) {
9818+ if ((*algoID == 0) && (wc_falcon_set_level(falcon, 1) == 0)) {
9819+ tmpIdx = 0;
98209820 if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz)
98219821 == 0) {
98229822 *algoID = FALCON_LEVEL1k;
@@ -9825,7 +9825,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
98259825 WOLFSSL_MSG("Not Falcon Level 1 DER key");
98269826 }
98279827 }
9828- else if (wc_falcon_set_level(falcon, 5) == 0) {
9828+ if ((*algoID == 0) && (wc_falcon_set_level(falcon, 5) == 0)) {
9829+ tmpIdx = 0;
98299830 if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz)
98309831 == 0) {
98319832 *algoID = FALCON_LEVEL5k;
@@ -9834,8 +9835,8 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
98349835 WOLFSSL_MSG("Not Falcon Level 5 DER key");
98359836 }
98369837 }
9837- else {
9838- WOLFSSL_MSG("GetKeyOID falcon initialization failed ");
9838+ if (*algoID == 0) {
9839+ WOLFSSL_MSG("GetKeyOID could not match Falcon DER key ");
98399840 }
98409841 wc_falcon_free(falcon);
98419842 }
0 commit comments