1 #ifndef LIBCRYPTO_COMPAT_H
2 #define LIBCRYPTO_COMPAT_H
4 #include <openssl/opensslv.h>
6 #define NISTP256 "P-256"
7 #define NISTP384 "P-384"
8 #define NISTP521 "P-521"
10 #if OPENSSL_VERSION_NUMBER < 0x10100000L
12 #include <openssl/rsa.h>
13 #include <openssl/dsa.h>
14 #include <openssl/ecdsa.h>
15 #include <openssl/dh.h>
16 #include <openssl/evp.h>
17 #include <openssl/hmac.h>
18 #include <openssl/bn.h>
20 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
21 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
22 int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
23 void RSA_get0_key(
const RSA *r,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d);
24 void RSA_get0_factors(
const RSA *r,
const BIGNUM **p,
const BIGNUM **q);
25 void RSA_get0_crt_params(
const RSA *r,
const BIGNUM **dmp1,
const BIGNUM **dmq1,
const BIGNUM **iqmp);
27 void DSA_get0_pqg(
const DSA *d,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g);
28 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
29 void DSA_get0_key(
const DSA *d,
const BIGNUM **pub_key,
const BIGNUM **priv_key);
30 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
32 void DSA_SIG_get0(
const DSA_SIG *sig,
const BIGNUM **pr,
const BIGNUM **ps);
33 int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
35 void ECDSA_SIG_get0(
const ECDSA_SIG *sig,
const BIGNUM **pr,
const BIGNUM **ps);
36 int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
38 EVP_MD_CTX *EVP_MD_CTX_new(
void);
39 void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
41 void DH_get0_pqg(
const DH *dh,
42 const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g);
43 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
44 void DH_get0_key(
const DH *dh,
45 const BIGNUM **pub_key,
const BIGNUM **priv_key);
46 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
48 const char *OpenSSL_version(
int type);
49 unsigned long OpenSSL_version_num(
void);