Skip to content

Test api.c: change more tests to use Expect instead of Assert#6530

Merged
dgarske merged 1 commit intowolfSSL:masterfrom
SparkiDev:tests_api_expect_5
Jun 26, 2023
Merged

Test api.c: change more tests to use Expect instead of Assert#6530
dgarske merged 1 commit intowolfSSL:masterfrom
SparkiDev:tests_api_expect_5

Conversation

@SparkiDev
Copy link
Copy Markdown
Contributor

Description

bio.c:
  wolfSSL_BIO_flush(): check allocation to bio->ip succeeded.

internal.c:
  InitSSL_Ctx(): set ctx->heap to heap if value passed in
ProcessPeerCerts(): check for error MEMORY_E too as a fatal parsing
error

ssl.c:
wolfSSL_shutdown(): SOCKET_ERROR_E is also an indication that the
socket is done, MEMORY_E is a fatal error
  wolfSSL_Cleanup(): move free of memory fail couting to wolfSSL API
  SessionTicketNoncePrealloc(): eror return must be non-zero
AddSessionToCache(): XFREE checks for NULL no need to do it before
call
wolfSSL_set_psk_use_session_callback(): ensure ssl is not NULL before
dereferencing
wolfSSL_SMIME_read_PKCS7(): check for error return from
wolfSSL_BIO_gets()

asn.c:
  wc_MIME_parse_headers(): check allocation succeeded into nextHdr

compress.c:
  wc_DeCompressDynamic(): free tmp on inflateInit2 failure

memory.c: rework where memory allocation failure counting code for when
WOFLSSL_STATIC_MEMORY is defined

wc_port.c:
wolfCrypt_Cleanup(): only call wc_MemFailCount_Free() when no
wolfSSL_Cleanup()

Testing

Memory allocation failure testing as well.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@SparkiDev SparkiDev self-assigned this Jun 21, 2023
@SparkiDev SparkiDev force-pushed the tests_api_expect_5 branch 6 times, most recently from a1fb893 to 2d8dbf1 Compare June 22, 2023 12:46
Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/api.c:58157:39: error: ‘WOLFSSL_SESSION’ has no member named ‘ticket’
58157 |     if (bad && (sess != NULL) && (sess->ticket != NULL)) {
      |                                       ^~
make[2]: *** [Makefile:7079: tests/unit_test-api.o] Error 1```

@dgarske dgarske removed their assignment Jun 23, 2023
@SparkiDev SparkiDev force-pushed the tests_api_expect_5 branch from 2d8dbf1 to d4b4260 Compare June 25, 2023 23:02
@SparkiDev
Copy link
Copy Markdown
Contributor Author

Fixed check of sess->ticket to be in #ifdef

@SparkiDev SparkiDev force-pushed the tests_api_expect_5 branch from d4b4260 to 188933f Compare June 25, 2023 23:28
@SparkiDev SparkiDev assigned dgarske and unassigned SparkiDev Jun 26, 2023
Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/api.c:22621:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
22621 |     WC_RNG rng;
      |     ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:7075: tests/unit_test-api.o] Error 1

@dgarske dgarske assigned SparkiDev and unassigned dgarske Jun 26, 2023
bio.c:
  wolfSSL_BIO_flush(): check allocation to bio->ip succeeded.

internal.c:
  InitSSL_Ctx(): set ctx->heap to heap if value passed in
ProcessPeerCerts(): check for error MEMORY_E too as a fatal parsing
error

ssl.c:
wolfSSL_shutdown(): SOCKET_ERROR_E is also an indication that the
socket is done, MEMORY_E is a fatal error
  wolfSSL_Cleanup(): move free of memory fail couting to wolfSSL API
  SessionTicketNoncePrealloc(): eror return must be non-zero
AddSessionToCache(): XFREE checks for NULL no need to do it before
call
wolfSSL_set_psk_use_session_callback(): ensure ssl is not NULL before
dereferencing
wolfSSL_SMIME_read_PKCS7(): check for error return from
wolfSSL_BIO_gets()

asn.c:
  wc_MIME_parse_headers(): check allocation succeeded into nextHdr

compress.c:
  wc_DeCompressDynamic(): free tmp on inflateInit2 failure

memory.c: rework where memory allocation failure counting code for when
WOFLSSL_STATIC_MEMORY is defined

wc_port.c:
wolfCrypt_Cleanup(): only call wc_MemFailCount_Free() when no
wolfSSL_Cleanup()
@SparkiDev SparkiDev force-pushed the tests_api_expect_5 branch from 188933f to 578f56e Compare June 26, 2023 22:01
@SparkiDev
Copy link
Copy Markdown
Contributor Author

fixed

@SparkiDev SparkiDev assigned dgarske and unassigned SparkiDev Jun 26, 2023
@dgarske dgarske merged commit 23c60b7 into wolfSSL:master Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants