1/* 2 * $Id: openssl_missing.h 32230 2011-06-26 01:32:03Z emboss $ 3 * 'OpenSSL for Ruby' project 4 * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz> 5 * All rights reserved. 6 */ 7/* 8 * This program is licenced under the same licence as Ruby. 9 * (See the file 'LICENCE'.) 10 */ 11#if !defined(_OSSL_OPENSSL_MISSING_H_) 12#define _OSSL_OPENSSL_MISSING_H_ 13 14#if defined(__cplusplus) 15extern "C" { 16#endif 17 18#ifndef TYPEDEF_D2I_OF 19typedef char *d2i_of_void(); 20#endif 21#ifndef TYPEDEF_I2D_OF 22typedef int i2d_of_void(); 23#endif 24 25/* 26 * These functions are not included in headers of OPENSSL <= 0.9.6b 27 */ 28 29#if !defined(PEM_read_bio_DSAPublicKey) 30# define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ 31 (d2i_of_void *)d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,(bp),(void **)(x),(cb),(u)) 32#endif 33 34#if !defined(PEM_write_bio_DSAPublicKey) 35# define PEM_write_bio_DSAPublicKey(bp,x) \ 36 PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPublicKey,\ 37 PEM_STRING_DSA_PUBLIC,\ 38 (bp),(char *)(x), NULL, NULL, 0, NULL, NULL) 39#endif 40 41#if !defined(DSAPrivateKey_dup) 42# define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPrivateKey, \ 43 (d2i_of_void *)d2i_DSAPrivateKey,(char *)(dsa)) 44#endif 45 46#if !defined(DSAPublicKey_dup) 47# define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPublicKey, \ 48 (d2i_of_void *)d2i_DSAPublicKey,(char *)(dsa)) 49#endif 50 51#if !defined(X509_REVOKED_dup) 52# define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((i2d_of_void *)i2d_X509_REVOKED, \ 53 (d2i_of_void *)d2i_X509_REVOKED, (char *)(rev)) 54#endif 55 56#if !defined(PKCS7_SIGNER_INFO_dup) 57# define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_SIGNER_INFO, \ 58 (d2i_of_void *)d2i_PKCS7_SIGNER_INFO, (char *)(si)) 59#endif 60 61#if !defined(PKCS7_RECIP_INFO_dup) 62# define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_RECIP_INFO, \ 63 (d2i_of_void *)d2i_PKCS7_RECIP_INFO, (char *)(ri)) 64#endif 65 66#if !defined(HAVE_HMAC_CTX_INIT) 67void HMAC_CTX_init(HMAC_CTX *ctx); 68#endif 69 70#if !defined(HAVE_HMAC_CTX_COPY) 71void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in); 72#endif 73 74#if !defined(HAVE_HMAC_CTX_CLEANUP) 75void HMAC_CTX_cleanup(HMAC_CTX *ctx); 76#endif 77 78#if !defined(HAVE_EVP_MD_CTX_CREATE) 79EVP_MD_CTX *EVP_MD_CTX_create(void); 80#endif 81 82#if !defined(HAVE_EVP_MD_CTX_INIT) 83void EVP_MD_CTX_init(EVP_MD_CTX *ctx); 84#endif 85 86#if !defined(HAVE_EVP_MD_CTX_CLEANUP) 87int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); 88#endif 89 90#if !defined(HAVE_EVP_MD_CTX_DESTROY) 91void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); 92#endif 93 94#if !defined(HAVE_EVP_CIPHER_CTX_COPY) 95int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in); 96#endif 97 98#if !defined(HAVE_EVP_DIGESTINIT_EX) 99# define EVP_DigestInit_ex(ctx, md, engine) EVP_DigestInit((ctx), (md)) 100#endif 101#if !defined(HAVE_EVP_DIGESTFINAL_EX) 102# define EVP_DigestFinal_ex(ctx, buf, len) EVP_DigestFinal((ctx), (buf), (len)) 103#endif 104 105#if !defined(HAVE_EVP_CIPHERINIT_EX) 106# define EVP_CipherInit_ex(ctx, type, impl, key, iv, enc) EVP_CipherInit((ctx), (type), (key), (iv), (enc)) 107#endif 108#if !defined(HAVE_EVP_CIPHERFINAL_EX) 109# define EVP_CipherFinal_ex(ctx, outm, outl) EVP_CipherFinal((ctx), (outm), (outl)) 110#endif 111 112#if !defined(EVP_CIPHER_name) 113# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) 114#endif 115 116#if !defined(EVP_MD_name) 117# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e)) 118#endif 119 120#if !defined(HAVE_EVP_HMAC_INIT_EX) 121# define HMAC_Init_ex(ctx, key, len, digest, engine) HMAC_Init((ctx), (key), (len), (digest)) 122#endif 123 124#if !defined(PKCS7_is_detached) 125# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) 126#endif 127 128#if !defined(PKCS7_type_is_encrypted) 129# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) 130#endif 131 132#if !defined(HAVE_OPENSSL_CLEANSE) 133#define OPENSSL_cleanse(p, l) memset((p), 0, (l)) 134#endif 135 136#if !defined(HAVE_X509_STORE_GET_EX_DATA) 137void *X509_STORE_get_ex_data(X509_STORE *str, int idx); 138#endif 139 140#if !defined(HAVE_X509_STORE_SET_EX_DATA) 141int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data); 142#endif 143 144#if !defined(HAVE_X509_CRL_SET_VERSION) 145int X509_CRL_set_version(X509_CRL *x, long version); 146#endif 147 148#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME) 149int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); 150#endif 151 152#if !defined(HAVE_X509_CRL_SORT) 153int X509_CRL_sort(X509_CRL *c); 154#endif 155 156#if !defined(HAVE_X509_CRL_ADD0_REVOKED) 157int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); 158#endif 159 160#if !defined(HAVE_BN_MOD_SQR) 161int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); 162#endif 163 164#if !defined(HAVE_BN_MOD_ADD) 165int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); 166#endif 167 168#if !defined(HAVE_BN_MOD_SUB) 169int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); 170#endif 171 172#if !defined(HAVE_BN_RAND_RANGE) 173int BN_rand_range(BIGNUM *r, BIGNUM *range); 174#endif 175 176#if !defined(HAVE_BN_PSEUDO_RAND_RANGE) 177int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range); 178#endif 179 180#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE) 181char *CONF_get1_default_config_file(void); 182#endif 183 184#if !defined(HAVE_PEM_DEF_CALLBACK) 185int PEM_def_callback(char *buf, int num, int w, void *key); 186#endif 187 188#if !defined(HAVE_ASN1_PUT_EOC) 189int ASN1_put_eoc(unsigned char **pp); 190#endif 191 192#if defined(__cplusplus) 193} 194#endif 195 196 197#endif /* _OSSL_OPENSSL_MISSING_H_ */ 198 199