forked from wolfSSL/wolfssl
Merge pull request #4484 from dgarske/memtest
Fix for openssl test with --enable-memtest (also DH test build edge case)
This commit is contained in:
@@ -249,36 +249,38 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
|||||||
static void ShowCiphers(void)
|
static void ShowCiphers(void)
|
||||||
{
|
{
|
||||||
static char ciphers[WOLFSSL_CIPHER_LIST_MAX_SIZE];
|
static char ciphers[WOLFSSL_CIPHER_LIST_MAX_SIZE];
|
||||||
|
|
||||||
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
||||||
|
if (ret == WOLFSSL_SUCCESS) {
|
||||||
if (ret == WOLFSSL_SUCCESS)
|
|
||||||
printf("%s\n", ciphers);
|
printf("%s\n", ciphers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shows which versions are valid */
|
/* Shows which versions are valid */
|
||||||
static void ShowVersions(void)
|
static void ShowVersions(void)
|
||||||
{
|
{
|
||||||
|
char verStr[100];
|
||||||
|
XMEMSET(verStr, 0, sizeof(verStr));
|
||||||
#ifndef NO_OLD_TLS
|
#ifndef NO_OLD_TLS
|
||||||
#ifdef WOLFSSL_ALLOW_SSLV3
|
#ifdef WOLFSSL_ALLOW_SSLV3
|
||||||
printf("0:");
|
XSTRNCAT(verStr, "0:", 3);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_ALLOW_TLSV10
|
#ifdef WOLFSSL_ALLOW_TLSV10
|
||||||
printf("1:");
|
XSTRNCAT(verStr, "1:", 3);
|
||||||
#endif
|
#endif
|
||||||
printf("2:");
|
XSTRNCAT(verStr, "2:", 3);
|
||||||
#endif /* NO_OLD_TLS */
|
#endif /* NO_OLD_TLS */
|
||||||
#ifndef WOLFSSL_NO_TLS12
|
#ifndef WOLFSSL_NO_TLS12
|
||||||
printf("3:");
|
XSTRNCAT(verStr, "3:", 3);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_TLS13
|
#ifdef WOLFSSL_TLS13
|
||||||
printf("4:");
|
XSTRNCAT(verStr, "4:", 3);
|
||||||
#endif
|
#endif
|
||||||
printf("d(downgrade):");
|
XSTRNCAT(verStr, "d(downgrade):", 14);
|
||||||
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EITHER_SIDE)
|
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EITHER_SIDE)
|
||||||
printf("e(either):");
|
XSTRNCAT(verStr, "e(either):", 11);
|
||||||
#endif
|
#endif
|
||||||
printf("\n");
|
/* print all stings at same time on stdout to avoid any flush issues */
|
||||||
|
printf("%s\n", verStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WOLFSSL_TLS13) && defined(HAVE_SUPPORTED_CURVES)
|
#if defined(WOLFSSL_TLS13) && defined(HAVE_SUPPORTED_CURVES)
|
||||||
|
@@ -11997,16 +11997,19 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void)
|
|||||||
#endif /* !NO_RSA && !NO_ASN */
|
#endif /* !NO_RSA && !NO_ASN */
|
||||||
#endif /* !USE_CERT_BUFFER_* */
|
#endif /* !USE_CERT_BUFFER_* */
|
||||||
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && \
|
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && \
|
||||||
!defined(USE_CERT_BUFFERS_3072) && !defined(USE_CERT_BUFFERS_4096) && \
|
!defined(USE_CERT_BUFFERS_3072) && !defined(USE_CERT_BUFFERS_4096)
|
||||||
!defined(NO_ASN)
|
#if !defined(NO_ASN) && !defined(NO_DH)
|
||||||
#ifndef NO_DH
|
|
||||||
static const char* dhParamsFile = CERT_ROOT "dh2048.der";
|
static const char* dhParamsFile = CERT_ROOT "dh2048.der";
|
||||||
#if defined(WOLFSSL_DH_EXTRA) && (!defined(HAVE_FIPS) || \
|
|
||||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2)))
|
|
||||||
static const char* dhKeyFile = CERT_ROOT "statickeys/dh-ffdhe2048.der";
|
|
||||||
static const char* dhKeyPubFile = CERT_ROOT "statickeys/dh-ffdhe2048-pub.der";
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !defined(NO_ASN) && !defined(NO_DH)
|
||||||
|
#if defined(WOLFSSL_DH_EXTRA) && (!defined(HAVE_FIPS) || \
|
||||||
|
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2)))
|
||||||
|
static const char* dhKeyFile = CERT_ROOT "statickeys/dh-ffdhe2048.der";
|
||||||
|
static const char* dhKeyPubFile = CERT_ROOT "statickeys/dh-ffdhe2048-pub.der";
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||||
#ifndef NO_DSA
|
#ifndef NO_DSA
|
||||||
static const char* dsaKey = CERT_ROOT "dsa2048.der";
|
static const char* dsaKey = CERT_ROOT "dsa2048.der";
|
||||||
#endif
|
#endif
|
||||||
|
@@ -168,7 +168,7 @@
|
|||||||
|
|
||||||
#ifdef WOLFSSL_DEBUG_MEMORY
|
#ifdef WOLFSSL_DEBUG_MEMORY
|
||||||
#ifdef WOLFSSL_DEBUG_MEMORY_PRINT
|
#ifdef WOLFSSL_DEBUG_MEMORY_PRINT
|
||||||
printf("Alloc: %p -> %u at %s:%d\n", header->thisMemory, (word32)sz, func, line);
|
fprintf(stderr, "Alloc: %p -> %u at %s:%d\n", header->thisMemory, (word32)sz, func, line);
|
||||||
#else
|
#else
|
||||||
(void)func;
|
(void)func;
|
||||||
(void)line;
|
(void)line;
|
||||||
@@ -276,7 +276,7 @@
|
|||||||
|
|
||||||
#ifdef WOLFSSL_DEBUG_MEMORY
|
#ifdef WOLFSSL_DEBUG_MEMORY
|
||||||
#ifdef WOLFSSL_DEBUG_MEMORY_PRINT
|
#ifdef WOLFSSL_DEBUG_MEMORY_PRINT
|
||||||
printf("Free: %p -> %u at %s:%d\n", ptr, (word32)sz, func, line);
|
fprintf(stderr, "Free: %p -> %u at %s:%d\n", ptr, (word32)sz, func, line);
|
||||||
#else
|
#else
|
||||||
(void)func;
|
(void)func;
|
||||||
(void)line;
|
(void)line;
|
||||||
@@ -337,11 +337,11 @@
|
|||||||
|
|
||||||
ret = wolfSSL_GetAllocators(&mfDefault, &ffDefault, &rfDefault);
|
ret = wolfSSL_GetAllocators(&mfDefault, &ffDefault, &rfDefault);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("wolfSSL GetAllocators failed to get the defaults\n");
|
fprintf(stderr, "wolfSSL GetAllocators failed to get the defaults\n");
|
||||||
}
|
}
|
||||||
ret = wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc);
|
ret = wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("wolfSSL SetAllocators failed for track memory\n");
|
fprintf(stderr, "wolfSSL SetAllocators failed for track memory\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,11 +380,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DO_MEM_STATS
|
#ifdef DO_MEM_STATS
|
||||||
printf("total Allocs = %9ld\n", ourMemStats.totalAllocs);
|
fprintf(stderr, "total Allocs = %9ld\n", ourMemStats.totalAllocs);
|
||||||
printf("total Deallocs = %9ld\n", ourMemStats.totalDeallocs);
|
fprintf(stderr, "total Deallocs = %9ld\n", ourMemStats.totalDeallocs);
|
||||||
printf("total Bytes = %9ld\n", ourMemStats.totalBytes);
|
fprintf(stderr, "total Bytes = %9ld\n", ourMemStats.totalBytes);
|
||||||
printf("peak Bytes = %9ld\n", ourMemStats.peakBytes);
|
fprintf(stderr, "peak Bytes = %9ld\n", ourMemStats.peakBytes);
|
||||||
printf("current Bytes = %9ld\n", ourMemStats.currentBytes);
|
fprintf(stderr, "current Bytes = %9ld\n", ourMemStats.currentBytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DO_MEM_LIST
|
#ifdef DO_MEM_LIST
|
||||||
@@ -392,7 +392,7 @@
|
|||||||
/* print list of allocations */
|
/* print list of allocations */
|
||||||
memHint* header;
|
memHint* header;
|
||||||
for (header = ourMemList.head; header != NULL; header = header->next) {
|
for (header = ourMemList.head; header != NULL; header = header->next) {
|
||||||
printf("Leak: Ptr %p, Size %u"
|
fprintf(stderr, "Leak: Ptr %p, Size %u"
|
||||||
#ifdef WOLFSSL_DEBUG_MEMORY
|
#ifdef WOLFSSL_DEBUG_MEMORY
|
||||||
", Func %s, Line %d"
|
", Func %s, Line %d"
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user