forked from wolfSSL/wolfssl
Move extended master secret testing to test_tls_ext
This commit is contained in:
@@ -2591,6 +2591,7 @@ if(WOLFSSL_EXAMPLES)
|
|||||||
tests/api/test_dtls.c
|
tests/api/test_dtls.c
|
||||||
tests/api/test_ocsp.c
|
tests/api/test_ocsp.c
|
||||||
tests/api/test_evp.c
|
tests/api/test_evp.c
|
||||||
|
tests/api/test_tls_ext.c
|
||||||
tests/srp.c
|
tests/srp.c
|
||||||
tests/suites.c
|
tests/suites.c
|
||||||
tests/w64wrapper.c
|
tests/w64wrapper.c
|
||||||
|
26
tests/api.c
26
tests/api.c
@@ -323,6 +323,7 @@
|
|||||||
#include <tests/api/test_dtls.h>
|
#include <tests/api/test_dtls.h>
|
||||||
#include <tests/api/test_ocsp.h>
|
#include <tests/api/test_ocsp.h>
|
||||||
#include <tests/api/test_evp.h>
|
#include <tests/api/test_evp.h>
|
||||||
|
#include <tests/api/test_tls_ext.h>
|
||||||
|
|
||||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_TLS) && \
|
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_TLS) && \
|
||||||
!defined(NO_RSA) && !defined(SINGLE_THREADED) && \
|
!defined(NO_RSA) && !defined(SINGLE_THREADED) && \
|
||||||
@@ -12864,31 +12865,6 @@ static int test_wolfSSL_set_alpn_protos(void)
|
|||||||
|
|
||||||
#endif /* HAVE_ALPN_PROTOS_SUPPORT */
|
#endif /* HAVE_ALPN_PROTOS_SUPPORT */
|
||||||
|
|
||||||
static int test_wolfSSL_DisableExtendedMasterSecret(void)
|
|
||||||
{
|
|
||||||
EXPECT_DECLS;
|
|
||||||
#if defined(HAVE_EXTENDED_MASTER) && !defined(NO_WOLFSSL_CLIENT) && \
|
|
||||||
!defined(NO_TLS)
|
|
||||||
WOLFSSL_CTX *ctx = wolfSSL_CTX_new(wolfSSLv23_client_method());
|
|
||||||
WOLFSSL *ssl = wolfSSL_new(ctx);
|
|
||||||
|
|
||||||
ExpectNotNull(ctx);
|
|
||||||
ExpectNotNull(ssl);
|
|
||||||
|
|
||||||
/* error cases */
|
|
||||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(NULL));
|
|
||||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(NULL));
|
|
||||||
|
|
||||||
/* success cases */
|
|
||||||
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(ctx));
|
|
||||||
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(ssl));
|
|
||||||
|
|
||||||
wolfSSL_free(ssl);
|
|
||||||
wolfSSL_CTX_free(ctx);
|
|
||||||
#endif
|
|
||||||
return EXPECT_RESULT();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int test_wolfSSL_wolfSSL_UseSecureRenegotiation(void)
|
static int test_wolfSSL_wolfSSL_UseSecureRenegotiation(void)
|
||||||
{
|
{
|
||||||
EXPECT_DECLS;
|
EXPECT_DECLS;
|
||||||
|
@@ -52,6 +52,7 @@ tests_unit_test_SOURCES += tests/api/test_dtls.c
|
|||||||
# TLS Feature
|
# TLS Feature
|
||||||
tests_unit_test_SOURCES += tests/api/test_ocsp.c
|
tests_unit_test_SOURCES += tests/api/test_ocsp.c
|
||||||
tests_unit_test_SOURCES += tests/api/test_evp.c
|
tests_unit_test_SOURCES += tests/api/test_evp.c
|
||||||
|
tests_unit_test_SOURCES += tests/api/test_tls_ext.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST += tests/api/api.h
|
EXTRA_DIST += tests/api/api.h
|
||||||
@@ -101,4 +102,5 @@ EXTRA_DIST += tests/api/test_ocsp.h
|
|||||||
EXTRA_DIST += tests/api/test_ocsp_test_blobs.h
|
EXTRA_DIST += tests/api/test_ocsp_test_blobs.h
|
||||||
EXTRA_DIST += tests/api/create_ocsp_test_blobs.py
|
EXTRA_DIST += tests/api/create_ocsp_test_blobs.py
|
||||||
EXTRA_DIST += tests/api/test_evp.h
|
EXTRA_DIST += tests/api/test_evp.h
|
||||||
|
EXTRA_DIST += tests/api/test_tls_ext.h
|
||||||
|
|
||||||
|
64
tests/api/test_tls_ext.c
Normal file
64
tests/api/test_tls_ext.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* test_tls_ems.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2025 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfSSL.
|
||||||
|
*
|
||||||
|
* wolfSSL is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* wolfSSL is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WOLFSSL_USER_SETTINGS) && !defined(WOLFSSL_NO_OPTIONS_H)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
|
||||||
|
#ifdef NO_INLINE
|
||||||
|
#include <wolfssl/wolfcrypt/misc.h>
|
||||||
|
#else
|
||||||
|
#define WOLFSSL_MISC_INCLUDED
|
||||||
|
#include <wolfcrypt/src/misc.c>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <tests/unit.h>
|
||||||
|
#include <tests/api/test_tls_ext.h>
|
||||||
|
|
||||||
|
int test_wolfSSL_DisableExtendedMasterSecret(void)
|
||||||
|
{
|
||||||
|
EXPECT_DECLS;
|
||||||
|
#if defined(HAVE_EXTENDED_MASTER) && !defined(NO_WOLFSSL_CLIENT) && \
|
||||||
|
!defined(NO_TLS)
|
||||||
|
WOLFSSL_CTX *ctx = wolfSSL_CTX_new(wolfSSLv23_client_method());
|
||||||
|
WOLFSSL *ssl = wolfSSL_new(ctx);
|
||||||
|
|
||||||
|
ExpectNotNull(ctx);
|
||||||
|
ExpectNotNull(ssl);
|
||||||
|
|
||||||
|
/* error cases */
|
||||||
|
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(NULL));
|
||||||
|
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(NULL));
|
||||||
|
|
||||||
|
/* success cases */
|
||||||
|
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(ctx));
|
||||||
|
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(ssl));
|
||||||
|
|
||||||
|
wolfSSL_free(ssl);
|
||||||
|
wolfSSL_CTX_free(ctx);
|
||||||
|
#endif
|
||||||
|
return EXPECT_RESULT();
|
||||||
|
}
|
27
tests/api/test_tls_ext.h
Normal file
27
tests/api/test_tls_ext.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/* test_tls_ems.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2025 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfSSL.
|
||||||
|
*
|
||||||
|
* wolfSSL is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* wolfSSL is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TESTS_API_TEST_TLS_EMS_H
|
||||||
|
#define TESTS_API_TEST_TLS_EMS_H
|
||||||
|
|
||||||
|
int test_wolfSSL_DisableExtendedMasterSecret(void);
|
||||||
|
|
||||||
|
#endif /* TESTS_API_TEST_TLS_EMS_H */
|
Reference in New Issue
Block a user