2 * $Id: openssl_missing.h 11708 2007-02-12 23:01:19Z shyouhei $
3 * 'OpenSSL for Ruby' project
4 * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
8 * This program is licenced under the same licence as Ruby.
9 * (See the file 'LICENCE'.)
11 #if !defined(_OSSL_OPENSSL_MISSING_H_)
12 #define _OSSL_OPENSSL_MISSING_H_
14 #if defined(__cplusplus)
19 * These functions are not included in headers of OPENSSL <= 0.9.6b
22 #if !defined(PEM_read_bio_DSAPublicKey)
23 # define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
24 (char *(*)())d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,(char **)x,cb,u)
27 #if !defined(PEM_write_bio_DSAPublicKey)
28 # define PEM_write_bio_DSAPublicKey(bp,x) \
29 PEM_ASN1_write_bio((int (*)())i2d_DSAPublicKey,\
30 PEM_STRING_DSA_PUBLIC,\
31 bp,(char *)x, NULL, NULL, 0, NULL, NULL)
34 #if !defined(DSAPrivateKey_dup)
35 # define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPrivateKey, \
36 (char *(*)())d2i_DSAPrivateKey,(char *)dsa)
39 #if !defined(DSAPublicKey_dup)
40 # define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPublicKey, \
41 (char *(*)())d2i_DSAPublicKey,(char *)dsa)
44 #if !defined(X509_REVOKED_dup)
45 # define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((int (*)())i2d_X509_REVOKED, \
46 (char *(*)())d2i_X509_REVOKED, (char *)rev)
49 #if !defined(PKCS7_SIGNER_INFO_dup)
50 # define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((int (*)())i2d_PKCS7_SIGNER_INFO, \
51 (char *(*)())d2i_PKCS7_SIGNER_INFO, (char *)si)
54 #if !defined(PKCS7_RECIP_INFO_dup)
55 # define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((int (*)())i2d_PKCS7_RECIP_INFO, \
56 (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri)
59 void HMAC_CTX_init(HMAC_CTX
*ctx
);
60 int HMAC_CTX_copy(HMAC_CTX
*out
, HMAC_CTX
*in
);
61 void HMAC_CTX_cleanup(HMAC_CTX
*ctx
);
63 EVP_MD_CTX
*EVP_MD_CTX_create(void);
64 void EVP_MD_CTX_init(EVP_MD_CTX
*ctx
);
65 int EVP_MD_CTX_cleanup(EVP_MD_CTX
*ctx
);
66 void EVP_MD_CTX_destroy(EVP_MD_CTX
*ctx
);
68 #if !defined(HAVE_EVP_CIPHER_CTX_COPY)
69 int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX
*out
, EVP_CIPHER_CTX
*in
);
72 #if !defined(HAVE_EVP_DIGESTINIT_EX)
73 # define EVP_DigestInit_ex(ctx, md, engine) EVP_DigestInit(ctx, md)
75 #if !defined(HAVE_EVP_DIGESTFINAL_EX)
76 # define EVP_DigestFinal_ex(ctx, buf, len) EVP_DigestFinal(ctx, buf, len)
79 #if !defined(HAVE_EVP_CIPHERINIT_EX)
80 # define EVP_CipherInit_ex(ctx, type, impl, key, iv, enc) EVP_CipherInit(ctx, type, key, iv, enc)
82 #if !defined(HAVE_EVP_CIPHERFINAL_EX)
83 # define EVP_CipherFinal_ex(ctx, outm, outl) EVP_CipherFinal(ctx, outm, outl)
86 #if !defined(EVP_CIPHER_name)
87 # define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
90 #if !defined(EVP_MD_name)
91 # define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e))
94 #if !defined(HAVE_EVP_HMAC_INIT_EX)
95 # define HMAC_Init_ex(ctx, key, len, digest, engine) HMAC_Init(ctx, key, len, digest)
98 #if !defined(PKCS7_is_detached)
99 # define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
102 #if !defined(PKCS7_type_is_encrypted)
103 # define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
106 #if !defined(HAVE_OPENSSL_CLEANSE)
107 #define OPENSSL_cleanse(p, l) memset(p, 0, l)
110 void *X509_STORE_get_ex_data(X509_STORE
*str
, int idx
);
111 int X509_STORE_set_ex_data(X509_STORE
*str
, int idx
, void *data
);
112 int X509_CRL_set_version(X509_CRL
*x
, long version
);
113 int X509_CRL_set_issuer_name(X509_CRL
*x
, X509_NAME
*name
);
114 int X509_CRL_sort(X509_CRL
*c
);
115 int X509_CRL_add0_revoked(X509_CRL
*crl
, X509_REVOKED
*rev
);
116 int BN_mod_sqr(BIGNUM
*r
, const BIGNUM
*a
, const BIGNUM
*m
, BN_CTX
*ctx
);
117 int BN_mod_add(BIGNUM
*r
, const BIGNUM
*a
, const BIGNUM
*b
, const BIGNUM
*m
, BN_CTX
*ctx
);
118 int BN_mod_sub(BIGNUM
*r
, const BIGNUM
*a
, const BIGNUM
*b
, const BIGNUM
*m
, BN_CTX
*ctx
);
119 int BN_rand_range(BIGNUM
*r
, BIGNUM
*range
);
120 int BN_pseudo_rand_range(BIGNUM
*r
, BIGNUM
*range
);
121 char *CONF_get1_default_config_file(void);
122 int PEM_def_callback(char *buf
, int num
, int w
, void *key
);
124 #if defined(__cplusplus)
129 #endif /* _OSSL_OPENSSL_MISSING_H_ */