#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;
}
*mp++ = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
(char *)mdname, 0);
if (ciphername != NULL)
- *mp++ = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
+ *mp++ = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,
(char *)ciphername, 0);
if (properties != NULL)
*mp++ = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_PROPERTIES,
*macctx = NULL;
return 0;
}
+
+void ossl_prov_cache_exported_algorithms(const OSSL_ALGORITHM_CAPABLE *in,
+ OSSL_ALGORITHM *out)
+{
+ int i, j;
+
+ if (out[0].algorithm_names == NULL) {
+ for (i = j = 0; in[i].alg.algorithm_names != NULL; ++i) {
+ if (in[i].capable == NULL || in[i].capable())
+ out[j++] = in[i].alg;
+ }
+ out[j++] = in[i].alg;
+ }
+}