Skip to content

Commit

Permalink
Peer review feedback: Improve workaround for variadic macros and cast…
Browse files Browse the repository at this point in the history
… warnings.
  • Loading branch information
dgarske committed Nov 4, 2024
1 parent 671f931 commit aad0f6e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1634,8 +1634,7 @@ int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx)
case ORIOS_WRITE:
{
const unsigned char *req;
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp,
(unsigned char*)&req);
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp, (void*)&req);
if (reqLen <= 0) {
WOLFSSL_MSG("wolfSSL_BIO_get_mem_data error");
return WOLFSSL_FAILURE;
Expand Down Expand Up @@ -1711,8 +1710,7 @@ int wolfSSL_OCSP_sendreq_nbio(OcspResponse **presp, WOLFSSL_OCSP_REQ_CTX *ctx)
if (ret != WOLFSSL_SUCCESS)
return ret;

len = wolfSSL_BIO_get_mem_data(ctx->reqResp,
(unsigned char*)&resp);
len = wolfSSL_BIO_get_mem_data(ctx->reqResp, (void*)&resp);
if (len <= 0)
return WOLFSSL_FAILURE;
return wolfSSL_d2i_OCSP_RESPONSE(presp, &resp, len) != NULL
Expand Down
21 changes: 11 additions & 10 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -7168,15 +7168,16 @@ static int TLSX_CA_Names_Parse(WOLFSSL *ssl, const byte* input,
return 0;
}

#define CAN_GET_SIZE TLSX_CA_Names_GetSize
#define CAN_WRITE TLSX_CA_Names_Write
#define CAN_PARSE TLSX_CA_Names_Parse
#define CAN_GET_SIZE(data) TLSX_CA_Names_GetSize(data)
#define CAN_WRITE(data, output) TLSX_CA_Names_Write(data, output)
#define CAN_PARSE(ssl, input, length, isRequest) \
TLSX_CA_Names_Parse(ssl, input, length, isRequest)

#else

#define CAN_GET_SIZE() 0
#define CAN_WRITE() 0
#define CAN_PARSE() 0
#define CAN_GET_SIZE(data) 0
#define CAN_WRITE(data, output) 0
#define CAN_PARSE(ssl, input, length, isRequest) 0

#endif

Expand Down Expand Up @@ -14762,9 +14763,9 @@ static word16 TLSX_GetMinSize_Client(word16* type)
return 0;
}
}
#define TLSX_GET_MIN_SIZE_CLIENT TLSX_GetMinSize_Client
#define TLSX_GET_MIN_SIZE_CLIENT(type) TLSX_GetMinSize_Client(type)
#else
#define TLSX_GET_MIN_SIZE_CLIENT() 0
#define TLSX_GET_MIN_SIZE_CLIENT(type) 0
#endif


Expand Down Expand Up @@ -14831,9 +14832,9 @@ static word16 TLSX_GetMinSize_Server(const word16 *type)
return 0;
}
}
#define TLSX_GET_MIN_SIZE_SERVER TLSX_GetMinSize_Server
#define TLSX_GET_MIN_SIZE_SERVER(type) TLSX_GetMinSize_Server(type)
#else
#define TLSX_GET_MIN_SIZE_SERVER() 0
#define TLSX_GET_MIN_SIZE_SERVER(type) 0
#endif


Expand Down
12 changes: 10 additions & 2 deletions wolfssl/wolfcrypt/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...);
#define HAVE_WOLFSSL_MSG_EX
#else
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#ifdef __WATCOMC__ /* does not allow variadic macros */
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#else
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#endif
#endif
WOLFSSL_API void WOLFSSL_MSG(const char* msg);
#ifdef WOLFSSL_DEBUG_CODEPOINTS
Expand Down Expand Up @@ -209,7 +213,11 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
#define WOLFSSL_STUB(m) WC_DO_NOTHING
#define WOLFSSL_IS_DEBUG_ON() 0

#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#ifdef __WATCOMC__ /* does not allow variadic macros */
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#else
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#endif
#define WOLFSSL_MSG(m) WC_DO_NOTHING
#define WOLFSSL_BUFFER(b, l) WC_DO_NOTHING

Expand Down

0 comments on commit aad0f6e

Please sign in to comment.