diff --git a/configure.ac b/configure.ac index c198e217c..170d6fd06 100644 --- a/configure.ac +++ b/configure.ac @@ -2436,12 +2436,6 @@ AC_ARG_ENABLE([errorqueue], [ ENABLED_ERROR_QUEUE=yes ] ) -if test "$ENABLED_ERROR_QUEUE" = "no" -then - AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_QUEUE" -fi - - # OLD TLS AC_ARG_ENABLE([oldtls], [AS_HELP_STRING([--enable-oldtls],[Enable old TLS versions < 1.2 (default: enabled)])], @@ -6447,16 +6441,17 @@ AS_IF([test "x$ENABLED_ED25519" = "xyes" && test "x$ENABLED_32BIT" = "xno"], AS_IF([test "x$ENABLED_ED25519_SMALL" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -DED25519_SMALL"]) -# Turn off error queue with JNI Java use -AS_IF([test "x$ENABLED_JNI" = "xyes"], - [AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_QUEUE"]) - if test "$ENABLED_ED25519_STREAM" != "no" then AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ED25519_STREAMING_VERIFY" AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ED25519_STREAMING_VERIFY" fi +if test "$ENABLED_ERROR_QUEUE" = "no" || test "$ENABLED_JNI" = "yes" +then + AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_QUEUE" +fi + AS_IF([test "x$ENABLED_OPENSSLALL" = "xyes"], [AM_CFLAGS="-DOPENSSL_ALL -DWOLFSSL_EITHER_SIDE -DWC_RSA_NO_PADDING -DWC_RSA_PSS -DWOLFSSL_PSS_LONG_SALT $AM_CFLAGS"]) diff --git a/wolfcrypt/src/logging.c b/wolfcrypt/src/logging.c index 8262be68d..06b3c9e7b 100644 --- a/wolfcrypt/src/logging.c +++ b/wolfcrypt/src/logging.c @@ -486,18 +486,10 @@ void WOLFSSL_ERROR(int error) "wolfSSL error occurred, error = %d line:%d file:%s", error, line, file); - if (wc_error_queue_count >= ERROR_QUEUE_MAX) { - WOLFSSL_MSG("Error queue is full, at ERROR_QUEUE_MAX"); - } - else { - if (wc_AddErrorNode(error, line, buffer, (char*)file) != 0) { - WOLFSSL_MSG("Error creating logging node"); - /* with void function there is no return here, continue on - * to unlock mutex and log what buffer was created. */ - } - else { - wc_error_queue_count++; - } + if (wc_AddErrorNode(error, line, buffer, (char*)file) != 0) { + WOLFSSL_MSG("Error creating logging node"); + /* with void function there is no return here, continue on + * to unlock mutex and log what buffer was created. */ } #if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) } @@ -687,6 +679,12 @@ int wc_AddErrorNode(int error, int line, char* buf, char* file) WOLFSSL_MSG("Error queue turned off, can not add nodes"); #else struct wc_error_queue* err; + + if (wc_error_queue_count >= ERROR_QUEUE_MAX) { + WOLFSSL_MSG("Error queue is full, at ERROR_QUEUE_MAX"); + return MEMORY_E; + } + err = (struct wc_error_queue*)XMALLOC( sizeof(struct wc_error_queue), wc_error_heap, DYNAMIC_TYPE_LOG); if (err == NULL) { @@ -751,6 +749,7 @@ int wc_AddErrorNode(int error, int line, char* buf, char* file) wc_current_node = err; } } + wc_error_queue_count++; } #endif return 0;