1 #ifndef LIBCRYPTO_COMPAT_H 2 #define LIBCRYPTO_COMPAT_H 4 #if OPENSSL_VERSION_NUMBER < 0x10100000L 6 #include <openssl/rsa.h> 7 #include <openssl/dsa.h> 8 #include <openssl/ecdsa.h> 9 #include <openssl/dh.h> 10 #include <openssl/evp.h> 12 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
13 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
14 int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
15 void RSA_get0_key(
const RSA *r,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d);
16 void RSA_get0_factors(
const RSA *r,
const BIGNUM **p,
const BIGNUM **q);
17 void RSA_get0_crt_params(
const RSA *r,
const BIGNUM **dmp1,
const BIGNUM **dmq1,
const BIGNUM **iqmp);
19 void DSA_get0_pqg(
const DSA *d,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g);
20 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
21 void DSA_get0_key(
const DSA *d,
const BIGNUM **pub_key,
const BIGNUM **priv_key);
22 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
24 void DSA_SIG_get0(
const DSA_SIG *sig,
const BIGNUM **pr,
const BIGNUM **ps);
25 int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
27 void ECDSA_SIG_get0(
const ECDSA_SIG *sig,
const BIGNUM **pr,
const BIGNUM **ps);
28 int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
30 void DH_get0_pqg(
const DH *dh,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g);
31 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
32 void DH_get0_key(
const DH *dh,
const BIGNUM **pub_key,
const BIGNUM **priv_key);
33 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
34 int DH_set_length(DH *dh,
long length);
36 const unsigned char *EVP_CIPHER_CTX_iv(
const EVP_CIPHER_CTX *ctx);
37 unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);
38 int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
39 EVP_MD_CTX *EVP_MD_CTX_new(
void);
40 void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
41 #define EVP_CIPHER_impl_ctx_size(e) e->ctx_size 42 #define EVP_CIPHER_CTX_get_cipher_data(ctx) ctx->cipher_data 44 RSA_METHOD *RSA_meth_dup(
const RSA_METHOD *meth);
45 int RSA_meth_set1_name(RSA_METHOD *meth,
const char *name);
46 #define RSA_meth_get_finish(meth) meth->finish 47 int RSA_meth_set_priv_enc(RSA_METHOD *meth,
int (*priv_enc) (
int flen,
const unsigned char *from,
unsigned char *to, RSA *rsa,
int padding));
48 int RSA_meth_set_priv_dec(RSA_METHOD *meth,
int (*priv_dec) (
int flen,
const unsigned char *from,
unsigned char *to, RSA *rsa,
int padding));
49 int RSA_meth_set_finish(RSA_METHOD *meth,
int (*finish) (RSA *rsa));
50 void RSA_meth_free(RSA_METHOD *meth);
52 int RSA_bits(
const RSA *r);
53 int DSA_bits(
const DSA *d);
55 RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
57 EVP_CIPHER *EVP_CIPHER_meth_new(
int cipher_type,
int block_size,
int key_len);
58 void EVP_CIPHER_meth_free(EVP_CIPHER *cipher);
60 int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher,
int iv_len);
61 int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher,
unsigned long flags);
62 int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,
63 int (*init) (EVP_CIPHER_CTX *ctx,
64 const unsigned char *key,
65 const unsigned char *iv,
67 int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,
68 int (*do_cipher) (EVP_CIPHER_CTX *ctx,
70 const unsigned char *in,
72 int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,
73 int (*cleanup) (EVP_CIPHER_CTX *));
74 int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,
75 int (*ctrl) (EVP_CIPHER_CTX *,
int type,
78 int (*EVP_CIPHER_meth_get_init(
const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
79 const unsigned char *key,
80 const unsigned char *iv,
82 int (*EVP_CIPHER_meth_get_do_cipher(
const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
84 const unsigned char *in,
86 int (*EVP_CIPHER_meth_get_cleanup(
const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);
87 int (*EVP_CIPHER_meth_get_ctrl(
const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
91 #define EVP_CIPHER_CTX_reset(c) EVP_CIPHER_CTX_init(c) 93 int EVP_CIPHER_CTX_encrypting(
const EVP_CIPHER_CTX *ctx);