mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
@@ -2270,15 +2270,13 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
|
|||||||
{
|
{
|
||||||
word32 tmpIdx = 0;
|
word32 tmpIdx = 0;
|
||||||
|
|
||||||
#ifdef HAVE_ECC
|
if (key == NULL || algoID == NULL)
|
||||||
ecc_key ecc;
|
return BAD_FUNC_ARG;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ED25519
|
*algoID = 0;
|
||||||
ed25519_key ed25519;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_RSA
|
#ifndef NO_RSA
|
||||||
|
{
|
||||||
RsaKey rsa;
|
RsaKey rsa;
|
||||||
|
|
||||||
wc_InitRsaKey(&rsa, heap);
|
wc_InitRsaKey(&rsa, heap);
|
||||||
@@ -2289,9 +2287,12 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
|
|||||||
WOLFSSL_MSG("Not RSA DER key");
|
WOLFSSL_MSG("Not RSA DER key");
|
||||||
}
|
}
|
||||||
wc_FreeRsaKey(&rsa);
|
wc_FreeRsaKey(&rsa);
|
||||||
|
}
|
||||||
#endif /* NO_RSA */
|
#endif /* NO_RSA */
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
if (algoID == 0) {
|
if (*algoID == 0) {
|
||||||
|
ecc_key ecc;
|
||||||
|
|
||||||
tmpIdx = 0;
|
tmpIdx = 0;
|
||||||
wc_ecc_init_ex(&ecc, heap, INVALID_DEVID);
|
wc_ecc_init_ex(&ecc, heap, INVALID_DEVID);
|
||||||
if (wc_EccPrivateKeyDecode(key, &tmpIdx, &ecc, keySz) == 0) {
|
if (wc_EccPrivateKeyDecode(key, &tmpIdx, &ecc, keySz) == 0) {
|
||||||
@@ -2312,6 +2313,9 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
|
|||||||
#endif /* HAVE_ECC */
|
#endif /* HAVE_ECC */
|
||||||
#ifdef HAVE_ED25519
|
#ifdef HAVE_ED25519
|
||||||
if (*algoID != RSAk && *algoID != ECDSAk) {
|
if (*algoID != RSAk && *algoID != ECDSAk) {
|
||||||
|
ed25519_key ed25519;
|
||||||
|
|
||||||
|
tmpIdx = 0;
|
||||||
if (wc_ed25519_init(&ed25519) == 0) {
|
if (wc_ed25519_init(&ed25519) == 0) {
|
||||||
if (wc_Ed25519PrivateKeyDecode(key, &tmpIdx, &ed25519, keySz)
|
if (wc_Ed25519PrivateKeyDecode(key, &tmpIdx, &ed25519, keySz)
|
||||||
== 0) {
|
== 0) {
|
||||||
|
Reference in New Issue
Block a user