Some fetch failurs are ok and should be ignored.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11405)
* If there's no engine and there's a name, we try fetching a provider
* implementation.
*/
- if (e == NULL && keytype != NULL)
+ if (e == NULL && keytype != NULL) {
+ /* This could fail so ignore errors */
+ ERR_set_mark();
keymgmt = EVP_KEYMGMT_fetch(libctx, keytype, propquery);
+ ERR_pop_to_mark();
+ }
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
#include <openssl/evp.h>
#include <openssl/core_names.h>
+#include <openssl/err.h>
#include "prov/provider_util.h"
void ossl_prov_cipher_reset(PROV_CIPHER *pc)
return 0;
EVP_CIPHER_free(pc->alloc_cipher);
+ ERR_set_mark();
pc->cipher = pc->alloc_cipher = EVP_CIPHER_fetch(ctx, p->data, propquery);
/* TODO legacy stuff, to be removed */
#ifndef FIPS_MODE /* Inside the FIPS module, we don't support legacy ciphers */
if (pc->cipher == NULL)
pc->cipher = EVP_get_cipherbyname(p->data);
#endif
+ if (pc->cipher != NULL)
+ ERR_pop_to_mark();
+ else
+ ERR_clear_last_mark();
return pc->cipher != NULL;
}
return 0;
EVP_MD_free(pd->alloc_md);
+ ERR_set_mark();
pd->md = pd->alloc_md = EVP_MD_fetch(ctx, p->data, propquery);
/* TODO legacy stuff, to be removed */
#ifndef FIPS_MODE /* Inside the FIPS module, we don't support legacy digests */
if (pd->md == NULL)
pd->md = EVP_get_digestbyname(p->data);
#endif
+ if (pd->md != NULL)
+ ERR_pop_to_mark();
+ else
+ ERR_clear_last_mark();
return pd->md != NULL;
}
int nid,
const char *properties)
{
+ EVP_CIPHER *ciph;
+
#ifndef OPENSSL_NO_ENGINE
ENGINE *eng;
}
#endif
- /* Otherwise we do an explicit fetch */
- return EVP_CIPHER_fetch(libctx, OBJ_nid2sn(nid), properties);
+ /* Otherwise we do an explicit fetch. This may fail and that could be ok */
+ ERR_set_mark();
+ ciph = EVP_CIPHER_fetch(libctx, OBJ_nid2sn(nid), properties);
+ ERR_pop_to_mark();
+ return ciph;
}
int nid,
const char *properties)
{
+ EVP_MD *md;
+
#ifndef OPENSSL_NO_ENGINE
ENGINE *eng;
#endif
/* Otherwise we do an explicit fetch */
- return EVP_MD_fetch(libctx, OBJ_nid2sn(nid), properties);
+ ERR_set_mark();
+ md = EVP_MD_fetch(libctx, OBJ_nid2sn(nid), properties);
+ ERR_pop_to_mark();
+ return md;
}
int ssl_evp_md_up_ref(const EVP_MD *md)