]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Switch to using OpenSSL EVP_* API to avoid deprecation warnings with
authorStefan Eissing <icing@apache.org>
Fri, 10 Sep 2021 09:46:05 +0000 (09:46 +0000)
committerStefan Eissing <icing@apache.org>
Fri, 10 Sep 2021 09:46:05 +0000 (09:46 +0000)
   OpenSSL 3.0. [@notroj]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893220 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_push.c
modules/http2/h2_version.h

index 8ae0b4973d3513407e2c9a252b616200350f2359..0a90a5d86fc20ce9a6f93e46a24104a5daccd1ed 100644 (file)
@@ -23,7 +23,7 @@
 #include <apr_time.h>
 
 #ifdef H2_OPENSSL
-#include <openssl/sha.h>
+#include <openssl/evp.h>
 #endif
 
 #include <httpd.h>
@@ -472,27 +472,32 @@ typedef struct h2_push_diary_entry {
 
 
 #ifdef H2_OPENSSL
-static void sha256_update(SHA256_CTX *ctx, const char *s)
+static void sha256_update(EVP_MD_CTX *ctx, const char *s)
 {
-    SHA256_Update(ctx, s, strlen(s));
+    EVP_DigestUpdate(ctx, s, strlen(s));
 }
 
 static void calc_sha256_hash(h2_push_diary *diary, apr_uint64_t *phash, h2_push *push) 
 {
-    SHA256_CTX sha256;
+    EVP_MD_CTX *md;
     apr_uint64_t val;
-    unsigned char hash[SHA256_DIGEST_LENGTH];
+    unsigned char hash[EVP_MAX_MD_SIZE];
+    unsigned len;
     int i;
-    
-    SHA256_Init(&sha256);
-    sha256_update(&sha256, push->req->scheme);
-    sha256_update(&sha256, "://");
-    sha256_update(&sha256, push->req->authority);
-    sha256_update(&sha256, push->req->path);
-    SHA256_Final(hash, &sha256);
+
+    md = EVP_MD_CTX_create();
+    ap_assert(md != NULL);
+
+    i = EVP_DigestInit_ex(md, EVP_sha256(), NULL);
+    ap_assert(i == 1);
+    sha256_update(md, push->req->scheme);
+    sha256_update(md, "://");
+    sha256_update(md, push->req->authority);
+    sha256_update(md, push->req->path);
+    EVP_DigestFinal(md, hash, &len);
 
     val = 0;
-    for (i = 0; i != sizeof(val); ++i)
+    for (i = 0; i != len; ++i)
         val = val * 256 + hash[i];
     *phash = val >> (64 - diary->mask_bits);
 }
index 664e63a0727046b87b9d683664b749fe6e93a334..7fea6d974bd96f2e7628c3c7276319aeec0b1ce9 100644 (file)
@@ -27,7 +27,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.15.23"
+#define MOD_HTTP2_VERSION "1.15.24-git"
 
 /**
  * @macro
@@ -35,7 +35,7 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define MOD_HTTP2_VERSION_NUM 0x010f17
+#define MOD_HTTP2_VERSION_NUM 0x010f18
 
 
 #endif /* mod_h2_h2_version_h */