From 166519ae67cc5302109199006ab6171ea403f094 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Thu, 22 Aug 2024 14:41:06 -0500 Subject: [PATCH] wolfssl/openssl/asn1.h: use macro for ASN1_BIT_STRING_FIRST_BYTE to avoid non-const errors under gcc-6.5; tests/api.c: fix uninited data defect in test_wolfssl_EVP_chacha20_poly1305(). --- tests/api.c | 3 +++ wolfssl/openssl/asn1.h | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/api.c b/tests/api.c index 68b1d4c361..436ea5a28c 100644 --- a/tests/api.c +++ b/tests/api.c @@ -70719,6 +70719,9 @@ static int test_wolfssl_EVP_chacha20_poly1305(void) EVP_CIPHER_CTX* ctx = NULL; int outSz; + XMEMSET(key, 0, sizeof(key)); + XMEMSET(iv, 0, sizeof(iv)); + /* Encrypt. */ ExpectNotNull((ctx = EVP_CIPHER_CTX_new())); ExpectIntEQ(EVP_EncryptInit_ex(ctx, EVP_chacha20_poly1305(), NULL, NULL, diff --git a/wolfssl/openssl/asn1.h b/wolfssl/openssl/asn1.h index 23be85795e..9ae07986fb 100644 --- a/wolfssl/openssl/asn1.h +++ b/wolfssl/openssl/asn1.h @@ -165,8 +165,7 @@ struct WOLFSSL_ASN1_ITEM { typedef struct WOLFSSL_ASN1_TEMPLATE WOLFSSL_ASN1_TEMPLATE; typedef struct WOLFSSL_ASN1_ITEM WOLFSSL_ASN1_ITEM; -static WC_MAYBE_UNUSED const byte ASN1_BIT_STRING_FIRST_BYTE = ASN_BIT_STRING; - +#define ASN1_BIT_STRING_FIRST_BYTE ASN_BIT_STRING #define ASN1_TFLG_EXPLICIT (0x1 << 0) #define ASN1_TFLG_SEQUENCE_OF (0x1 << 1) #define ASN1_TFLG_IMPTAG (0x1 << 2)