Skip to content

WolfSSL and SHA256_DIGEST_LENGTH in vtls.h #1865

@gvanem

Description

@gvanem

When building with USE_CYASSL and a recent WolfSSL, I get a compile error in vtls/cyassl.c (from MSVC):

F:\MingW32\src\inet\Crypto\WolfSSL\wolfssl/openssl/sha.h(92): 
  error C2059: syntax error: 'constant'

due to the enum in WolfSSL's openssl/sha.h:

enum {
    SHA256_DIGEST_LENGTH = 32
};

and the fact vtls/vtls.h precedes openssl/sha.h.

Looking at the history of openssl/sha.h. it's not clear to me at which version this change was done.
But maybe libcurl could just do:

--- a/lib/vtls/vtls.h 2017-08-29 08:46:39
+++ b/lib/vtls/vtls.h 2017-09-05 16:05:09
@@ -116,7 +116,14 @@
 #define MD5_DIGEST_LENGTH 16 /* fixed size */
 #endif

-#ifndef SHA256_DIGEST_LENGTH
+#if !defined(SHA256_DIGEST_LENGTH) && !(defined(USE_CYASSL) && (LIBCYASSL_VERSION_HEX >= 0x03012000))
+/*
+ * in WolfSSL's <openssl/sha.h> 3.12+, an enum is used:
+ *  enum {
+ *    SHA256_DIGEST_LENGTH = 32
+ * };
+ *
+ */
 #define SHA256_DIGEST_LENGTH 32 /* fixed size */
 #endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions