|
| 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 | +} |
0 commit comments