projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error in processing $target{enable}
[openssl.git]
/
test
/
cipherlist_test.c
diff --git
a/test/cipherlist_test.c
b/test/cipherlist_test.c
index f4d1b353e2764bb3634fe776d1571680e260791f..89ef1b1546b6033fc38b29aa156ef0ab46771762 100644
(file)
--- a/
test/cipherlist_test.c
+++ b/
test/cipherlist_test.c
@@
-1,7
+1,7
@@
/*
/*
- * Copyright 2016-201
7
The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-201
8
The OpenSSL Project Authors. All Rights Reserved.
*
*
- * Licensed under the
OpenSSL licenses,
(the "License");
+ * Licensed under the
Apache License 2.0
(the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
@@
-18,7
+18,7
@@
#include <openssl/ssl3.h>
#include <openssl/tls1.h>
#include <openssl/ssl3.h>
#include <openssl/tls1.h>
-#include "
e_os
.h"
+#include "
internal/nelem
.h"
#include "testutil.h"
typedef struct cipherlist_test_fixture {
#include "testutil.h"
typedef struct cipherlist_test_fixture {
@@
-34,21
+34,23
@@
static void tear_down(CIPHERLIST_TEST_FIXTURE *fixture)
SSL_CTX_free(fixture->server);
SSL_CTX_free(fixture->client);
fixture->server = fixture->client = NULL;
SSL_CTX_free(fixture->server);
SSL_CTX_free(fixture->client);
fixture->server = fixture->client = NULL;
+ OPENSSL_free(fixture);
}
}
static CIPHERLIST_TEST_FIXTURE *set_up(const char *const test_case_name)
{
}
}
static CIPHERLIST_TEST_FIXTURE *set_up(const char *const test_case_name)
{
-
static CIPHERLIST_TEST_FIXTURE
fixture;
+
CIPHERLIST_TEST_FIXTURE *
fixture;
- memset(&fixture, 0, sizeof(fixture));
- fixture.test_case_name = test_case_name;
- if (!TEST_ptr(fixture.server = SSL_CTX_new(TLS_server_method()))
- || !TEST_ptr(fixture.client = SSL_CTX_new(TLS_client_method()))) {
- tear_down(&fixture);
+ if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture))))
+ return NULL;
+ fixture->test_case_name = test_case_name;
+ if (!TEST_ptr(fixture->server = SSL_CTX_new(TLS_server_method()))
+ || !TEST_ptr(fixture->client = SSL_CTX_new(TLS_client_method()))) {
+ tear_down(fixture);
return NULL;
}
return NULL;
}
- return
&
fixture;
+ return fixture;
}
/*
}
/*
@@
-61,6
+63,13
@@
static CIPHERLIST_TEST_FIXTURE *set_up(const char *const test_case_name)
* are currently broken and should be considered mission impossible in libssl.
*/
static const uint32_t default_ciphers_in_order[] = {
* are currently broken and should be considered mission impossible in libssl.
*/
static const uint32_t default_ciphers_in_order[] = {
+#ifndef OPENSSL_NO_TLS1_3
+ TLS1_3_CK_AES_256_GCM_SHA384,
+# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
+ TLS1_3_CK_CHACHA20_POLY1305_SHA256,
+# endif
+ TLS1_3_CK_AES_128_GCM_SHA256,
+#endif
#ifndef OPENSSL_NO_TLS1_2
# ifndef OPENSSL_NO_EC
TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
#ifndef OPENSSL_NO_TLS1_2
# ifndef OPENSSL_NO_EC
TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
@@
-70,7
+79,7
@@
static const uint32_t default_ciphers_in_order[] = {
TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
# endif
TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
# endif
-# if !defined
OPENSSL_NO_CHACHA && !defined OPENSSL_NO_POLY1305
+# if !defined
(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
# ifndef OPENSSL_NO_EC
TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305,
# ifndef OPENSSL_NO_EC
TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305,
@@
-103,36
+112,37
@@
static const uint32_t default_ciphers_in_order[] = {
# endif
#endif /* !OPENSSL_NO_TLS1_2 */
# endif
#endif /* !OPENSSL_NO_TLS1_2 */
-#ifndef OPENSSL_NO_EC
+#if !defined(OPENSSL_NO_TLS1_2) || defined(OPENSSL_NO_TLS1_3)
+ /* These won't be usable if TLSv1.3 is available but TLSv1.2 isn't */
+# ifndef OPENSSL_NO_EC
TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
-#endif
-#ifndef OPENSSL_NO_DH
+#
endif
+
#ifndef OPENSSL_NO_DH
TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
-#endif
-#ifndef OPENSSL_NO_EC
+#
endif
+#
ifndef OPENSSL_NO_EC
TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
-#endif
-#ifndef OPENSSL_NO_DH
+#
endif
+#
ifndef OPENSSL_NO_DH
TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
-#endif
+# endif
+#endif /* !defined(OPENSSL_NO_TLS1_2) || defined(OPENSSL_NO_TLS1_3) */
#ifndef OPENSSL_NO_TLS1_2
TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
#endif
#ifndef OPENSSL_NO_TLS1_2
TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
#endif
-#ifndef OPENSSL_NO_TLS1_3
- TLS1_3_CK_AES_256_GCM_SHA384,
- TLS1_3_CK_CHACHA20_POLY1305_SHA256,
- TLS1_3_CK_AES_128_GCM_SHA256,
-#endif
#ifndef OPENSSL_NO_TLS1_2
TLS1_CK_RSA_WITH_AES_256_SHA256,
TLS1_CK_RSA_WITH_AES_128_SHA256,
#endif
#ifndef OPENSSL_NO_TLS1_2
TLS1_CK_RSA_WITH_AES_256_SHA256,
TLS1_CK_RSA_WITH_AES_128_SHA256,
#endif
+#if !defined(OPENSSL_NO_TLS1_2) || defined(OPENSSL_NO_TLS1_3)
+ /* These won't be usable if TLSv1.3 is available but TLSv1.2 isn't */
TLS1_CK_RSA_WITH_AES_256_SHA,
TLS1_CK_RSA_WITH_AES_128_SHA,
TLS1_CK_RSA_WITH_AES_256_SHA,
TLS1_CK_RSA_WITH_AES_128_SHA,
+#endif
};
static int test_default_cipherlist(SSL_CTX *ctx)
};
static int test_default_cipherlist(SSL_CTX *ctx)
@@
-179,18
+189,21
@@
static int execute_test(CIPHERLIST_TEST_FIXTURE *fixture)
}
#define SETUP_CIPHERLIST_TEST_FIXTURE() \
}
#define SETUP_CIPHERLIST_TEST_FIXTURE() \
- SETUP_TEST_FIXTURE(CIPHERLIST_TEST_FIXTURE
*
, set_up)
+ SETUP_TEST_FIXTURE(CIPHERLIST_TEST_FIXTURE, set_up)
#define EXECUTE_CIPHERLIST_TEST() \
EXECUTE_TEST(execute_test, tear_down)
#define EXECUTE_CIPHERLIST_TEST() \
EXECUTE_TEST(execute_test, tear_down)
-static int test_default_cipherlist_implicit()
+static int test_default_cipherlist_implicit(
void
)
{
SETUP_CIPHERLIST_TEST_FIXTURE();
{
SETUP_CIPHERLIST_TEST_FIXTURE();
+ if (fixture == NULL)
+ return 0;
EXECUTE_CIPHERLIST_TEST();
EXECUTE_CIPHERLIST_TEST();
+ return result;
}
}
-static int test_default_cipherlist_explicit()
+static int test_default_cipherlist_explicit(
void
)
{
SETUP_CIPHERLIST_TEST_FIXTURE();
if (fixture == NULL)
{
SETUP_CIPHERLIST_TEST_FIXTURE();
if (fixture == NULL)
@@
-199,10
+212,12
@@
static int test_default_cipherlist_explicit()
|| !TEST_true(SSL_CTX_set_cipher_list(fixture->client, "DEFAULT")))
tear_down(fixture);
EXECUTE_CIPHERLIST_TEST();
|| !TEST_true(SSL_CTX_set_cipher_list(fixture->client, "DEFAULT")))
tear_down(fixture);
EXECUTE_CIPHERLIST_TEST();
+ return result;
}
}
-
void register_tests(
)
+
int setup_tests(void
)
{
ADD_TEST(test_default_cipherlist_implicit);
ADD_TEST(test_default_cipherlist_explicit);
{
ADD_TEST(test_default_cipherlist_implicit);
ADD_TEST(test_default_cipherlist_explicit);
+ return 1;
}
}