2016-03-17 14:14:30 +00:00
|
|
|
/*
|
2018-03-20 13:00:17 +00:00
|
|
|
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
2016-03-17 14:14:30 +00:00
|
|
|
*
|
2018-12-06 12:05:25 +00:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-17 18:20:24 +00:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
2016-03-17 14:14:30 +00:00
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ideally, CONF should offer standard parsing methods and cover them
|
|
|
|
* in tests. But since we have no CONF tests, we use a custom test for now.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2016-07-04 18:16:14 +00:00
|
|
|
#include <string.h>
|
2016-03-17 14:14:30 +00:00
|
|
|
|
2017-08-22 12:35:43 +00:00
|
|
|
#include "internal/nelem.h"
|
2016-03-17 14:14:30 +00:00
|
|
|
#include "ssl_test_ctx.h"
|
|
|
|
#include "testutil.h"
|
|
|
|
#include <openssl/e_os2.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
#include <openssl/conf.h>
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
|
|
|
static CONF *conf = NULL;
|
|
|
|
|
|
|
|
typedef struct ssl_test_ctx_test_fixture {
|
|
|
|
const char *test_case_name;
|
|
|
|
const char *test_section;
|
|
|
|
/* Expected parsed configuration. */
|
|
|
|
SSL_TEST_CTX *expected_ctx;
|
|
|
|
} SSL_TEST_CTX_TEST_FIXTURE;
|
|
|
|
|
2016-07-21 14:29:48 +00:00
|
|
|
|
2017-05-02 12:32:26 +00:00
|
|
|
static int clientconf_eq(SSL_TEST_CLIENT_CONF *conf1,
|
|
|
|
SSL_TEST_CLIENT_CONF *conf2)
|
2016-07-21 14:29:48 +00:00
|
|
|
{
|
2017-05-02 12:32:26 +00:00
|
|
|
if (!TEST_int_eq(conf1->verify_callback, conf2->verify_callback)
|
|
|
|
|| !TEST_int_eq(conf1->servername, conf2->servername)
|
|
|
|
|| !TEST_str_eq(conf1->npn_protocols, conf2->npn_protocols)
|
|
|
|
|| !TEST_str_eq(conf1->alpn_protocols, conf2->alpn_protocols)
|
2017-11-05 16:46:48 +00:00
|
|
|
|| !TEST_int_eq(conf1->ct_validation, conf2->ct_validation)
|
|
|
|
|| !TEST_int_eq(conf1->max_fragment_len_mode,
|
|
|
|
conf2->max_fragment_len_mode))
|
2016-07-21 14:29:48 +00:00
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-05-02 12:32:26 +00:00
|
|
|
static int serverconf_eq(SSL_TEST_SERVER_CONF *serv,
|
|
|
|
SSL_TEST_SERVER_CONF *serv2)
|
2016-07-21 14:29:48 +00:00
|
|
|
{
|
2017-05-02 12:32:26 +00:00
|
|
|
if (!TEST_int_eq(serv->servername_callback, serv2->servername_callback)
|
|
|
|
|| !TEST_str_eq(serv->npn_protocols, serv2->npn_protocols)
|
|
|
|
|| !TEST_str_eq(serv->alpn_protocols, serv2->alpn_protocols)
|
|
|
|
|| !TEST_int_eq(serv->broken_session_ticket,
|
|
|
|
serv2->broken_session_ticket)
|
2017-03-15 17:25:55 +00:00
|
|
|
|| !TEST_str_eq(serv->session_ticket_app_data,
|
|
|
|
serv2->session_ticket_app_data)
|
2017-05-02 12:32:26 +00:00
|
|
|
|| !TEST_int_eq(serv->cert_status, serv2->cert_status))
|
2016-07-21 14:29:48 +00:00
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-05-02 12:32:26 +00:00
|
|
|
static int extraconf_eq(SSL_TEST_EXTRA_CONF *extra,
|
|
|
|
SSL_TEST_EXTRA_CONF *extra2)
|
2016-07-21 14:29:48 +00:00
|
|
|
{
|
2017-05-02 12:32:26 +00:00
|
|
|
if (!TEST_true(clientconf_eq(&extra->client, &extra2->client))
|
|
|
|
|| !TEST_true(serverconf_eq(&extra->server, &extra2->server))
|
|
|
|
|| !TEST_true(serverconf_eq(&extra->server2, &extra2->server2)))
|
|
|
|
return 0;
|
|
|
|
return 1;
|
2016-07-21 14:29:48 +00:00
|
|
|
}
|
|
|
|
|
2017-05-02 12:32:26 +00:00
|
|
|
static int testctx_eq(SSL_TEST_CTX *ctx, SSL_TEST_CTX *ctx2)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
2017-05-02 12:32:26 +00:00
|
|
|
if (!TEST_int_eq(ctx->method, ctx2->method)
|
|
|
|
|| !TEST_int_eq(ctx->handshake_mode, ctx2->handshake_mode)
|
|
|
|
|| !TEST_int_eq(ctx->app_data_size, ctx2->app_data_size)
|
|
|
|
|| !TEST_int_eq(ctx->max_fragment_size, ctx2->max_fragment_size)
|
|
|
|
|| !extraconf_eq(&ctx->extra, &ctx2->extra)
|
|
|
|
|| !extraconf_eq(&ctx->resume_extra, &ctx2->resume_extra)
|
|
|
|
|| !TEST_int_eq(ctx->expected_result, ctx2->expected_result)
|
|
|
|
|| !TEST_int_eq(ctx->expected_client_alert,
|
|
|
|
ctx2->expected_client_alert)
|
|
|
|
|| !TEST_int_eq(ctx->expected_server_alert,
|
|
|
|
ctx2->expected_server_alert)
|
|
|
|
|| !TEST_int_eq(ctx->expected_protocol, ctx2->expected_protocol)
|
|
|
|
|| !TEST_int_eq(ctx->expected_servername, ctx2->expected_servername)
|
|
|
|
|| !TEST_int_eq(ctx->session_ticket_expected,
|
|
|
|
ctx2->session_ticket_expected)
|
|
|
|
|| !TEST_int_eq(ctx->compression_expected,
|
|
|
|
ctx2->compression_expected)
|
|
|
|
|| !TEST_str_eq(ctx->expected_npn_protocol,
|
|
|
|
ctx2->expected_npn_protocol)
|
|
|
|
|| !TEST_str_eq(ctx->expected_alpn_protocol,
|
|
|
|
ctx2->expected_alpn_protocol)
|
2015-12-21 20:19:29 +00:00
|
|
|
|| !TEST_str_eq(ctx->expected_cipher,
|
|
|
|
ctx2->expected_cipher)
|
2017-03-15 17:25:55 +00:00
|
|
|
|| !TEST_str_eq(ctx->expected_session_ticket_app_data,
|
|
|
|
ctx2->expected_session_ticket_app_data)
|
2017-05-02 12:32:26 +00:00
|
|
|
|| !TEST_int_eq(ctx->resumption_expected,
|
Session resume broken switching contexts
When an SSL's context is swtiched from a ticket-enabled context to
a ticket-disabled context in the servername callback, no session-id
is generated, so the session can't be resumed.
If a servername callback changes the SSL_OP_NO_TICKET option, check
to see if it's changed to disable, and whether a session ticket is
expected (i.e. the client indicated ticket support and the SSL had
tickets enabled at the time), and whether we already have a previous
session (i.e. s->hit is set).
In this case, clear the ticket-expected flag, remove any ticket data
and generate a session-id in the session.
If the SSL hit (resumed) and switched to a ticket-disabled context,
assume that the resumption was via session-id, and don't bother to
update the session.
Before this fix, the updated unit-tests in 06-sni-ticket.conf would
fail test #4 (server1 = SNI, server2 = no SNI).
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/1529)
2016-09-01 12:40:54 +00:00
|
|
|
ctx2->resumption_expected)
|
|
|
|
|| !TEST_int_eq(ctx->session_id_expected,
|
|
|
|
ctx2->session_id_expected))
|
2016-07-05 17:06:23 +00:00
|
|
|
return 0;
|
2016-03-17 14:14:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
static SSL_TEST_CTX_TEST_FIXTURE *set_up(const char *const test_case_name)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
2017-08-02 03:48:29 +00:00
|
|
|
SSL_TEST_CTX_TEST_FIXTURE *fixture;
|
|
|
|
|
|
|
|
if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture))))
|
|
|
|
return NULL;
|
|
|
|
fixture->test_case_name = test_case_name;
|
|
|
|
if (!TEST_ptr(fixture->expected_ctx = SSL_TEST_CTX_new())) {
|
|
|
|
OPENSSL_free(fixture);
|
|
|
|
return NULL;
|
|
|
|
}
|
2016-03-17 14:14:30 +00:00
|
|
|
return fixture;
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
static int execute_test(SSL_TEST_CTX_TEST_FIXTURE *fixture)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
2016-04-05 12:29:06 +00:00
|
|
|
int success = 0;
|
2017-05-02 12:32:26 +00:00
|
|
|
SSL_TEST_CTX *ctx;
|
2016-03-17 14:14:30 +00:00
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
if (!TEST_ptr(ctx = SSL_TEST_CTX_create(conf, fixture->test_section))
|
|
|
|
|| !testctx_eq(ctx, fixture->expected_ctx))
|
2016-03-17 14:14:30 +00:00
|
|
|
goto err;
|
|
|
|
|
2016-04-05 12:29:06 +00:00
|
|
|
success = 1;
|
2016-03-17 14:14:30 +00:00
|
|
|
err:
|
|
|
|
SSL_TEST_CTX_free(ctx);
|
2016-04-05 12:29:06 +00:00
|
|
|
return success;
|
2016-03-17 14:14:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
static void tear_down(SSL_TEST_CTX_TEST_FIXTURE *fixture)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
2017-08-02 03:48:29 +00:00
|
|
|
SSL_TEST_CTX_free(fixture->expected_ctx);
|
|
|
|
OPENSSL_free(fixture);
|
2016-03-17 14:14:30 +00:00
|
|
|
}
|
|
|
|
|
2017-05-02 12:32:26 +00:00
|
|
|
#define SETUP_SSL_TEST_CTX_TEST_FIXTURE() \
|
2017-08-04 00:49:38 +00:00
|
|
|
SETUP_TEST_FIXTURE(SSL_TEST_CTX_TEST_FIXTURE, set_up);
|
2017-05-02 12:32:26 +00:00
|
|
|
#define EXECUTE_SSL_TEST_CTX_TEST() \
|
2016-03-17 14:14:30 +00:00
|
|
|
EXECUTE_TEST(execute_test, tear_down)
|
|
|
|
|
2017-08-15 21:39:03 +00:00
|
|
|
static int test_empty_configuration(void)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
|
|
|
SETUP_SSL_TEST_CTX_TEST_FIXTURE();
|
2017-08-04 00:49:38 +00:00
|
|
|
if (fixture == NULL)
|
|
|
|
return 0;
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->test_section = "ssltest_default";
|
|
|
|
fixture->expected_ctx->expected_result = SSL_TEST_SUCCESS;
|
2016-03-17 14:14:30 +00:00
|
|
|
EXECUTE_SSL_TEST_CTX_TEST();
|
2017-08-04 00:49:38 +00:00
|
|
|
return result;
|
2016-03-17 14:14:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-15 21:39:03 +00:00
|
|
|
static int test_good_configuration(void)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
|
|
|
SETUP_SSL_TEST_CTX_TEST_FIXTURE();
|
2017-08-04 00:49:38 +00:00
|
|
|
if (fixture == NULL)
|
|
|
|
return 0;
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->test_section = "ssltest_good";
|
|
|
|
fixture->expected_ctx->method = SSL_TEST_METHOD_DTLS;
|
|
|
|
fixture->expected_ctx->handshake_mode = SSL_TEST_HANDSHAKE_RESUME;
|
|
|
|
fixture->expected_ctx->app_data_size = 1024;
|
|
|
|
fixture->expected_ctx->max_fragment_size = 2048;
|
|
|
|
|
|
|
|
fixture->expected_ctx->expected_result = SSL_TEST_SERVER_FAIL;
|
|
|
|
fixture->expected_ctx->expected_client_alert = SSL_AD_UNKNOWN_CA;
|
|
|
|
fixture->expected_ctx->expected_server_alert = 0; /* No alert. */
|
|
|
|
fixture->expected_ctx->expected_protocol = TLS1_1_VERSION;
|
|
|
|
fixture->expected_ctx->expected_servername = SSL_TEST_SERVERNAME_SERVER2;
|
|
|
|
fixture->expected_ctx->session_ticket_expected = SSL_TEST_SESSION_TICKET_YES;
|
|
|
|
fixture->expected_ctx->compression_expected = SSL_TEST_COMPRESSION_NO;
|
Session resume broken switching contexts
When an SSL's context is swtiched from a ticket-enabled context to
a ticket-disabled context in the servername callback, no session-id
is generated, so the session can't be resumed.
If a servername callback changes the SSL_OP_NO_TICKET option, check
to see if it's changed to disable, and whether a session ticket is
expected (i.e. the client indicated ticket support and the SSL had
tickets enabled at the time), and whether we already have a previous
session (i.e. s->hit is set).
In this case, clear the ticket-expected flag, remove any ticket data
and generate a session-id in the session.
If the SSL hit (resumed) and switched to a ticket-disabled context,
assume that the resumption was via session-id, and don't bother to
update the session.
Before this fix, the updated unit-tests in 06-sni-ticket.conf would
fail test #4 (server1 = SNI, server2 = no SNI).
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/1529)
2016-09-01 12:40:54 +00:00
|
|
|
fixture->expected_ctx->session_id_expected = SSL_TEST_SESSION_ID_IGNORE;
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->expected_ctx->resumption_expected = 1;
|
|
|
|
|
|
|
|
fixture->expected_ctx->extra.client.verify_callback =
|
2016-07-21 14:29:48 +00:00
|
|
|
SSL_TEST_VERIFY_REJECT_ALL;
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->expected_ctx->extra.client.servername = SSL_TEST_SERVERNAME_SERVER2;
|
|
|
|
fixture->expected_ctx->extra.client.npn_protocols =
|
2016-07-21 14:29:48 +00:00
|
|
|
OPENSSL_strdup("foo,bar");
|
2017-08-02 03:48:29 +00:00
|
|
|
if (!TEST_ptr(fixture->expected_ctx->extra.client.npn_protocols))
|
2017-06-22 04:00:55 +00:00
|
|
|
goto err;
|
2017-11-05 16:46:48 +00:00
|
|
|
fixture->expected_ctx->extra.client.max_fragment_len_mode = 0;
|
2016-07-21 14:29:48 +00:00
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->expected_ctx->extra.server.servername_callback =
|
2016-07-21 14:29:48 +00:00
|
|
|
SSL_TEST_SERVERNAME_IGNORE_MISMATCH;
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->expected_ctx->extra.server.broken_session_ticket = 1;
|
2016-07-21 14:29:48 +00:00
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->expected_ctx->resume_extra.server2.alpn_protocols =
|
2016-07-21 14:29:48 +00:00
|
|
|
OPENSSL_strdup("baz");
|
2017-08-02 03:48:29 +00:00
|
|
|
if (!TEST_ptr(fixture->expected_ctx->resume_extra.server2.alpn_protocols))
|
2017-06-22 04:00:55 +00:00
|
|
|
goto err;
|
2016-07-21 14:29:48 +00:00
|
|
|
|
2017-08-02 03:48:29 +00:00
|
|
|
fixture->expected_ctx->resume_extra.client.ct_validation =
|
2016-08-09 14:47:26 +00:00
|
|
|
SSL_TEST_CT_VALIDATION_STRICT;
|
|
|
|
|
2016-03-17 14:14:30 +00:00
|
|
|
EXECUTE_SSL_TEST_CTX_TEST();
|
2017-08-04 00:49:38 +00:00
|
|
|
return result;
|
2017-06-22 04:00:55 +00:00
|
|
|
|
|
|
|
err:
|
|
|
|
tear_down(fixture);
|
|
|
|
return 0;
|
2016-03-17 14:14:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char *bad_configurations[] = {
|
|
|
|
"ssltest_unknown_option",
|
2016-08-09 12:55:33 +00:00
|
|
|
"ssltest_wrong_section",
|
2016-03-17 14:14:30 +00:00
|
|
|
"ssltest_unknown_expected_result",
|
|
|
|
"ssltest_unknown_alert",
|
|
|
|
"ssltest_unknown_protocol",
|
2016-04-07 17:07:50 +00:00
|
|
|
"ssltest_unknown_verify_callback",
|
Fix session ticket and SNI
When session tickets are used, it's possible that SNI might swtich the
SSL_CTX on an SSL. Normally, this is not a problem, because the
initial_ctx/session_ctx are used for all session ticket/id processes.
However, when the SNI callback occurs, it's possible that the callback
may update the options in the SSL from the SSL_CTX, and this could
cause SSL_OP_NO_TICKET to be set. If this occurs, then two bad things
can happen:
1. The session ticket TLSEXT may not be written when the ticket expected
flag is set. The state machine transistions to writing the ticket, and
the client responds with an error as its not expecting a ticket.
2. When creating the session ticket, if the ticket key cb returns 0
the crypto/hmac contexts are not initialized, and the code crashes when
trying to encrypt the session ticket.
To fix 1, if the ticket TLSEXT is not written out, clear the expected
ticket flag.
To fix 2, consider a return of 0 from the ticket key cb a recoverable
error, and write a 0 length ticket and continue. The client-side code
can explicitly handle this case.
Fix these two cases, and add unit test code to validate ticket behavior.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1098)
2016-05-12 22:16:52 +00:00
|
|
|
"ssltest_unknown_servername",
|
2016-06-20 15:20:25 +00:00
|
|
|
"ssltest_unknown_servername_callback",
|
Fix session ticket and SNI
When session tickets are used, it's possible that SNI might swtich the
SSL_CTX on an SSL. Normally, this is not a problem, because the
initial_ctx/session_ctx are used for all session ticket/id processes.
However, when the SNI callback occurs, it's possible that the callback
may update the options in the SSL from the SSL_CTX, and this could
cause SSL_OP_NO_TICKET to be set. If this occurs, then two bad things
can happen:
1. The session ticket TLSEXT may not be written when the ticket expected
flag is set. The state machine transistions to writing the ticket, and
the client responds with an error as its not expecting a ticket.
2. When creating the session ticket, if the ticket key cb returns 0
the crypto/hmac contexts are not initialized, and the code crashes when
trying to encrypt the session ticket.
To fix 1, if the ticket TLSEXT is not written out, clear the expected
ticket flag.
To fix 2, consider a return of 0 from the ticket key cb a recoverable
error, and write a 0 length ticket and continue. The client-side code
can explicitly handle this case.
Fix these two cases, and add unit test code to validate ticket behavior.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1098)
2016-05-12 22:16:52 +00:00
|
|
|
"ssltest_unknown_session_ticket_expected",
|
2017-03-01 12:11:51 +00:00
|
|
|
"ssltest_unknown_compression_expected",
|
Session resume broken switching contexts
When an SSL's context is swtiched from a ticket-enabled context to
a ticket-disabled context in the servername callback, no session-id
is generated, so the session can't be resumed.
If a servername callback changes the SSL_OP_NO_TICKET option, check
to see if it's changed to disable, and whether a session ticket is
expected (i.e. the client indicated ticket support and the SSL had
tickets enabled at the time), and whether we already have a previous
session (i.e. s->hit is set).
In this case, clear the ticket-expected flag, remove any ticket data
and generate a session-id in the session.
If the SSL hit (resumed) and switched to a ticket-disabled context,
assume that the resumption was via session-id, and don't bother to
update the session.
Before this fix, the updated unit-tests in 06-sni-ticket.conf would
fail test #4 (server1 = SNI, server2 = no SNI).
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/1529)
2016-09-01 12:40:54 +00:00
|
|
|
"ssltest_unknown_session_id_expected",
|
2016-06-03 15:49:04 +00:00
|
|
|
"ssltest_unknown_method",
|
2016-07-05 17:06:23 +00:00
|
|
|
"ssltest_unknown_handshake_mode",
|
|
|
|
"ssltest_unknown_resumption_expected",
|
2016-08-09 14:47:26 +00:00
|
|
|
"ssltest_unknown_ct_validation",
|
2017-11-05 16:46:48 +00:00
|
|
|
"ssltest_invalid_max_fragment_len",
|
2016-03-17 14:14:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int test_bad_configuration(int idx)
|
|
|
|
{
|
2017-05-02 12:32:26 +00:00
|
|
|
SSL_TEST_CTX *ctx;
|
2017-06-06 15:35:43 +00:00
|
|
|
|
2017-05-02 12:32:26 +00:00
|
|
|
if (!TEST_ptr_null(ctx = SSL_TEST_CTX_create(conf,
|
|
|
|
bad_configurations[idx]))) {
|
2016-11-04 15:06:12 +00:00
|
|
|
SSL_TEST_CTX_free(ctx);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2016-03-17 14:14:30 +00:00
|
|
|
}
|
|
|
|
|
2018-08-16 02:36:01 +00:00
|
|
|
OPT_TEST_DECLARE_USAGE("conf_file\n")
|
|
|
|
|
2017-07-18 01:48:27 +00:00
|
|
|
int setup_tests(void)
|
2016-03-17 14:14:30 +00:00
|
|
|
{
|
2017-07-18 01:48:27 +00:00
|
|
|
if (!TEST_ptr(conf = NCONF_new(NULL)))
|
|
|
|
return 0;
|
|
|
|
/* argument should point to test/ssl_test_ctx_test.conf */
|
2018-08-16 02:36:01 +00:00
|
|
|
if (!TEST_int_gt(NCONF_load(conf, test_get_argument(0), NULL), 0))
|
2017-07-18 01:48:27 +00:00
|
|
|
return 0;
|
2016-03-17 14:14:30 +00:00
|
|
|
|
|
|
|
ADD_TEST(test_empty_configuration);
|
|
|
|
ADD_TEST(test_good_configuration);
|
|
|
|
ADD_ALL_TESTS(test_bad_configuration, OSSL_NELEM(bad_configurations));
|
2017-07-18 01:48:27 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2016-03-17 14:14:30 +00:00
|
|
|
|
2017-07-18 01:48:27 +00:00
|
|
|
void cleanup_tests(void)
|
|
|
|
{
|
2016-03-17 14:14:30 +00:00
|
|
|
NCONF_free(conf);
|
|
|
|
}
|