aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTechnorama team <oss-ruby@technorama.net>2004-06-26 21:10:30 +0000
committerTechnorama team <oss-ruby@technorama.net>2004-06-26 21:10:30 +0000
commit5e3e514b41ac13164731775904395ac3ccd80a5d (patch)
tree5deb60a0b778350ce3059c11a4c631fd0b758c45
parent5515d199143f6a0ba5995232265e046e4ebe7981 (diff)
downloadruby-openssl-history-5e3e514b41ac13164731775904395ac3ccd80a5d.tar.gz
add mythical EVP_CIPHER_CTX_copy
-rw-r--r--extconf.rb1
-rw-r--r--openssl_missing.c9
-rw-r--r--openssl_missing.h4
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