diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-01 03:01:07 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-01 03:01:07 +0000 |
commit | b277404598be5e6308cd86f2303b4d9fd2df94c7 (patch) | |
tree | 9921142c623e5ea54e62f2ec1345eaa982d978fd /ext/openssl/openssl_missing.h | |
parent | f3a97d4cbb5af3d4daaeb9de95ee6b69a5869bf6 (diff) | |
download | ruby-b277404598be5e6308cd86f2303b4d9fd2df94c7.tar.gz ruby-b277404598be5e6308cd86f2303b4d9fd2df94c7.tar.xz ruby-b277404598be5e6308cd86f2303b4d9fd2df94c7.zip |
* ext/openssl/extconf.rb: check for EVP_CIPHER_CTX_copy, ENGINE_add,
EVP_CIPHER_CTX_set_padding, EVP_CipherFinal_ex, EVP_CipherInit_ex,
EVP_DigestFinal_ex and EVP_DigestInit_ex.
* ext/openssl/openssl_missing.c (EVP_CIPHER_CTX_copy): new function.
* ext/openssl/openssl_missing.h (EVP_DigestInit_ex, EVP_DigestFinal_ex,
EVP_CipherInit_ex, EVP_CipherFinal_ex, HMAC_Init_ex): new macro for
OpenSSL 0.9.6.
* ext/openssl/ossl_cipher.c (ossl_cipher_encrypt, ossl_cipher_decrypt):
re-implemnt (the arguments for this method is ).
* ext/openssl/ossl_cipher.c (ossl_cipher_pkcs5_keyivgen): new method
OpenSSL::Cipher::Cipher#pkcs5_keyivgen. it calls EVP_BytesToKey().
* ext/openssl/ossl_cipher.c (ossl_cipher_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset ossl_cipher_final,
ossl_cipher_set_key, ossl_cipher_set_iv): replace all EVP_CipherInit
and EVP_CipherFinal into EVP_CipherInit_ex and EVP_CipherFinal_ex.
and EVP_CIPHER_CTX_init should only be called once.
* ext/openssl/ossl_cipher.c (ossl_cipher_set_key_length): new method
OpenSSL::Cipher::Cipher#key_len=.
* ext/openssl/ossl_cipher.c (ossl_cipher_set_padding): the type of
argument is changed from integer to boolean.
* ext/openssl/ossl_cipher.c (ossl_cipher_init_deprecated): new
finction; print warning for Cipher#<<.
* ext/openssl/ossl_digest.c: replace all EVP_DigestInit and
EVP_DigestFinal into EVP_DigestInit_ex and EVP_DigestFinal_ex.
and EVP_MD_CTX_init should only be called once.
* ext/openssl/ossl_digest.c (digest_final): should call
EVP_MD_CTX_cleanup to avoid memory leak.
* ext/openssl/ossl_hmac.c (ossl_hmac_initialize): repalce HMAC_init
into HMAC_init_ex. and HMAC_CTX_init is moved to ossl_hmac_alloc.
* ext/openssl/ossl_hmac.c (hmac_final): should call
HMAC_CTX_cleanup to avoid memory leak.
* test/openssl/test_cipher.rb, test/openssl/test_digest.rb,
test/openssl/test_hmac.rb: new file.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/openssl_missing.h')
-rw-r--r-- | ext/openssl/openssl_missing.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h index 7a755f79b..2a082f3fe 100644 --- a/ext/openssl/openssl_missing.h +++ b/ext/openssl/openssl_missing.h @@ -56,13 +56,33 @@ extern "C" { (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri) #endif +void HMAC_CTX_init(HMAC_CTX *ctx); int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in); -void *X509_STORE_get_ex_data(X509_STORE *str, int idx); -int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data); +void HMAC_CTX_cleanup(HMAC_CTX *ctx); + EVP_MD_CTX *EVP_MD_CTX_create(void); +void EVP_MD_CTX_init(EVP_MD_CTX *ctx); int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); +#if !defined(HAVE_EVP_CIPHER_CTX_COPY) +int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in); +#endif + +#if !defined(HAVE_EVP_DIGESTINIT_EX) +# define EVP_DigestInit_ex(ctx, md, engine) EVP_DigestInit(ctx, md) +#endif +#if !defined(HAVE_EVP_DIGESTFINAL_EX) +# define EVP_DigestFinal_ex(ctx, buf, len) EVP_DigestFinal(ctx, buf, len) +#endif + +#if !defined(HAVE_EVP_CIPHERINIT_EX) +# define EVP_CipherInit_ex(ctx, type, impl, key, iv, enc) EVP_CipherInit(ctx, type, key, iv, enc) +#endif +#if !defined(HAVE_EVP_CIPHERFINAL_EX) +# define EVP_CipherFinal_ex(ctx, outm, outl) EVP_CipherFinal(ctx, outm, outl) +#endif + #if !defined(EVP_CIPHER_name) # define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) #endif @@ -71,9 +91,9 @@ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); # define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e)) #endif -void EVP_MD_CTX_init(EVP_MD_CTX *ctx); -void HMAC_CTX_init(HMAC_CTX *ctx); -void HMAC_CTX_cleanup(HMAC_CTX *ctx); +#if !defined(HAVE_EVP_HMAC_INIT_EX) +# define HMAC_Init_ex(ctx, key, len, digest, engine) HMAC_Init(ctx, key, len, digest) +#endif #if !defined(PKCS7_is_detached) # define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) @@ -83,6 +103,8 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx); # define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) #endif +void *X509_STORE_get_ex_data(X509_STORE *str, int idx); +int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data); int X509_CRL_set_version(X509_CRL *x, long version); int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); int X509_CRL_sort(X509_CRL *c); |