diff options
author | Pauli <pauli@openssl.org> | 2022-01-07 01:46:33 +0100 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2022-01-19 11:50:22 +0100 |
commit | 4e62f1a3af36512a1f5e1273d2dc54e3ce7f5fca (patch) | |
tree | 5a490d1c6cfcda784c86704d0026cf1686696ae4 /crypto/evp/evp_enc.c | |
parent | fix indentation (diff) | |
download | openssl-4e62f1a3af36512a1f5e1273d2dc54e3ce7f5fca.tar.xz openssl-4e62f1a3af36512a1f5e1273d2dc54e3ce7f5fca.zip |
Add context dup functions for digests and ciphers
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17529)
Diffstat (limited to 'crypto/evp/evp_enc.c')
-rw-r--r-- | crypto/evp/evp_enc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 519cab3f2b..1c02cafa16 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1346,6 +1346,17 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) #endif /* FIPS_MODULE */ } +EVP_CIPHER_CTX *EVP_CIPHER_CTX_dup(const EVP_CIPHER_CTX *in) +{ + EVP_CIPHER_CTX *out = EVP_CIPHER_CTX_new(); + + if (out != NULL && !EVP_CIPHER_CTX_copy(out, in)) { + EVP_CIPHER_CTX_free(out); + out = NULL; + } + return out; +} + int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) { if ((in == NULL) || (in->cipher == NULL)) { |