diff options
author | Technorama team <oss-ruby@technorama.net> | 2004-06-26 21:10:30 +0000 |
---|---|---|
committer | Technorama team <oss-ruby@technorama.net> | 2004-06-26 21:10:30 +0000 |
commit | 5515d199143f6a0ba5995232265e046e4ebe7981 (patch) | |
tree | 93496b70843f110c8f4eda10aa55890bf32f8557 | |
parent | c89a87a2b43fcee7c4682cc4f1bbff7498690c7c (diff) | |
download | ruby-openssl-history-5515d199143f6a0ba5995232265e046e4ebe7981.tar.gz |
add mythical EVP_CIPHER_CTX_copy
-rw-r--r-- | openssl_missing.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/openssl_missing.c b/openssl_missing.c index 760dff2..c4265e1 100644 --- a/openssl_missing.c +++ b/openssl_missing.c @@ -112,6 +112,28 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx) } #endif +#if !defined(HAVE_EVP_CIPHER_CTX_COPY) +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) + ENGINE_add(out->engine); + + if (out->cipher->ctx_size) { + out->cipher_data = OPENSSL_malloc(out->cipher->ctx_size); + memcpy(out->cipher_data, in->cipher_data, out->cipher->ctx_size); + } +/* +*/ + + return 1; +} +#endif + #if !defined(HAVE_X509_CRL_SET_VERSION) int X509_CRL_set_version(X509_CRL *x, long version) |