Skip to content

Commit 8d357de

Browse files
Merge pull request #9444 from dgarske/macros_explicit
Fix issue with poorly written macros
2 parents 10c5bae + 658ea30 commit 8d357de

File tree

8 files changed

+21
-20
lines changed

8 files changed

+21
-20
lines changed

src/internal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4967,7 +4967,7 @@ word32 MacSize(const WOLFSSL* ssl)
49674967
}
49684968

49694969
#ifndef NO_RSA
4970-
#if !defined(NO_TLS) && !defined(WOLFSSL_NO_TLS12) || \
4970+
#if (!defined(NO_TLS) && !defined(WOLFSSL_NO_TLS12)) || \
49714971
(defined(WC_RSA_PSS) && defined(HAVE_PK_CALLBACKS))
49724972
#if !defined(NO_WOLFSSL_SERVER) || !defined(NO_WOLFSSL_CLIENT)
49734973
static int TypeHash(int hashAlgo)
@@ -29094,8 +29094,8 @@ static int MatchSigAlgo(WOLFSSL* ssl, int sigAlgo)
2909429094
return sigAlgo == ssl->options.sigAlgo;
2909529095
}
2909629096

29097-
#if defined(HAVE_ECC) && defined(WOLFSSL_TLS13) || \
29098-
defined(USE_ECDSA_KEYSZ_HASH_ALGO)
29097+
#if defined(HAVE_ECC) && \
29098+
(defined(WOLFSSL_TLS13) || defined(USE_ECDSA_KEYSZ_HASH_ALGO))
2909929099
static int CmpEccStrength(int hashAlgo, int curveSz)
2910029100
{
2910129101
int dgstSz = GetMacDigestSize((byte)hashAlgo);

wolfcrypt/src/asn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ static int GetOID(const byte* input, word32* inOutIdx, word32* oid,
10771077
static int GetASN_Integer(const byte* input, word32 idx, int length,
10781078
int positive)
10791079
{
1080-
#if !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS) || \
1080+
#if (!defined(HAVE_SELFTEST) && !defined(HAVE_FIPS)) || \
10811081
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))
10821082
/* Check contents consist of one or more octets. */
10831083
if (length == 0) {
@@ -1125,7 +1125,7 @@ static int GetASN_Integer(const byte* input, word32 idx, int length,
11251125
*/
11261126
int GetASN_BitString(const byte* input, word32 idx, int length)
11271127
{
1128-
#if !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS) || \
1128+
#if (!defined(HAVE_SELFTEST) && !defined(HAVE_FIPS)) || \
11291129
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))
11301130
/* Check contents consist of one or more octets. */
11311131
if (length == 0) {
@@ -26480,7 +26480,7 @@ static wcchar END_ENC_PRIV_KEY = "-----END ENCRYPTED PRIVATE KEY-----";
2648026480
static wcchar BEGIN_PKCS7 = "-----BEGIN PKCS7-----";
2648126481
static wcchar END_PKCS7 = "-----END PKCS7-----";
2648226482
#endif
26483-
#if defined(HAVE_ECC) || !defined(NO_DSA) && defined(WOLFSSL_PEM_TO_DER)
26483+
#if (defined(HAVE_ECC) || !defined(NO_DSA)) && defined(WOLFSSL_PEM_TO_DER)
2648426484
static wcchar BEGIN_DSA_PRIV = "-----BEGIN DSA PRIVATE KEY-----";
2648526485
static wcchar END_DSA_PRIV = "-----END DSA PRIVATE KEY-----";
2648626486
#endif

wolfcrypt/test/test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,7 +5887,7 @@ static wc_test_ret_t sha3_384_test(void)
58875887
a.inLen = XSTRLEN(a.input);
58885888
a.outLen = WC_SHA3_384_DIGEST_SIZE;
58895889

5890-
#if defined(WOLFSSL_AFALG_XILINX_SHA3) || defined(WOLFSSL_XILINX_CRYPT) && !defined(WOLFSSL_XILINX_CRYPT_VERSAL)
5890+
#ifndef NO_INTM_HASH_TEST
58915891
/* NIST test vector with a length that is a multiple of 4 */
58925892
b.input = "\x7d\x80\xb1\x60\xc4\xb5\x36\xa3\xbe\xb7\x99\x80\x59\x93\x44"
58935893
"\x04\x7c\x5f\x82\xa1\xdf\xc3\xee\xd4";
@@ -5914,7 +5914,7 @@ static wc_test_ret_t sha3_384_test(void)
59145914
c.inLen = XSTRLEN(c.input);
59155915
c.outLen = WC_SHA3_384_DIGEST_SIZE;
59165916

5917-
#if defined(WOLFSSL_XILINX_CRYPT) && !defined(WOLFSSL_XILINX_CRYPT_VERSAL)
5917+
#ifndef NO_INTM_HASH_TEST
59185918
test_sha[0] = b; /* hardware acc. pre-Versal can not handle "" string */
59195919
#else
59205920
test_sha[0] = a;

wolfssl/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4549,7 +4549,7 @@ WOLFSSL_LOCAL int wolfSSL_quic_add_transport_extensions(WOLFSSL *ssl, int msg_ty
45494549
#endif /* WOLFSSL_QUIC */
45504550

45514551
/** Session Ticket - RFC 5077 (session 3.2) */
4552-
#if defined(WOLFSSL_TLS13) && defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
4552+
#if defined(WOLFSSL_TLS13) && (defined(HAVE_SESSION_TICKET) || !defined(NO_PSK))
45534553
/* Ticket nonce - for deriving PSK.
45544554
Length allowed to be: 1..255. Only support
45554555
* TLS13_TICKET_NONCE_STATIC_SZ length bytes.
@@ -4564,7 +4564,6 @@ typedef struct TicketNonce {
45644564
byte data[MAX_TICKET_NONCE_STATIC_SZ];
45654565
#endif /* WOLFSSL_TICKET_NONCE_MALLOC && FIPS_VERSION_GE(5,3) */
45664566
} TicketNonce;
4567-
45684567
#endif
45694568

45704569
/* wolfSSL session type */

wolfssl/openssl/opensslv.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
3131

3232
/* api version compatibility */
33-
#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x009070dfL) ||\
34-
defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x0090810fL) ||\
35-
defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10100000L) ||\
36-
defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10001040L)
33+
#if defined(OPENSSL_VERSION_NUMBER) && \
34+
((OPENSSL_VERSION_NUMBER == 0x009070dfL) || \
35+
(OPENSSL_VERSION_NUMBER == 0x0090810fL) || \
36+
(OPENSSL_VERSION_NUMBER == 0x10100000L) || \
37+
(OPENSSL_VERSION_NUMBER == 0x10001040L))
38+
3739
/* valid version */
3840
#elif defined(OPENSSL_VERSION_NUMBER)
3941
/* unrecognized version, but continue. */

wolfssl/ssl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5322,8 +5322,8 @@ WOLFSSL_API WOLFSSL_X509 *wolfSSL_X509_to_X509_REQ(WOLFSSL_X509 *x,
53225322
WOLFSSL_EVP_PKEY *pkey, const WOLFSSL_EVP_MD *md);
53235323
#endif
53245324

5325-
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && defined(WOLFSSL_CERT_GEN) || \
5326-
defined(WOLFSSL_CERT_REQ)
5325+
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \
5326+
(defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_REQ))
53275327
WOLFSSL_API int wolfSSL_X509_REQ_get_attr_count(const WOLFSSL_X509 *req);
53285328
WOLFSSL_API WOLFSSL_X509_ATTRIBUTE *wolfSSL_X509_REQ_get_attr(
53295329
const WOLFSSL_X509 *req, int loc);

wolfssl/test.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ static WC_INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
18281828
#endif /* !SINGLE_THREADED */
18291829

18301830
if (ready_file) {
1831-
#if !defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST) && \
1831+
#if (!defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST)) && \
18321832
!defined(NETOS)
18331833
XFILE srf = (XFILE)NULL;
18341834
if (args)
@@ -2741,7 +2741,7 @@ static WC_INLINE void CaCb(unsigned char* der, int sz, int type)
27412741

27422742
static WC_INLINE int ChangeToWolfRoot(void)
27432743
{
2744-
#if !defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST) && \
2744+
#if (!defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST)) && \
27452745
!defined(NETOS)
27462746
int depth;
27472747
for(depth = 0; depth <= MAX_WOLF_ROOT_DEPTH; depth++) {

wolfssl/wolfio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
957957

958958
#ifndef XINET_NTOP
959959
#if defined(__WATCOMC__)
960-
#if defined(__OS2__) || defined(__NT__) && \
960+
#if (defined(__OS2__) || defined(__NT__)) && \
961961
(NTDDI_VERSION >= NTDDI_VISTA)
962962
#define XINET_NTOP(a,b,c,d) inet_ntop((a),(b),(c),(d))
963963
#else
@@ -972,7 +972,7 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
972972
#endif
973973
#ifndef XINET_PTON
974974
#if defined(__WATCOMC__)
975-
#if defined(__OS2__) || defined(__NT__) && \
975+
#if (defined(__OS2__) || defined(__NT__)) && \
976976
(NTDDI_VERSION >= NTDDI_VISTA)
977977
#define XINET_PTON(a,b,c) inet_pton((a),(b),(c))
978978
#else

0 commit comments

Comments
 (0)