Skip to content

Commit 2c585d7

Browse files
committed
Move extended master secret testing to test_tls_ext
1 parent 6761dbb commit 2c585d7

5 files changed

Lines changed: 95 additions & 25 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,7 @@ if(WOLFSSL_EXAMPLES)
25912591
tests/api/test_dtls.c
25922592
tests/api/test_ocsp.c
25932593
tests/api/test_evp.c
2594+
tests/api/test_tls_ext.c
25942595
tests/srp.c
25952596
tests/suites.c
25962597
tests/w64wrapper.c

tests/api.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@
323323
#include <tests/api/test_dtls.h>
324324
#include <tests/api/test_ocsp.h>
325325
#include <tests/api/test_evp.h>
326+
#include <tests/api/test_tls_ext.h>
326327

327328
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_TLS) && \
328329
!defined(NO_RSA) && !defined(SINGLE_THREADED) && \
@@ -12864,31 +12865,6 @@ static int test_wolfSSL_set_alpn_protos(void)
1286412865

1286512866
#endif /* HAVE_ALPN_PROTOS_SUPPORT */
1286612867

12867-
static int test_wolfSSL_DisableExtendedMasterSecret(void)
12868-
{
12869-
EXPECT_DECLS;
12870-
#if defined(HAVE_EXTENDED_MASTER) && !defined(NO_WOLFSSL_CLIENT) && \
12871-
!defined(NO_TLS)
12872-
WOLFSSL_CTX *ctx = wolfSSL_CTX_new(wolfSSLv23_client_method());
12873-
WOLFSSL *ssl = wolfSSL_new(ctx);
12874-
12875-
ExpectNotNull(ctx);
12876-
ExpectNotNull(ssl);
12877-
12878-
/* error cases */
12879-
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(NULL));
12880-
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(NULL));
12881-
12882-
/* success cases */
12883-
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(ctx));
12884-
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(ssl));
12885-
12886-
wolfSSL_free(ssl);
12887-
wolfSSL_CTX_free(ctx);
12888-
#endif
12889-
return EXPECT_RESULT();
12890-
}
12891-
1289212868
static int test_wolfSSL_wolfSSL_UseSecureRenegotiation(void)
1289312869
{
1289412870
EXPECT_DECLS;

tests/api/include.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ tests_unit_test_SOURCES += tests/api/test_dtls.c
5252
# TLS Feature
5353
tests_unit_test_SOURCES += tests/api/test_ocsp.c
5454
tests_unit_test_SOURCES += tests/api/test_evp.c
55+
tests_unit_test_SOURCES += tests/api/test_tls_ext.c
5556
endif
5657

5758
EXTRA_DIST += tests/api/api.h
@@ -101,4 +102,5 @@ EXTRA_DIST += tests/api/test_ocsp.h
101102
EXTRA_DIST += tests/api/test_ocsp_test_blobs.h
102103
EXTRA_DIST += tests/api/create_ocsp_test_blobs.py
103104
EXTRA_DIST += tests/api/test_evp.h
105+
EXTRA_DIST += tests/api/test_tls_ext.h
104106

tests/api/test_tls_ext.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* test_tls_ems.c
2+
*
3+
* Copyright (C) 2006-2025 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
22+
#ifdef HAVE_CONFIG_H
23+
#include <config.h>
24+
#endif
25+
26+
#if !defined(WOLFSSL_USER_SETTINGS) && !defined(WOLFSSL_NO_OPTIONS_H)
27+
#include <wolfssl/options.h>
28+
#endif
29+
#include <wolfssl/wolfcrypt/settings.h>
30+
31+
#ifdef NO_INLINE
32+
#include <wolfssl/wolfcrypt/misc.h>
33+
#else
34+
#define WOLFSSL_MISC_INCLUDED
35+
#include <wolfcrypt/src/misc.c>
36+
#endif
37+
38+
#include <tests/unit.h>
39+
#include <tests/api/test_tls_ext.h>
40+
41+
int test_wolfSSL_DisableExtendedMasterSecret(void)
42+
{
43+
EXPECT_DECLS;
44+
#if defined(HAVE_EXTENDED_MASTER) && !defined(NO_WOLFSSL_CLIENT) && \
45+
!defined(NO_TLS)
46+
WOLFSSL_CTX *ctx = wolfSSL_CTX_new(wolfSSLv23_client_method());
47+
WOLFSSL *ssl = wolfSSL_new(ctx);
48+
49+
ExpectNotNull(ctx);
50+
ExpectNotNull(ssl);
51+
52+
/* error cases */
53+
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(NULL));
54+
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(NULL));
55+
56+
/* success cases */
57+
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_CTX_DisableExtendedMasterSecret(ctx));
58+
ExpectIntEQ(WOLFSSL_SUCCESS, wolfSSL_DisableExtendedMasterSecret(ssl));
59+
60+
wolfSSL_free(ssl);
61+
wolfSSL_CTX_free(ctx);
62+
#endif
63+
return EXPECT_RESULT();
64+
}

tests/api/test_tls_ext.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* test_tls_ems.h
2+
*
3+
* Copyright (C) 2006-2025 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
22+
#ifndef TESTS_API_TEST_TLS_EMS_H
23+
#define TESTS_API_TEST_TLS_EMS_H
24+
25+
int test_wolfSSL_DisableExtendedMasterSecret(void);
26+
27+
#endif /* TESTS_API_TEST_TLS_EMS_H */

0 commit comments

Comments
 (0)