From bbd27b491ea57a21972a641257aad4a3eb1107db Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 18 Dec 2017 11:04:40 -0800 Subject: [PATCH 1/3] Fix for building with --enable-32bit where test assumes time_t is long. --- tests/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api.c b/tests/api.c index c6b98dad2..b14037329 100644 --- a/tests/api.c +++ b/tests/api.c @@ -10671,7 +10671,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void) XMEMSET(date_str, 0, sizeof(date_str)); /* Generalized time will overflow time_t if not long */ -#ifndef TIME_T_NOT_LONG +#if !defined(TIME_T_NOT_LONG) && !defined(NO_64BIT) s = (WOLFSSL_ASN1_TIME*)XMALLOC(sizeof(WOLFSSL_ASN1_TIME), NULL, DYNAMIC_TYPE_OPENSSL); /* GeneralizedTime notation test */ @@ -10686,7 +10686,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void) XFREE(s,NULL,DYNAMIC_TYPE_OPENSSL); XMEMSET(date_str, 0, sizeof(date_str)); -#endif +#endif /* !TIME_T_NOT_LONG && !NO_64BIT */ /* if WOLFSSL_ASN1_TIME struct is not allocated */ s = NULL; From 5b003918ef11f87d974d2c66944c649117e88d7e Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 18 Dec 2017 11:10:12 -0800 Subject: [PATCH 2/3] Fix for #ifdef issue causing some X509 functions to be unavailable when DH and ECC were disabled. Fix for `HashAlgoToType` not being available if building with DH and ECC disabled and RSA PSS enabled. --- src/internal.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/internal.c b/src/internal.c index 30422bcde..cc90de0e5 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2699,7 +2699,8 @@ static INLINE void DecodeSigAlg(const byte* input, byte* hashAlgo, byte* hsType) } #endif /* !NO_WOLFSSL_SERVER || !NO_CERTS */ -#if !defined(NO_DH) || defined(HAVE_ECC) +#if !defined(NO_DH) || defined(HAVE_ECC) || \ + (!defined(NO_RSA) && defined(WC_RSA_PSS)) static enum wc_HashType HashAlgoToType(int hashAlgo) { @@ -2729,9 +2730,11 @@ static enum wc_HashType HashAlgoToType(int hashAlgo) return WC_HASH_TYPE_NONE; } -#ifndef NO_CERTS +#endif /* !NO_DH || HAVE_ECC || (!NO_RSA && WC_RSA_PSS) */ +#ifndef NO_CERTS + void InitX509Name(WOLFSSL_X509_NAME* name, int dynamicFlag) { (void)dynamicFlag; @@ -2840,10 +2843,8 @@ void FreeX509(WOLFSSL_X509* x509) if (x509->altNames) FreeAltNames(x509->altNames, x509->heap); } -#endif /* !NO_CERTS */ -#endif /* !NO_DH || HAVE_ECC */ -#ifndef NO_CERTS + /* Encode the signature algorithm into buffer. * * hashalgo The hash algorithm. From 57c0b5d4acb6ee33bac2025241a69fe3aa169226 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 18 Dec 2017 14:34:40 -0800 Subject: [PATCH 3/3] Adjustment to fix for --enable-32bit where time_t is not long. --- tests/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/api.c b/tests/api.c index b14037329..fc7a400cf 100644 --- a/tests/api.c +++ b/tests/api.c @@ -10636,7 +10636,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void) const int hour = 60*60; const int min = 60; const byte asn_utc_time = ASN_UTC_TIME; -#ifndef TIME_T_NOT_LONG +#if !defined(TIME_T_NOT_LONG) && !defined(NO_64BIT) const byte asn_gen_time = ASN_GENERALIZED_TIME; #endif WOLFSSL_ASN1_TIME *asn_time, *s;