2003-07-23 12:12:24 -04:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
* 'OpenSSL for Ruby' project
|
|
|
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* This program is licenced under the same licence as Ruby.
|
|
|
|
* (See the file 'LICENCE'.)
|
|
|
|
*/
|
|
|
|
#if !defined(_OSSL_OPENSSL_MISSING_H_)
|
|
|
|
#define _OSSL_OPENSSL_MISSING_H_
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-07-23 04:04:25 -04:00
|
|
|
#ifndef TYPEDEF_D2I_OF
|
|
|
|
typedef char *d2i_of_void();
|
|
|
|
#endif
|
2009-03-13 03:45:35 -04:00
|
|
|
#ifndef TYPEDEF_I2D_OF
|
|
|
|
typedef int i2d_of_void();
|
|
|
|
#endif
|
2008-07-23 04:04:25 -04:00
|
|
|
|
2003-07-23 12:12:24 -04:00
|
|
|
/*
|
|
|
|
* These functions are not included in headers of OPENSSL <= 0.9.6b
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(PEM_read_bio_DSAPublicKey)
|
|
|
|
# define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
|
2008-07-22 11:34:23 -04:00
|
|
|
(d2i_of_void *)d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,(void **)x,cb,u)
|
2003-07-23 12:12:24 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(PEM_write_bio_DSAPublicKey)
|
|
|
|
# define PEM_write_bio_DSAPublicKey(bp,x) \
|
2009-03-13 03:45:35 -04:00
|
|
|
PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPublicKey,\
|
2003-07-23 12:12:24 -04:00
|
|
|
PEM_STRING_DSA_PUBLIC,\
|
|
|
|
bp,(char *)x, NULL, NULL, 0, NULL, NULL)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(DSAPrivateKey_dup)
|
2009-03-13 03:45:35 -04:00
|
|
|
# define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPrivateKey, \
|
2008-07-22 11:34:23 -04:00
|
|
|
(d2i_of_void *)d2i_DSAPrivateKey,(char *)dsa)
|
2003-07-23 12:12:24 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(DSAPublicKey_dup)
|
2009-03-13 03:45:35 -04:00
|
|
|
# define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPublicKey, \
|
2008-07-22 11:34:23 -04:00
|
|
|
(d2i_of_void *)d2i_DSAPublicKey,(char *)dsa)
|
2003-07-23 12:12:24 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(X509_REVOKED_dup)
|
2009-03-13 03:45:35 -04:00
|
|
|
# define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((i2d_of_void *)i2d_X509_REVOKED, \
|
2008-07-22 11:34:23 -04:00
|
|
|
(d2i_of_void *)d2i_X509_REVOKED, (char *)rev)
|
2003-07-23 12:12:24 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(PKCS7_SIGNER_INFO_dup)
|
2009-03-13 03:45:35 -04:00
|
|
|
# define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_SIGNER_INFO, \
|
2008-07-22 11:34:23 -04:00
|
|
|
(d2i_of_void *)d2i_PKCS7_SIGNER_INFO, (char *)si)
|
2003-07-23 12:12:24 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(PKCS7_RECIP_INFO_dup)
|
2009-03-13 03:45:35 -04:00
|
|
|
# define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_RECIP_INFO, \
|
2008-07-22 11:34:23 -04:00
|
|
|
(d2i_of_void *)d2i_PKCS7_RECIP_INFO, (char *)ri)
|
2003-07-23 12:12:24 -04:00
|
|
|
#endif
|
|
|
|
|
2010-09-05 22:08:30 -04:00
|
|
|
#if !defined(HAVE_HMAC_CTX_INIT)
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
void HMAC_CTX_init(HMAC_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_HMAC_CTX_COPY)
|
|
|
|
void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_HMAC_CTX_CLEANUP)
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
|
2008-05-15 05:44:38 -04:00
|
|
|
#if !defined(HAVE_EVP_MD_CTX_CREATE)
|
2003-07-23 12:12:24 -04:00
|
|
|
EVP_MD_CTX *EVP_MD_CTX_create(void);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_EVP_MD_CTX_INIT)
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_EVP_MD_CTX_CLEANUP)
|
2003-07-23 12:12:24 -04:00
|
|
|
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_EVP_MD_CTX_DESTROY)
|
2003-07-23 12:12:24 -04:00
|
|
|
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
2003-07-23 12:12:24 -04:00
|
|
|
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
#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
|
|
|
|
|
2003-07-23 12:12:24 -04:00
|
|
|
#if !defined(EVP_CIPHER_name)
|
|
|
|
# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(EVP_MD_name)
|
|
|
|
# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e))
|
|
|
|
#endif
|
|
|
|
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
#if !defined(HAVE_EVP_HMAC_INIT_EX)
|
|
|
|
# define HMAC_Init_ex(ctx, key, len, digest, engine) HMAC_Init(ctx, key, len, digest)
|
|
|
|
#endif
|
2003-07-23 12:12:24 -04:00
|
|
|
|
|
|
|
#if !defined(PKCS7_is_detached)
|
|
|
|
# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(PKCS7_type_is_encrypted)
|
|
|
|
# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
|
|
|
|
#endif
|
|
|
|
|
2005-04-15 15:16:18 -04:00
|
|
|
#if !defined(HAVE_OPENSSL_CLEANSE)
|
|
|
|
#define OPENSSL_cleanse(p, l) memset(p, 0, l)
|
|
|
|
#endif
|
|
|
|
|
2010-09-05 22:08:30 -04:00
|
|
|
#if !defined(HAVE_X509_STORE_GET_EX_DATA)
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
|
2010-09-05 22:08:30 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
|
* 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_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, 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_padding): check for
EVP_CIPHER_CTX_set_padding.
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-30 06:48:43 -04:00
|
|
|
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_X509_CRL_SET_VERSION)
|
2003-07-23 12:12:24 -04:00
|
|
|
int X509_CRL_set_version(X509_CRL *x, long version);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
|
2003-07-23 12:12:24 -04:00
|
|
|
int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_X509_CRL_SORT)
|
2003-07-23 12:12:24 -04:00
|
|
|
int X509_CRL_sort(X509_CRL *c);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_X509_CRL_ADD0_REVOKED)
|
2003-07-23 12:12:24 -04:00
|
|
|
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_BN_MOD_SQR)
|
2003-07-23 12:12:24 -04:00
|
|
|
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_BN_MOD_ADD)
|
2003-07-23 12:12:24 -04:00
|
|
|
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_BN_MOD_SUB)
|
2003-07-23 12:12:24 -04:00
|
|
|
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_BN_RAND_RANGE)
|
2003-09-12 09:46:48 -04:00
|
|
|
int BN_rand_range(BIGNUM *r, BIGNUM *range);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
|
2003-09-12 09:46:48 -04:00
|
|
|
int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
|
2003-07-23 12:12:24 -04:00
|
|
|
char *CONF_get1_default_config_file(void);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_PEM_DEF_CALLBACK)
|
2003-07-23 12:12:24 -04:00
|
|
|
int PEM_def_callback(char *buf, int num, int w, void *key);
|
2008-05-15 05:44:38 -04:00
|
|
|
#endif
|
2003-07-23 12:12:24 -04:00
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _OSSL_OPENSSL_MISSING_H_ */
|
|
|
|
|