Add static buffer to wolfSSL_ERR_error_string

Add ED448 and ED25519 to wolfssl_object_info
Add more error messages
This commit is contained in:
Juliusz Sosinowicz
2020-11-06 19:11:39 +01:00
parent 6ed45a23d9
commit fdde2337a4
2 changed files with 34 additions and 3 deletions

View File

@ -3163,15 +3163,17 @@ int wolfSSL_want_write(WOLFSSL* ssl)
char* wolfSSL_ERR_error_string(unsigned long errNumber, char* data)
{
static wcchar msg = "Please supply a buffer for error string";
static char tmp[WOLFSSL_MAX_ERROR_SZ] = {0};
WOLFSSL_ENTER("ERR_error_string");
if (data) {
SetErrorString((int)errNumber, data);
return data;
}
return (char*)msg;
else {
SetErrorString((int)errNumber, tmp);
return tmp;
}
}
@ -7667,6 +7669,9 @@ WOLFSSL_EVP_PKEY* wolfSSL_d2i_PUBKEY(WOLFSSL_EVP_PKEY** out,
return pkey;
}
else {
WOLFSSL_MSG("RSA wolfSSL_EVP_PKEY_new error");
}
}
wc_FreeRsaKey(&rsa);
}
@ -7711,6 +7716,9 @@ WOLFSSL_EVP_PKEY* wolfSSL_d2i_PUBKEY(WOLFSSL_EVP_PKEY** out,
return pkey;
}
else {
WOLFSSL_MSG("ECC wolfSSL_EVP_PKEY_new error");
}
}
wc_ecc_free(&ecc);
}
@ -7758,6 +7766,9 @@ WOLFSSL_EVP_PKEY* wolfSSL_d2i_PUBKEY(WOLFSSL_EVP_PKEY** out,
return pkey;
}
else {
WOLFSSL_MSG("DSA wolfSSL_EVP_PKEY_new error");
}
}
wc_FreeDsaKey(&dsa);
}
@ -7806,12 +7817,18 @@ WOLFSSL_EVP_PKEY* wolfSSL_d2i_PUBKEY(WOLFSSL_EVP_PKEY** out,
return pkey;
}
else {
WOLFSSL_MSG("DH wolfSSL_EVP_PKEY_new error");
}
}
wc_FreeDhKey(&dh);
}
#endif /* !HAVE_FIPS || HAVE_FIPS_VERSION > 2 */
#endif /* !NO_DH && (WOLFSSL_QT || OPENSSL_ALL) */
if (pkey == NULL)
WOLFSSL_MSG("wolfSSL_d2i_PUBKEY couldn't determine key type");
return pkey;
}
@ -30434,6 +30451,12 @@ const WOLFSSL_ObjectInfo wolfssl_object_info[] = {
#ifndef NO_DH
{ NID_dhKeyAgreement, DHk, oidKeyType, "dhKeyAgreement", "dhKeyAgreement"},
#endif
#ifdef HAVE_ED448
{ NID_ED448, ED448k, oidKeyType, "ED448", "ED448"},
#endif
#ifdef HAVE_ED25519
{ NID_ED25519, ED25519k, oidKeyType, "ED25519", "ED25519"},
#endif
/* oidCurveType */
#ifdef HAVE_ECC

View File

@ -25,6 +25,7 @@
#define WOLFSSL_EC_H_
#include <wolfssl/openssl/bn.h>
#include <wolfssl/wolfcrypt/asn.h>
#include <wolfssl/wolfcrypt/ecc.h>
#ifdef __cplusplus
@ -68,6 +69,13 @@ enum {
NID_brainpoolP512r1 = 933,
#endif
#ifdef HAVE_ED448
NID_ED448 = ED448k,
#endif
#ifdef HAVE_ED25519
NID_ED25519 = ED25519k,
#endif
OPENSSL_EC_NAMED_CURVE = 0x001
};