Added support for printf override using XPRINTF for wolfCrypt test/benchmark. Added ability to override snprintf with XSNPRINTF. If STRING_USER is defined no standard lib <string.h> or <stdio.h> will be included.

This commit is contained in:
David Garske
2019-05-23 22:03:38 -06:00
parent a89a2839de
commit f26a9589ff
4 changed files with 22 additions and 3 deletions

View File

@ -113,8 +113,16 @@
#include <stdlib.h> /* we're using malloc / free direct here */
#endif
#include <string.h>
#include <stdio.h>
#ifndef STRING_USER
#include <string.h>
#include <stdio.h>
#endif
/* enable way for customer to override test/bench printf */
#ifdef XPRINTF
#undef printf
#define printf XPRINTF
#endif
#endif
#include <wolfssl/wolfcrypt/memory.h>

View File

@ -105,8 +105,15 @@
#ifdef XMALLOC_USER
#include <stdlib.h> /* we're using malloc / free direct here */
#endif
#ifndef STRING_USER
#include <stdio.h>
#endif
#include <stdio.h>
/* enable way for customer to override test/bench printf */
#ifdef XPRINTF
#undef printf
#define printf XPRINTF
#endif
#endif
#include <wolfssl/wolfcrypt/memory.h>

View File

@ -29,7 +29,9 @@
#ifndef WOLFSSL_MEMORY_H
#define WOLFSSL_MEMORY_H
#ifndef STRING_USER
#include <stdlib.h>
#endif
#include <wolfssl/wolfcrypt/types.h>
#ifdef __cplusplus

View File

@ -430,6 +430,7 @@
/* snprintf is used in asn.c for GetTimeString, PKCS7 test, and when
debugging is turned on */
#ifndef USE_WINDOWS_API
#ifndef XSNPRINTF
#if defined(NO_FILESYSTEM) && (defined(OPENSSL_EXTRA) || \
defined(HAVE_PKCS7)) && !defined(NO_STDIO_FILESYSTEM)
/* case where stdio is not included else where but is needed
@ -437,6 +438,7 @@
#include <stdio.h>
#endif
#define XSNPRINTF snprintf
#endif
#else
#ifdef _MSC_VER
#if (_MSC_VER >= 1900)