diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-05-14 21:09:49 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-08-21 09:04:10 +0200 |
commit | ded346fad2f2c86bc13ac3beaf5e00e969f04442 (patch) | |
tree | 6422944936a63fef97081630a5f5ef6ff7017a3c /crypto/evp | |
parent | 4cdf44c46b699934b86b9d842cfd4448b7dbe58e (diff) |
Add libctx and propq param to ASN.1 sign/verify/HMAC/decrypt
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11808)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/digest.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 7476efd9bc..7caab8a5f7 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -13,6 +13,7 @@ #include <stdio.h> #include <openssl/objects.h> #include <openssl/evp.h> +#include <openssl/ec.h> #include <openssl/engine.h> #include <openssl/params.h> #include <openssl/core_names.h> @@ -73,6 +74,37 @@ int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) return 1; } +#ifndef FIPS_MODULE +EVP_MD_CTX *evp_md_ctx_new_with_libctx(EVP_PKEY *pkey, + const ASN1_OCTET_STRING *id, + OPENSSL_CTX *libctx, const char *propq) +{ + EVP_MD_CTX *ctx; + EVP_PKEY_CTX *pctx = NULL; + + if ((ctx = EVP_MD_CTX_new()) == NULL + || (pctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, propq)) == NULL) { + ASN1err(0, ERR_R_MALLOC_FAILURE); + goto err; + } + +# ifndef OPENSSL_NO_EC + if (id != NULL && EVP_PKEY_CTX_set1_id(pctx, id->data, id->length) <= 0) { + ASN1err(0, ERR_R_MALLOC_FAILURE); + goto err; + } +# endif + + EVP_MD_CTX_set_pkey_ctx(ctx, pctx); + return ctx; + + err: + EVP_PKEY_CTX_free(pctx); + EVP_MD_CTX_free(ctx); + return NULL; +} +#endif + EVP_MD_CTX *EVP_MD_CTX_new(void) { return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); |