mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Clear OpenSSL errors on EVP_PKEY_new failures
This commit is contained in:
@@ -83,6 +83,7 @@ main(int argc, char **argv) {
|
||||
!EVP_PKEY_set1_RSA(pkey, rsa))
|
||||
{
|
||||
fprintf(stderr, "fatal error: basic OpenSSL failure\n");
|
||||
ERR_clear_error();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -98,6 +99,7 @@ main(int argc, char **argv) {
|
||||
"fatal error: RSA_generate_key_ex() fails "
|
||||
"at file %s line %d\n",
|
||||
__FILE__, __LINE__);
|
||||
ERR_clear_error();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@@ -323,7 +323,7 @@ opensslecdsa_create_pkey_legacy(unsigned int key_alg, bool private,
|
||||
|
||||
pkey = EVP_PKEY_new();
|
||||
if (pkey == NULL) {
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
DST_RET(dst__openssl_toresult(ISC_R_NOMEMORY));
|
||||
}
|
||||
if (!EVP_PKEY_set1_EC_KEY(pkey, eckey)) {
|
||||
DST_RET(dst__openssl_toresult(ISC_R_FAILURE));
|
||||
@@ -515,7 +515,7 @@ opensslecdsa_generate_pkey(unsigned int key_alg, EVP_PKEY **retkey) {
|
||||
|
||||
pkey = EVP_PKEY_new();
|
||||
if (pkey == NULL) {
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
DST_RET(dst__openssl_toresult(ISC_R_NOMEMORY));
|
||||
}
|
||||
if (EVP_PKEY_set1_EC_KEY(pkey, eckey) != 1) {
|
||||
DST_RET(dst__openssl_toresult2("EVP_PKEY_set1_EC_KEY",
|
||||
|
@@ -55,6 +55,7 @@ isc_hmac_init(isc_hmac_t *hmac, const void *key, const size_t keylen,
|
||||
|
||||
pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_HMAC, NULL, key, keylen);
|
||||
if (pkey == NULL) {
|
||||
ERR_clear_error();
|
||||
return (ISC_R_CRYPTOFAILURE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user