]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/lib/openssl-compat.h
Add openssl-compat.h which went in wrong directory
[bacula/bacula] / bacula / src / lib / openssl-compat.h
1 #ifndef __OPENSSL_COPMAT__H__
2 #define __OPENSSL_COPMAT__H__
3
4 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
5 static inline int EVP_PKEY_up_ref(EVP_PKEY *pkey)
6 {
7         CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
8         return 1;
9 }
10
11 static inline void EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx)
12 {
13         EVP_CIPHER_CTX_init(ctx);
14 }
15
16 static inline void EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
17 {
18         EVP_MD_CTX_init(ctx);
19 }
20
21 static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
22 {
23         EVP_MD_CTX *ctx;
24
25         ctx = (EVP_MD_CTX *)OPENSSL_malloc(sizeof(EVP_MD_CTX));
26         if (ctx)
27                 memset(ctx, 0, sizeof(EVP_MD_CTX));
28         return ctx;
29 }
30
31 static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
32 {
33         EVP_MD_CTX_reset(ctx);
34         OPENSSL_free(ctx);
35 }
36
37 static inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1)
38 {
39         return asn1->data;
40 }
41 #endif
42
43 #endif