mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-06 19:10:53 +02:00
Check wc_InitRsaKey return value in wc_GetKeyOID
F-748
This commit is contained in:
committed by
David Garske
parent
f56356a9b4
commit
265fbdb3dd
+8
-7
@@ -9491,14 +9491,15 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
|
||||
if (rsa == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
wc_InitRsaKey(rsa, heap);
|
||||
if (wc_RsaPrivateKeyDecode(key, &tmpIdx, rsa, keySz) == 0) {
|
||||
*algoID = RSAk;
|
||||
if (wc_InitRsaKey(rsa, heap) == 0) {
|
||||
if (wc_RsaPrivateKeyDecode(key, &tmpIdx, rsa, keySz) == 0) {
|
||||
*algoID = RSAk;
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("Not RSA DER key");
|
||||
}
|
||||
wc_FreeRsaKey(rsa);
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("Not RSA DER key");
|
||||
}
|
||||
wc_FreeRsaKey(rsa);
|
||||
XFREE(rsa, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
}
|
||||
#endif /* !NO_RSA && !NO_ASN_CRYPT */
|
||||
|
||||
Reference in New Issue
Block a user