Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openssl/openssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-01-07 03:46:33 +0300
committerPauli <ppzgs1@gmail.com>2022-01-19 13:50:22 +0300
commit4e62f1a3af36512a1f5e1273d2dc54e3ce7f5fca (patch)
tree5a490d1c6cfcda784c86704d0026cf1686696ae4 /crypto/evp/evp_enc.c
parent2c9da416a608e2aaf19c16d920baddf2473c8392 (diff)
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.c11
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)) {