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)
18 #ifndef TYPEDEF_D2I_OF
19 typedef char *d2i_of_void();
23 * These functions are not included in headers of OPENSSL <= 0.9.6b
26 #if !defined(PEM_read_bio_DSAPublicKey)
27 # define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
28 (d2i_of_void *)d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,(void **)x,cb,u)
31 #if !defined(PEM_write_bio_DSAPublicKey)
32 # define PEM_write_bio_DSAPublicKey(bp,x) \
33 PEM_ASN1_write_bio((int (*)())i2d_DSAPublicKey,\
34 PEM_STRING_DSA_PUBLIC,\
35 bp,(char *)x, NULL, NULL, 0, NULL, NULL)
38 #if !defined(DSAPrivateKey_dup)
39 # define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPrivateKey, \
40 (d2i_of_void *)d2i_DSAPrivateKey,(char *)dsa)
43 #if !defined(DSAPublicKey_dup)
44 # define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPublicKey, \
45 (d2i_of_void *)d2i_DSAPublicKey,(char *)dsa)
48 #if !defined(X509_REVOKED_dup)
49 # define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((int (*)())i2d_X509_REVOKED, \
50 (d2i_of_void *)d2i_X509_REVOKED, (char *)rev)
53 #if !defined(PKCS7_SIGNER_INFO_dup)
54 # define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((int (*)())i2d_PKCS7_SIGNER_INFO, \
55 (d2i_of_void *)d2i_PKCS7_SIGNER_INFO, (char *)si)
58 #if !defined(PKCS7_RECIP_INFO_dup)
59 # define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((int (*)())i2d_PKCS7_RECIP_INFO, \
60 (d2i_of_void *)d2i_PKCS7_RECIP_INFO, (char *)ri)
63 #if !defined(HAVE_EVP_MD_CTX_INIT)
64 void HMAC_CTX_init(HMAC_CTX
*ctx
);
67 #if !defined(HAVE_HMAC_CTX_COPY)
68 void HMAC_CTX_copy(HMAC_CTX
*out
, HMAC_CTX
*in
);
71 #if !defined(HAVE_HMAC_CTX_CLEANUP)
72 void HMAC_CTX_cleanup(HMAC_CTX
*ctx
);
75 #if !defined(HAVE_EVP_MD_CTX_CREATE)
76 EVP_MD_CTX
*EVP_MD_CTX_create(void);
79 #if !defined(HAVE_EVP_MD_CTX_INIT)
80 void EVP_MD_CTX_init(EVP_MD_CTX
*ctx
);
83 #if !defined(HAVE_EVP_MD_CTX_CLEANUP)
84 int EVP_MD_CTX_cleanup(EVP_MD_CTX
*ctx
);
87 #if !defined(HAVE_EVP_MD_CTX_DESTROY)
88 void EVP_MD_CTX_destroy(EVP_MD_CTX
*ctx
);
91 #if !defined(HAVE_EVP_CIPHER_CTX_COPY)
92 int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX
*out
, EVP_CIPHER_CTX
*in
);
95 #if !defined(HAVE_EVP_DIGESTINIT_EX)
96 # define EVP_DigestInit_ex(ctx, md, engine) EVP_DigestInit(ctx, md)
98 #if !defined(HAVE_EVP_DIGESTFINAL_EX)
99 # define EVP_DigestFinal_ex(ctx, buf, len) EVP_DigestFinal(ctx, buf, len)
102 #if !defined(HAVE_EVP_CIPHERINIT_EX)
103 # define EVP_CipherInit_ex(ctx, type, impl, key, iv, enc) EVP_CipherInit(ctx, type, key, iv, enc)
105 #if !defined(HAVE_EVP_CIPHERFINAL_EX)
106 # define EVP_CipherFinal_ex(ctx, outm, outl) EVP_CipherFinal(ctx, outm, outl)
109 #if !defined(EVP_CIPHER_name)
110 # define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
113 #if !defined(EVP_MD_name)
114 # define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e))
117 #if !defined(HAVE_EVP_HMAC_INIT_EX)
118 # define HMAC_Init_ex(ctx, key, len, digest, engine) HMAC_Init(ctx, key, len, digest)
121 #if !defined(PKCS7_is_detached)
122 # define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
125 #if !defined(PKCS7_type_is_encrypted)
126 # define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
129 #if !defined(HAVE_OPENSSL_CLEANSE)
130 #define OPENSSL_cleanse(p, l) memset(p, 0, l)
133 #if !defined(HAVE_X509_STORE_SET_EX_DATA)
134 void *X509_STORE_get_ex_data(X509_STORE
*str
, int idx
);
135 int X509_STORE_set_ex_data(X509_STORE
*str
, int idx
, void *data
);
138 #if !defined(HAVE_X509_CRL_SET_VERSION)
139 int X509_CRL_set_version(X509_CRL
*x
, long version
);
142 #if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
143 int X509_CRL_set_issuer_name(X509_CRL
*x
, X509_NAME
*name
);
146 #if !defined(HAVE_X509_CRL_SORT)
147 int X509_CRL_sort(X509_CRL
*c
);
150 #if !defined(HAVE_X509_CRL_ADD0_REVOKED)
151 int X509_CRL_add0_revoked(X509_CRL
*crl
, X509_REVOKED
*rev
);
154 #if !defined(HAVE_BN_MOD_SQR)
155 int BN_mod_sqr(BIGNUM
*r
, const BIGNUM
*a
, const BIGNUM
*m
, BN_CTX
*ctx
);
158 #if !defined(HAVE_BN_MOD_ADD)
159 int BN_mod_add(BIGNUM
*r
, const BIGNUM
*a
, const BIGNUM
*b
, const BIGNUM
*m
, BN_CTX
*ctx
);
162 #if !defined(HAVE_BN_MOD_SUB)
163 int BN_mod_sub(BIGNUM
*r
, const BIGNUM
*a
, const BIGNUM
*b
, const BIGNUM
*m
, BN_CTX
*ctx
);
166 #if !defined(HAVE_BN_RAND_RANGE)
167 int BN_rand_range(BIGNUM
*r
, BIGNUM
*range
);
170 #if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
171 int BN_pseudo_rand_range(BIGNUM
*r
, BIGNUM
*range
);
174 #if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
175 char *CONF_get1_default_config_file(void);
178 #if !defined(HAVE_PEM_DEF_CALLBACK)
179 int PEM_def_callback(char *buf
, int num
, int w
, void *key
);
182 #if defined(__cplusplus)
187 #endif /* _OSSL_OPENSSL_MISSING_H_ */