--- ext/openssl/openssl_missing.c.orig	2020-12-31 07:47:48.000000000 +0900
+++ ext/openssl/openssl_missing.c	2020-12-31 07:54:05.000000000 +0900
@@ -22,15 +22,16 @@
 #include "openssl_missing.h"
 
 #if !defined(HAVE_HMAC_CTX_COPY)
-void
+int
 HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
 {
-    if (!out || !in) return;
+    if (!out || !in) return 0;
     memcpy(out, in, sizeof(HMAC_CTX));
 
     EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx);
     EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx);
     EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx);
+    return 0;
 }
 #endif /* HAVE_HMAC_CTX_COPY */
 #endif /* NO_HMAC */
@@ -118,7 +119,7 @@
  * tested on 0.9.7d.
  */
 int
-EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in)
+EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
 {
     memcpy(out, in, sizeof(EVP_CIPHER_CTX));
 
@@ -266,7 +267,7 @@
 
 #if !defined(HAVE_BN_RAND_RANGE)
 int
-BN_rand_range(BIGNUM *r, BIGNUM *range)
+BN_rand_range(BIGNUM *r, const const BIGNUM *range)
 {
     return bn_rand_range(0, r, range);
 }
@@ -274,7 +275,7 @@
 
 #if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
 int
-BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range)
+BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range)
 {
     return bn_rand_range(1, r, range);
 }
--- ext/openssl/openssl_missing.h.orig	2020-12-31 07:47:48.000000000 +0900
+++ ext/openssl/openssl_missing.h	2020-12-31 07:52:42.000000000 +0900
@@ -68,7 +68,7 @@
 #endif
 
 #if !defined(HAVE_HMAC_CTX_COPY)
-void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
+int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
 #endif
 
 #if !defined(HAVE_HMAC_CTX_CLEANUP)
@@ -92,7 +92,7 @@
 #endif
 
 #if !defined(HAVE_EVP_CIPHER_CTX_COPY)
-int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
+int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
 #endif
 
 #if !defined(HAVE_EVP_DIGESTINIT_EX)
@@ -170,11 +170,11 @@
 #endif
 
 #if !defined(HAVE_BN_RAND_RANGE)
-int BN_rand_range(BIGNUM *r, BIGNUM *range);
+int BN_rand_range(BIGNUM *r, const BIGNUM *range);
 #endif
 
 #if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
-int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
+int BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range);
 #endif
 
 #if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
