1
0
mirror of https://github.com/wolfSSL/wolfssl.git synced 2026-10-24 04:09:07 +03:00

src/ssl_api_dtls.c, wolfssl/ssl.h: add !NO_TLS gating for wolfSSL_disable_cookie() and wolfSSL_enable_cookie(();

wolfcrypt/test/test.c: smallstack refactor (and leak fixes) for curve448_test().
This commit is contained in:
Daniel Pouzzner
2026-09-28 21:37:23 -05:00
parent fd95bf37c6
commit ebcd652ca8
3 changed files with 47 additions and 18 deletions

View File

@@ -1976,7 +1976,7 @@ int wolfSSL_DTLS_SetCookieSecretSecondary(WOLFSSL* ssl,
#endif /* WOLFSSL_DTLS && !NO_WOLFSSL_SERVER */
#if (defined(WOLFSSL_DTLS) || defined(WOLFSSL_SEND_HRR_COOKIE)) && \
!defined(NO_WOLFSSL_SERVER)
!defined(NO_WOLFSSL_SERVER) && !defined(NO_TLS)
static int CheckCookieSide(WOLFSSL* ssl)
{
if (ssl == NULL)
@@ -2183,7 +2183,8 @@ int wolfSSL_enable_cookie(WOLFSSL* ssl)
return CookiePolicyEnable(ssl);
}
#endif /* (WOLFSSL_DTLS || WOLFSSL_SEND_HRR_COOKIE) && !NO_WOLFSSL_SERVER */
#endif /* (WOLFSSL_DTLS || WOLFSSL_SEND_HRR_COOKIE) && !NO_WOLFSSL_SERVER && */
/* !NO_TLS */
#endif /* !WOLFCRYPT_ONLY */

View File

@@ -58740,7 +58740,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve448_test(void)
{
WC_RNG rng;
wc_test_ret_t ret;
curve448_key userA, userB, pubKey;
WC_DECLARE_VAR(userA, curve448_key, 1, HEAP_HINT);
WC_DECLARE_VAR(userB, curve448_key, 1, HEAP_HINT);
WC_DECLARE_VAR(pubKey, curve448_key, 1, HEAP_HINT);
WOLFSSL_ENTER("curve448_test");
@@ -58752,36 +58754,62 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve448_test(void)
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
wc_curve448_init_ex(&userA, HEAP_HINT, devId);
wc_curve448_init_ex(&userB, HEAP_HINT, devId);
wc_curve448_init_ex(&pubKey, HEAP_HINT, devId);
WC_ALLOC_VAR(userA, curve448_key, 1, HEAP_HINT);
WC_ALLOC_VAR(userB, curve448_key, 1, HEAP_HINT);
WC_ALLOC_VAR(pubKey, curve448_key, 1, HEAP_HINT);
ret = curve448_keyagree_test(&rng, &userA, &userB, &pubKey);
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
if ((userA == NULL) ||
(userB == NULL) ||
(pubKey == NULL))
{
ERROR_OUT(WC_TEST_RET_ENC_EC(MEMORY_E), out);
goto out;
}
#endif
ret = wc_curve448_init_ex(userA, HEAP_HINT, devId);
if (ret != 0)
return ret;
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = wc_curve448_init_ex(userB, HEAP_HINT, devId);
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = wc_curve448_init_ex(pubKey, HEAP_HINT, devId);
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = curve448_keyagree_test(&rng, userA, userB, pubKey);
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#if defined(HAVE_CURVE448_SHARED_SECRET) && \
defined(HAVE_CURVE448_KEY_IMPORT)
ret = curve448_kat_test(&rng, &userA, &userB);
ret = curve448_kat_test(&rng, userA, userB);
if (ret != 0)
return ret;
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = curve448_check_public_test();
if (ret != 0)
return ret;
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = curve448_noncanonical_test();
if (ret != 0)
return ret;
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#endif /* HAVE_CURVE448_SHARED_SECRET && HAVE_CURVE448_KEY_IMPORT */
/* clean up keys when done */
wc_curve448_free(&pubKey);
wc_curve448_free(&userB);
wc_curve448_free(&userA);
out:
wc_FreeRng(&rng);
wc_curve448_free(pubKey);
wc_curve448_free(userB);
wc_curve448_free(userA);
WC_FREE_VAR(pubKey, HEAP_HINT);
WC_FREE_VAR(userB, HEAP_HINT);
WC_FREE_VAR(userA, HEAP_HINT);
return 0;
return ret;
}
#endif /* HAVE_CURVE448 */

View File

@@ -5387,7 +5387,7 @@ WOLFSSL_API int wolfSSL_CTX_RequireExtendedMasterSecret(WOLFSSL_CTX* ctx);
#if (defined(WOLFSSL_DTLS) || defined(WOLFSSL_SEND_HRR_COOKIE)) && \
!defined(NO_WOLFSSL_SERVER)
!defined(NO_WOLFSSL_SERVER) && !defined(NO_TLS)
WOLFSSL_API int wolfSSL_disable_cookie(WOLFSSL* ssl);
WOLFSSL_API int wolfSSL_enable_cookie(WOLFSSL* ssl);
#endif