From 5e3e514b41ac13164731775904395ac3ccd80a5d Mon Sep 17 00:00:00 2001 From: Technorama team Date: Sat, 26 Jun 2004 21:10:30 +0000 Subject: add mythical EVP_CIPHER_CTX_copy --- extconf.rb | 1 + openssl_missing.c | 9 +++++---- openssl_missing.h | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/extconf.rb b/extconf.rb index 0e9f78b..8a15c53 100644 --- a/extconf.rb +++ b/extconf.rb @@ -73,6 +73,7 @@ have_func("X509_STORE_set_ex_data") have_func("EVP_MD_CTX_create") have_func("EVP_MD_CTX_cleanup") have_func("EVP_MD_CTX_destroy") +have_func("EVP_CIPHER_CTX_copy") have_func("PEM_def_callback") have_func("EVP_MD_CTX_init") have_func("HMAC_CTX_init") diff --git a/openssl_missing.c b/openssl_missing.c index c4265e1..0896437 100644 --- a/openssl_missing.c +++ b/openssl_missing.c @@ -113,11 +113,14 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx) #endif #if !defined(HAVE_EVP_CIPHER_CTX_COPY) +/* + this function does not exist in OpenSSL yet... or ever?. + a future version may break this function. + tested on 0.9.7c. +*/ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in) { -// if (EVP_CipherInit_ex(out, in->cipher, NULL, NULL, NULL, -1) != 1) -// return 0; memcpy(out, in, sizeof(EVP_CIPHER_CTX)); if (out->engine) @@ -127,8 +130,6 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in) out->cipher_data = OPENSSL_malloc(out->cipher->ctx_size); memcpy(out->cipher_data, in->cipher_data, out->cipher->ctx_size); } -/* -*/ return 1; } diff --git a/openssl_missing.h b/openssl_missing.h index 7a755f7..b77c02d 100644 --- a/openssl_missing.h +++ b/openssl_missing.h @@ -67,6 +67,10 @@ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); # define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) #endif +#if !defined(HAVE_EVP_CIPHER_CTX_COPY) + int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in); +#endif + #if !defined(EVP_MD_name) # define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e)) #endif -- cgit v1.2.3