From 5fbdd2a2c00157e45d61b21ccdfe18460c357f0d Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Mon, 29 Nov 2021 23:23:23 -0600 Subject: [PATCH] wc_port.h: for linuxkm, move definitions of XSNPRINTF and XATOI macros outside the defined(BUILDING_WOLFSSL) gate, to prevent inclusion of stdio.h and stdlib.h from types.h when building application code. --- wolfssl/wolfcrypt/wc_port.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index b9c43f678..468234fad 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -579,20 +579,6 @@ extern void fipsEntry(void); #endif - /* needed to suppress inclusion of stdio.h in wolfssl/wolfcrypt/types.h */ - #define XSNPRINTF snprintf - - /* the rigmarole around kstrtoll() here is to accommodate its warn-unused-result attribute. */ - #define XATOI(s) ({ \ - long long _xatoi_res = 0; \ - int _xatoi_ret = kstrtoll(s, 10, &_xatoi_res); \ - if (_xatoi_ret != 0) { \ - _xatoi_res = 0; \ - } \ - (int)_xatoi_res; \ - }) - - /* suppress false-positive "writing 1 byte into a region of size 0" warnings * building old kernels with new gcc: */ @@ -602,6 +588,20 @@ #endif /* BUILDING_WOLFSSL */ + /* needed to suppress inclusion of stdio.h in wolfssl/wolfcrypt/types.h */ + #define XSNPRINTF snprintf + + /* the rigmarole around kstrtoll() here is to accommodate its warn-unused-result attribute. */ + /* also needed to suppress inclusion of stdlib.h in wolfssl/wolfcrypt/types.h */ + #define XATOI(s) ({ \ + long long _xatoi_res = 0; \ + int _xatoi_ret = kstrtoll(s, 10, &_xatoi_res); \ + if (_xatoi_ret != 0) { \ + _xatoi_res = 0; \ + } \ + (int)_xatoi_res; \ + }) + #endif /* WOLFSSL_LINUXKM */ /* THREADING/MUTEX SECTION */