Skip to content

Commit ba21fbe

Browse files
committed
Add tests for input guards
1 parent f3a49af commit ba21fbe

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/api.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,21 @@ static int test_wc_LoadStaticMemory_ex(void)
455455
ExpectIntEQ(wc_LoadStaticMemory_ex(NULL, 0, NULL, NULL, NULL, 0, 0, 0),
456456
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
457457

458+
/* Set the bucket list size to 0. */
459+
heap = NULL;
460+
ExpectIntEQ(wc_LoadStaticMemory_ex(&heap,
461+
0, sizeList, distList,
462+
staticMemory, (word32)sizeof(staticMemory),
463+
0, 1),
464+
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
465+
466+
#ifndef WOLFSSL_STATIC_MEMORY_LEAN
467+
ExpectIntEQ(wolfSSL_StaticBufferSz_ex(0, sizeList, distList,
468+
staticMemory, (word32)sizeof(staticMemory),
469+
WOLFMEM_GENERAL),
470+
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
471+
#endif
472+
458473
/* Set the heap pointer to NULL. */
459474
ExpectIntEQ(wc_LoadStaticMemory_ex(NULL,
460475
WOLFMEM_DEF_BUCKETS, sizeList, distList,
@@ -31768,6 +31783,11 @@ static int test_wc_CryptoCb_TLS(int tlsVer,
3176831783
static int test_wc_CryptoCb(void)
3176931784
{
3177031785
EXPECT_DECLS;
31786+
#if defined(WOLF_CRYPTO_CB)
31787+
ExpectIntEQ(wc_CryptoCb_RegisterDevice(INVALID_DEVID, NULL, NULL),
31788+
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
31789+
#endif
31790+
3177131791
#if defined(WOLF_CRYPTO_CB) && \
3177231792
(!defined(WOLF_CRYPTO_CB_ONLY_SHA256) && !defined(WOLF_CRYPTO_CB_ONLY_AES) && \
3177331793
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(WOLF_CRYPTO_CB_ONLY_RSA))

0 commit comments

Comments
 (0)