]> git.sur5r.net Git - bacula/bacula/commitdiff
Add openssl-compat.h which went in wrong directory
authorKern Sibbald <kern@sibbald.com>
Sun, 19 Nov 2017 15:58:35 +0000 (16:58 +0100)
committerKern Sibbald <kern@sibbald.com>
Sun, 19 Nov 2017 15:58:35 +0000 (16:58 +0100)
bacula/src/lib/openssl-compat.h [new file with mode: 0644]

diff --git a/bacula/src/lib/openssl-compat.h b/bacula/src/lib/openssl-compat.h
new file mode 100644 (file)
index 0000000..e811a4b
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef __OPENSSL_COPMAT__H__
+#define __OPENSSL_COPMAT__H__
+
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+static inline int EVP_PKEY_up_ref(EVP_PKEY *pkey)
+{
+       CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
+       return 1;
+}
+
+static inline void EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx)
+{
+       EVP_CIPHER_CTX_init(ctx);
+}
+
+static inline void EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
+{
+       EVP_MD_CTX_init(ctx);
+}
+
+static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
+{
+       EVP_MD_CTX *ctx;
+
+       ctx = (EVP_MD_CTX *)OPENSSL_malloc(sizeof(EVP_MD_CTX));
+       if (ctx)
+               memset(ctx, 0, sizeof(EVP_MD_CTX));
+       return ctx;
+}
+
+static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
+{
+       EVP_MD_CTX_reset(ctx);
+       OPENSSL_free(ctx);
+}
+
+static inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1)
+{
+       return asn1->data;
+}
+#endif
+
+#endif