Grid Community Toolkit  6.2.1550507116
libcrypto-compat.h
1 #ifndef LIBCRYPTO_COMPAT_H
2 #define LIBCRYPTO_COMPAT_H
3 
4 #if OPENSSL_VERSION_NUMBER < 0x10100000L
5 
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>
11 
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);
18 
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);
23 
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);
26 
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);
29 
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);
35 
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
43 
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);
51 
52 int RSA_bits(const RSA *r);
53 int DSA_bits(const DSA *d);
54 
55 RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
56 
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);
59 
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,
66  int enc));
67 int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,
68  int (*do_cipher) (EVP_CIPHER_CTX *ctx,
69  unsigned char *out,
70  const unsigned char *in,
71  size_t inl));
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,
76  int arg, void *ptr));
77 
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,
81  int enc);
82 int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
83  unsigned char *out,
84  const unsigned char *in,
85  size_t inl);
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 *,
88  int type, int arg,
89  void *ptr);
90 
91 #define EVP_CIPHER_CTX_reset(c) EVP_CIPHER_CTX_init(c)
92 
93 int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx);
94 
95 #endif /* OPENSSL_VERSION_NUMBER */
96 
97 #endif /* LIBCRYPTO_COMPAT_H */
98