]> granicus.if.org Git - curl/commitdiff
vtls: switch to CURL_SHA256_DIGEST_LENGTH define
authorDaniel Stenberg <daniel@haxx.se>
Wed, 6 Sep 2017 07:32:02 +0000 (09:32 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 7 Sep 2017 13:59:42 +0000 (15:59 +0200)
... instead of the prefix-less version since WolfSSL 3.12 now uses an
enum with that name that causes build failures for us.

Fixes #1865
Closes #1867
Reported-by: Gisle Vanem
lib/vtls/darwinssl.c
lib/vtls/vtls.c
lib/vtls/vtls.h

index f00a1005326e7751bcb2a5aed3c728b8a1f01676..ab3224c501d1bec3aafc10ecf3e152d26f9624c1 100644 (file)
@@ -2780,7 +2780,7 @@ static void Curl_darwinssl_sha256sum(const unsigned char *tmp, /* input */
                                      unsigned char *sha256sum, /* output */
                                      size_t sha256len)
 {
-  assert(sha256len >= SHA256_DIGEST_LENGTH);
+  assert(sha256len >= CURL_SHA256_DIGEST_LENGTH);
   (void)CC_SHA256(tmp, (CC_LONG)tmplen, sha256sum);
 }
 
index f157603423607ce18fd4f8eecf7d7f08eda96a66..a1a301e7f2e10b0a1d04de863084c97bd366d757 100644 (file)
@@ -815,13 +815,14 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
     }
 
     /* compute sha256sum of public key */
-    sha256sumdigest = malloc(SHA256_DIGEST_LENGTH);
+    sha256sumdigest = malloc(CURL_SHA256_DIGEST_LENGTH);
     if(!sha256sumdigest)
       return CURLE_OUT_OF_MEMORY;
     Curl_ssl->sha256sum(pubkey, pubkeylen,
-                        sha256sumdigest, SHA256_DIGEST_LENGTH);
+                        sha256sumdigest, CURL_SHA256_DIGEST_LENGTH);
     encode = Curl_base64_encode(data, (char *)sha256sumdigest,
-                                SHA256_DIGEST_LENGTH, &encoded, &encodedlen);
+                                CURL_SHA256_DIGEST_LENGTH, &encoded,
+                                &encodedlen);
     Curl_safefree(sha256sumdigest);
 
     if(encode)
index 3c8e32104bb9c5f6605741d0dd747778d5abe9ef..f1a11ea58d73d51395d93d47239b2f22da07ee76 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -116,8 +116,8 @@ CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
 #define MD5_DIGEST_LENGTH 16 /* fixed size */
 #endif
 
-#ifndef SHA256_DIGEST_LENGTH
-#define SHA256_DIGEST_LENGTH 32 /* fixed size */
+#ifndef CURL_SHA256_DIGEST_LENGTH
+#define CURL_SHA256_DIGEST_LENGTH 32 /* fixed size */
 #endif
 
 /* see https://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-04 */