hmacsha.@O@ httpd.@O@ iterated_hash.@O@ \
lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \
md5.@O@ mem.@O@ mutexblock.@O@ \
- netaddr.@O@ netscope.@O@ nonce.@O@ pool.@O@ \
+ netaddr.@O@ netscope.@O@ nonce.@O@ openssl_shim.@O@ pool.@O@ \
parseint.@O@ portset.@O@ quota.@O@ radix.@O@ random.@O@ \
ratelimiter.@O@ refcount.@O@ region.@O@ regex.@O@ result.@O@ \
rwlock.@O@ \
hmacsha.c httpd.c iterated_hash.c \
lex.c lfsr.c lib.c log.c \
md5.c mem.c mutexblock.c \
- netaddr.c netscope.c nonce.c pool.c \
+ netaddr.c netscope.c nonce.c openssl_shim.c pool.c \
parseint.c portset.c quota.c radix.c random.c \
ratelimiter.c refcount.c region.c regex.c result.c rwlock.c \
safe.c serial.c sha1.c sha2.c sockaddr.c stats.c string.c \
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+#include <config.h>
+
+#include <openssl/opensslv.h>
+
+#if HAVE_OPENSSL && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
+
+#include <stdlib.h>
+#include <string.h>
+#include "openssl_shim.h"
+#include <openssl/engine.h>
+#include <openssl/hmac.h>
+#include <openssl/crypto.h>
+
+void *OPENSSL_zalloc(size_t size)
+{
+ void *ret = OPENSSL_malloc(size);
+ if (ret != NULL) {
+ memset(ret, 0, size);
+ }
+ return ret;
+}
+
+EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void)
+{
+ EVP_CIPHER_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
+ return ctx;
+}
+
+void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
+{
+ if (ctx != NULL) {
+ EVP_CIPHER_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+
+EVP_MD_CTX *EVP_MD_CTX_new(void)
+{
+ EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
+ if (ctx != NULL) {
+ memset(ctx, 0, sizeof(*ctx));
+ }
+ return ctx;
+}
+
+void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
+{
+ if (ctx != NULL) {
+ EVP_MD_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+
+int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
+{
+ return EVP_MD_CTX_cleanup(ctx);
+}
+
+HMAC_CTX *HMAC_CTX_new(void)
+{
+ HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
+ if (ctx != NULL) {
+ if (!HMAC_CTX_reset(ctx)) {
+ HMAC_CTX_free(ctx);
+ return NULL;
+ }
+ }
+ return ctx;
+}
+
+void HMAC_CTX_free(HMAC_CTX *ctx)
+{
+ if (ctx != NULL) {
+ HMAC_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+
+int HMAC_CTX_reset(HMAC_CTX *ctx) {
+ HMAC_CTX_cleanup(ctx);
+ return 1;
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+#ifndef ISC_OPENSSL_P_H
+#define ISC_OPENSSL_P_H
+
+#include <config.h>
+
+#include <openssl/opensslv.h>
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+
+#include <openssl/engine.h>
+#include <openssl/hmac.h>
+
+void *OPENSSL_zalloc(size_t size);
+EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void);
+void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx);
+EVP_MD_CTX *EVP_MD_CTX_new(void);
+void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
+int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
+HMAC_CTX *HMAC_CTX_new(void);
+void HMAC_CTX_free(HMAC_CTX *ctx);
+int HMAC_CTX_reset(HMAC_CTX *ctx);
+
+#endif /* ISC_OPENSSL_P_H */
+
+#endif /* ISC_OPENSSL_P_H */
<ClInclude Include="../entropy_private.h">
<Filter>Win32 Header Files</Filter>
</ClInclude>
+ <ClInclude Include="../openssl_shim.h">
+ <Filter>Win32 Header Files</Filter>
+ </ClInclude>
<ClInclude Include="errno2result.h">
<Filter>Win32 Header Files</Filter>
</ClInclude>
<ClCompile Include="..\nonce.c">
<Filter>Library Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\openssl_shim.c">
+ <Filter>Library Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\parseint.c">
<Filter>Library Source Files</Filter>
</ClCompile>
<ClInclude Include="include\isc\thread.h" />
<ClInclude Include="include\isc\time.h" />
<ClInclude Include="include\isc\win32os.h" />
- <ClInclude Include="../entropy_private.h" />\r
+ <ClInclude Include="../entropy_private.h" />
+ <ClInclude Include="../openssl_shim.h" />\r
<ClInclude Include="syslog.h" />
<ClInclude Include="unistd.h" />
@IF PKCS11
<ClCompile Include="..\netscope.c" />
<ClCompile Include="..\nonce.c" />
<ClCompile Include="..\nls\msgcat.c" />
+ <ClCompile Include="..\openssl_shim.c" />
<ClCompile Include="..\parseint.c" />
<ClCompile Include="..\pool.c" />
<ClCompile Include="..\portset.c" />