Update pre10

This commit is contained in:
2018-08-23 00:44:44 +09:00
parent ef69dcb649
commit 6ed909873d
55 changed files with 818 additions and 394 deletions
+61 -38
View File
@@ -74,6 +74,27 @@ static int find_key(EVP_PKEY **ppk, const char *name, KEY_LIST *lst);
static int parse_bin(const char *value, unsigned char **buf, size_t *buflen);
/*
* Compare two memory regions for equality, returning zero if they differ.
* However, if there is expected to be an error and the actual error
* matches then the memory is expected to be different so handle this
* case without producing unnecessary test framework output.
*/
static int memory_err_compare(EVP_TEST *t, const char *err,
const void *expected, size_t expected_len,
const void *got, size_t got_len)
{
int r;
if (t->expected_err != NULL && strcmp(t->expected_err, err) == 0)
r = !TEST_mem_ne(expected, expected_len, got, got_len);
else
r = TEST_mem_eq(expected, expected_len, got, got_len);
if (!r)
t->err = err;
return r;
}
/*
* Structure used to hold a list of blocks of memory to test
* calls to "update" like functions.
@@ -397,10 +418,11 @@ static int digest_test_run(EVP_TEST *t)
t->err = "DIGEST_LENGTH_MISMATCH";
goto err;
}
if (!TEST_mem_eq(expected->output, expected->output_len, got, got_len)) {
t->err = "DIGEST_MISMATCH";
if (!memory_err_compare(t, "DIGEST_MISMATCH",
expected->output, expected->output_len,
got, got_len))
goto err;
}
t->err = NULL;
err:
@@ -688,11 +710,9 @@ static int cipher_test_enc(EVP_TEST *t, int enc,
t->err = "CIPHERFINAL_ERROR";
goto err;
}
if (!TEST_mem_eq(expected_out, out_len,
tmp + out_misalign, tmplen + tmpflen)) {
t->err = "VALUE_MISMATCH";
if (!memory_err_compare(t, "VALUE_MISMATCH", expected_out, out_len,
tmp + out_misalign, tmplen + tmpflen))
goto err;
}
if (enc && expected->aead) {
unsigned char rtag[16];
@@ -705,11 +725,10 @@ static int cipher_test_enc(EVP_TEST *t, int enc,
t->err = "TAG_RETRIEVE_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->tag, expected->tag_len,
rtag, expected->tag_len)) {
t->err = "TAG_VALUE_MISMATCH";
if (!memory_err_compare(t, "TAG_VALUE_MISMATCH",
expected->tag, expected->tag_len,
rtag, expected->tag_len))
goto err;
}
}
t->err = NULL;
ok = 1;
@@ -950,8 +969,9 @@ static int mac_test_run(EVP_TEST *t)
goto err;
}
if (!EVP_DigestSignFinal(mctx, got, &got_len)
|| !TEST_mem_eq(expected->output, expected->output_len,
got, got_len)) {
|| !memory_err_compare(t, "TEST_MAC_ERR",
expected->output, expected->output_len,
got, got_len)) {
t->err = "TEST_MAC_ERR";
goto err;
}
@@ -1108,10 +1128,11 @@ static int pkey_test_run(EVP_TEST *t)
t->err = "KEYOP_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->output, expected->output_len, got, got_len)) {
t->err = "KEYOP_MISMATCH";
if (!memory_err_compare(t, "KEYOP_MISMATCH",
expected->output, expected->output_len,
got, got_len))
goto err;
}
t->err = NULL;
err:
OPENSSL_free(got);
@@ -1226,10 +1247,10 @@ static int pderive_test_run(EVP_TEST *t)
t->err = "DERIVE_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->output, expected->output_len, got, got_len)) {
t->err = "SHARED_SECRET_MISMATCH";
if (!memory_err_compare(t, "SHARED_SECRET_MISMATCH",
expected->output, expected->output_len,
got, got_len))
goto err;
}
t->err = NULL;
err:
@@ -1444,11 +1465,10 @@ static int pbe_test_run(EVP_TEST *t)
goto err;
}
}
if (!TEST_mem_eq(expected->key, expected->key_len,
key, expected->key_len)) {
t->err = "KEY_MISMATCH";
if (!memory_err_compare(t, "KEY_MISMATCH", expected->key, expected->key_len,
key, expected->key_len))
goto err;
}
t->err = NULL;
err:
OPENSSL_free(key);
@@ -1559,11 +1579,10 @@ static int encode_test_run(EVP_TEST *t)
EVP_ENCODE_CTX_free(encode_ctx);
if (!TEST_mem_eq(expected->output, expected->output_len,
encode_out, output_len)) {
t->err = "BAD_ENCODING";
if (!memory_err_compare(t, "BAD_ENCODING",
expected->output, expected->output_len,
encode_out, output_len))
goto err;
}
}
if (!TEST_ptr(decode_out =
@@ -1585,8 +1604,9 @@ static int encode_test_run(EVP_TEST *t)
output_len += chunk_len;
if (expected->encoding != BASE64_INVALID_ENCODING
&& !TEST_mem_eq(expected->input, expected->input_len,
decode_out, output_len)) {
&& !memory_err_compare(t, "BAD_DECODING",
expected->input, expected->input_len,
decode_out, output_len)) {
t->err = "BAD_DECODING";
goto err;
}
@@ -1687,10 +1707,11 @@ static int kdf_test_run(EVP_TEST *t)
t->err = "KDF_DERIVE_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->output, expected->output_len, got, got_len)) {
t->err = "KDF_MISMATCH";
if (!memory_err_compare(t, "KDF_MISMATCH",
expected->output, expected->output_len,
got, got_len))
goto err;
}
t->err = NULL;
err:
@@ -2079,11 +2100,12 @@ static int digestsign_test_run(EVP_TEST *t)
t->err = "DIGESTSIGNFINAL_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->output, expected->output_len, got, got_len)) {
t->err = "SIGNATURE_MISMATCH";
if (!memory_err_compare(t, "SIGNATURE_MISMATCH",
expected->output, expected->output_len,
got, got_len))
goto err;
}
t->err = NULL;
err:
OPENSSL_free(got);
return 1;
@@ -2156,11 +2178,12 @@ static int oneshot_digestsign_test_run(EVP_TEST *t)
t->err = "DIGESTSIGN_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->output, expected->output_len, got, got_len)) {
t->err = "SIGNATURE_MISMATCH";
if (!memory_err_compare(t, "SIGNATURE_MISMATCH",
expected->output, expected->output_len,
got, got_len))
goto err;
}
t->err = NULL;
err:
OPENSSL_free(got);
return 1;
+2 -2
View File
@@ -726,8 +726,8 @@ static void configure_handshake_ssl(SSL *server, SSL *client,
if (extra->client.servername != SSL_TEST_SERVERNAME_NONE)
SSL_set_tlsext_host_name(client,
ssl_servername_name(extra->client.servername));
if (extra->client.force_pha)
SSL_force_post_handshake_auth(client);
if (extra->client.enable_pha)
SSL_set_post_handshake_auth(client, 1);
}
/* The status for each connection phase. */
+6 -1
View File
@@ -248,7 +248,12 @@
"DTLS-Retransmit-Server-12":"Test failure - reason unknown",
"DTLS-Retransmit-Fudge":"Test failure - reason unknown",
"DTLS-Retransmit-Fragmented":"Test failure - reason unknown",
"TrailingMessageData-ClientHello-DTLS":"Test failure - reason unknown"
"TrailingMessageData-ClientHello-DTLS":"Test failure - reason unknown",
"SendFallbackSCSV":"Current runner version uses old draft TLSv1.3",
"VersionNegotiationExtension-TLS11":"Current runner version uses old draft TLSv1.3",
"VersionNegotiationExtension-TLS1":"Current runner version uses old draft TLSv1.3",
"VersionNegotiationExtension-SSL3":"Current runner version uses old draft TLSv1.3",
"ConflictingVersionNegotiation":"Current runner version uses old draft TLSv1.3"
},
"ErrorMap" : {
":UNEXPECTED_MESSAGE:":"unexpected message",
+1 -1
View File
@@ -19,7 +19,7 @@
# -K 000102030405060708090A0B0C0D0E0F1011121314151617 -iv 0001020304050607 |
# xxd -ps -u
Title = DES Tests (varous sources)
Title = DES Tests (various sources)
Cipher = DES-EDE3-CFB1
Key = 000102030405060708090A0B0C0D0E0F1011121314151617
+1 -1
View File
@@ -17287,7 +17287,7 @@ PeerKey=BOB_cf_sect283k1_PUB
Ctrl=ecdh_cofactor_mode:1
Result = DERIVE_ERROR
Title = Test keypair mistmatches
Title = Test keypair mismatches
PrivPubKeyPair = Alice-25519:Bob-25519-PUBLIC
Result = KEYPAIR_MISMATCH
@@ -4364,3 +4364,240 @@ PeerKey=ALICE_cf_wap-wsg-idm-ecid-wtls9_PUB
SharedSecret=948d3030e95cead39a1bb3d8a01c2be178517ba7
# tests: 484
Title=zero x-coord regression tests
PrivateKey=ALICE_zero_prime192v1
-----BEGIN PRIVATE KEY-----
MDkCAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQEEHzAdAgEBBBhaPNk8jG5hSG6y8tUqUoOaNNsZ3APU
pps=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime192v1_PUB
-----BEGIN PUBLIC KEY-----
MEkwEwYHKoZIzj0CAQYIKoZIzj0DAQEDMgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAe2hWBe5g
DLNj216pEvK7XjoKLg5gNg8S
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime192v1
PeerKey=BOB_zero_prime192v1_PUB
SharedSecret=baaffd49a8399d2ad52cbbe24d47b67afb4b3cf436f1cd65
PrivateKey=ALICE_zero_prime192v2
-----BEGIN PRIVATE KEY-----
MDkCAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQIEHzAdAgEBBBj1AIQMJ7jqYIKCvxYAS+qKMmKmH0to
41k=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime192v2_PUB
-----BEGIN PUBLIC KEY-----
MEkwEwYHKoZIzj0CAQYIKoZIzj0DAQIDMgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4Gj7Qqt
2wx/jwFlKgvE4rnd50LspdMk
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime192v2
PeerKey=BOB_zero_prime192v2_PUB
SharedSecret=b8f200a4b87064f2e8600685ca3e69b8e661a117aabc770b
PrivateKey=ALICE_zero_prime192v3
-----BEGIN PRIVATE KEY-----
MDkCAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQMEHzAdAgEBBBh/maLQMSlea9BfLqGy5NPuK0YAH/cz
GqI=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime192v3_PUB
-----BEGIN PUBLIC KEY-----
MEkwEwYHKoZIzj0CAQYIKoZIzj0DAQMDMgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZEzb63e2
3MKatRLR9Y1M5JEdI9jwMocI
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime192v3
PeerKey=BOB_zero_prime192v3_PUB
SharedSecret=b5de857d355bc5b9e270a4c290ea9728d764d8b243ff5d8d
PrivateKey=ALICE_zero_prime239v1
-----BEGIN PRIVATE KEY-----
MD8CAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQQEJTAjAgEBBB5pYWzRYI+c6O7NXCt0H2kw8XRL3rhe
4MrJT8j++CI=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime239v1_PUB
-----BEGIN PUBLIC KEY-----
MFUwEwYHKoZIzj0CAQYIKoZIzj0DAQQDPgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Ox02uwNNLFuvDRn5ip8TxvW0W22R7UzJa9Av6/nh
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime239v1
PeerKey=BOB_zero_prime239v1_PUB
SharedSecret=6b6206408bd05d42daa2cd224c401a1230b44e184f17b82f385f22dac215
PrivateKey=ALICE_zero_prime239v2
-----BEGIN PRIVATE KEY-----
MD8CAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQUEJTAjAgEBBB5l8bB7Cpmr7vyx9FiOT2wEF3YOFbDG
bmRr3Vi/xr4=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime239v2_PUB
-----BEGIN PUBLIC KEY-----
MFUwEwYHKoZIzj0CAQYIKoZIzj0DAQUDPgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
IOg3VJGQ89d1GWg4Igxcj5xpDmJiP8tv+e4mxt5U
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime239v2
PeerKey=BOB_zero_prime239v2_PUB
SharedSecret=772c2819c960c78f28f21f6542b7409294fad1f84567c44c4b7678dc0e42
PrivateKey=ALICE_zero_prime239v3
-----BEGIN PRIVATE KEY-----
MD8CAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQYEJTAjAgEBBB5HF5FABzUOTYMZg9UdZTx/oRERm/fU
M/+otKzpLjA=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime239v3_PUB
-----BEGIN PUBLIC KEY-----
MFUwEwYHKoZIzj0CAQYIKoZIzj0DAQYDPgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AsZ4u6r3qQI78EYBpiSgWjqNpoeShjr5piecMBWj
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime239v3
PeerKey=BOB_zero_prime239v3_PUB
SharedSecret=56a71f5dd1611e8032c3e2d8224d86e5e8c2fc6480d74c0e282282decd43
PrivateKey=ALICE_zero_prime256v1
-----BEGIN PRIVATE KEY-----
MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCDXhMb6aR4JR2+l2tmgYqP0r8S4jtym
yH++awvF2nGhhg==
-----END PRIVATE KEY-----
PublicKey=BOB_zero_prime256v1_PUB
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AABmSFx4Di+D1yQzvV2EoGu2VBwq8x2uhxcov4VqF0+T9A==
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_prime256v1
PeerKey=BOB_zero_prime256v1_PUB
SharedSecret=c4f5607deb8501f1a4ba23fce4122a4343a17ada2c86a9c8e0d03d92d4a4c84c
PrivateKey=ALICE_zero_secp112r2
-----BEGIN PRIVATE KEY-----
MCwCAQAwEAYHKoZIzj0CAQYFK4EEAAcEFTATAgEBBA4hh3tRkG3tnA0496ffMw==
-----END PRIVATE KEY-----
PublicKey=BOB_zero_secp112r2_PUB
-----BEGIN PUBLIC KEY-----
MDIwEAYHKoZIzj0CAQYFK4EEAAcDHgAEAAAAAAAAAAAAAAAAAAAS5eEOWDV/Wk7w4djyDQ==
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_secp112r2
PeerKey=BOB_zero_secp112r2_PUB
SharedSecret=958cc1cb425713678830a4d7d95e
PrivateKey=ALICE_zero_secp128r1
-----BEGIN PRIVATE KEY-----
MC4CAQAwEAYHKoZIzj0CAQYFK4EEABwEFzAVAgEBBBCykSzic/h3T2K6SkSP1SGt
-----END PRIVATE KEY-----
PublicKey=BOB_zero_secp128r1_PUB
-----BEGIN PUBLIC KEY-----
MDYwEAYHKoZIzj0CAQYFK4EEABwDIgAEAAAAAAAAAAAAAAAAAAAAAABya8M5aeOpNG3z799IdHc=
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_secp128r1
PeerKey=BOB_zero_secp128r1_PUB
SharedSecret=5235d452066f126cd7e99eea00fd3068
PrivateKey=ALICE_zero_secp160r1
-----BEGIN PRIVATE KEY-----
MDMCAQAwEAYHKoZIzj0CAQYFK4EEAAgEHDAaAgEBBBUACoRnbig69XLlh5VcRexpbbn5zwA=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_secp160r1_PUB
-----BEGIN PUBLIC KEY-----
MD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAG/w1po29wYlxlygXs
MGfbiGg5ng==
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_secp160r1
PeerKey=BOB_zero_secp160r1_PUB
SharedSecret=9ccd0ab8d093b6acdb3fe14c3736a0dfe61a4666
PrivateKey=ALICE_zero_secp160r2
-----BEGIN PRIVATE KEY-----
MDMCAQAwEAYHKoZIzj0CAQYFK4EEAB4EHDAaAgEBBBUAQFGxInSw1eAvd45E9TUdbXtJGnA=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_secp160r2_PUB
-----BEGIN PUBLIC KEY-----
MD4wEAYHKoZIzj0CAQYFK4EEAB4DKgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAZtSBSZqfmXp47v5z2
ZZZl2JFxDg==
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_secp160r2
PeerKey=BOB_zero_secp160r2_PUB
SharedSecret=303e0a282ac86f463fe834cb51b0057be42ed5ab
PrivateKey=ALICE_zero_secp384r1
-----BEGIN PRIVATE KEY-----
ME4CAQAwEAYHKoZIzj0CAQYFK4EEACIENzA1AgEBBDD6kgzKbg28zbQyVTdC0IdHbm0UCQt2Rdbi
VVHJeYRSnNpFOiFLaOsGOmwoeZzj6jc=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_secp384r1_PUB
-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAPPme8E9RpepjC6P5+WDdWToUyb45/SvSFdO0sIqq+Gu/kn8sRuUqsG+3
QriFDlIe
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_secp384r1
PeerKey=BOB_zero_secp384r1_PUB
SharedSecret=b1cfeaeef51dfd487d3a8b2849f1592e04d63f2d2c88b310a6290ebfe5399f5ffe954eabd0619231393e56c35b242986
PrivateKey=ALICE_zero_secp521r1
-----BEGIN PRIVATE KEY-----
MGACAQAwEAYHKoZIzj0CAQYFK4EEACMESTBHAgEBBEIAbddDLMUWbAsY7l3vbNDmntXuAUcDYPg5
w/cgUwSCIvrV9MBeSG8AWqT16riHmHlsn+XI5PAJM6eij3JDahnu9Mo=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_secp521r1_PUB
-----BEGIN PUBLIC KEY-----
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0g7J/qa1d8ENJsobtEb0CymeZIsa
1Qiq0GiJb+4/jmFLxjBU1Xcr8Bpl1BLgvKqOll0vXTMtfzn4RtRArgAfT4c=
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_secp521r1
PeerKey=BOB_zero_secp521r1_PUB
SharedSecret=003fc3028f61db94b20c7cd177923b6e73f12f0ab067c9ce8866755e3c82abb39c9863cde74fa80b32520bd7dd0eb156c30c08911503b67b2661f1264d09bb231423
PrivateKey=ALICE_zero_wap-wsg-idm-ecid-wtls7
-----BEGIN PRIVATE KEY-----
MDMCAQAwEAYHKoZIzj0CAQYFZysBBAcEHDAaAgEBBBUAoGng7WzYr4P9vtdc3BS/UiNWmc0=
-----END PRIVATE KEY-----
PublicKey=BOB_zero_wap-wsg-idm-ecid-wtls7_PUB
-----BEGIN PUBLIC KEY-----
MD4wEAYHKoZIzj0CAQYFZysBBAcDKgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAZtSBSZqfmXp47v5z2
ZZZl2JFxDg==
-----END PUBLIC KEY-----
# ECDH Alice with Bob peer
Derive=ALICE_zero_wap-wsg-idm-ecid-wtls7
PeerKey=BOB_zero_wap-wsg-idm-ecid-wtls7_PUB
SharedSecret=6582fc03bbb340fcf24a5fe8fcdf722655efa8b9
# tests: 14
+18 -1
View File
@@ -45,7 +45,7 @@ use constant {
$proxy->filter(\&downgrade_filter);
my $testtype = DOWNGRADE_TO_TLS_1_2;
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
plan tests => 4;
plan tests => 6;
ok(TLSProxy::Message->fail(), "Downgrade TLSv1.3 to TLSv1.2");
#Test 2: Downgrade from TLSv1.3 to TLSv1.1
@@ -73,6 +73,23 @@ ok(TLSProxy::Message->fail()
&& $alert->description() == TLSProxy::Message::AL_DESC_ILLEGAL_PARAMETER,
"Fallback from TLSv1.3");
SKIP: {
skip "TLSv1.1 disabled", 2 if disabled("tls1_1");
#Test 5: A client side protocol "hole" should not be detected as a downgrade
$proxy->clear();
$proxy->filter(undef);
$proxy->clientflags("-no_tls1_2");
$proxy->start();
ok(TLSProxy::Message->success(), "TLSv1.2 client-side protocol hole");
#Test 6: A server side protocol "hole" should not be detected as a downgrade
$proxy->clear();
$proxy->filter(undef);
$proxy->serverflags("-no_tls1_2");
$proxy->start();
ok(TLSProxy::Message->success(), "TLSv1.2 server-side protocol hole");
}
sub downgrade_filter
{
my $proxy = shift;
+1 -1
View File
@@ -214,7 +214,7 @@ SKIP: {
#Test 6: A client auth handshake
$proxy->clear();
$proxy->clientflags("-cert ".srctop_file("apps", "server.pem"));
$proxy->clientflags("-enable_pha -cert ".srctop_file("apps", "server.pem"));
$proxy->serverflags("-Verify 5");
$proxy->start();
checkhandshake($proxy, checkhandshake::CLIENT_AUTH_HANDSHAKE,
+44
View File
@@ -129,8 +129,52 @@ static int test_sec_mem(void)
#endif
}
static int test_sec_mem_clear(void)
{
#if defined(OPENSSL_SYS_LINUX) || defined(OPENSSL_SYS_UNIX)
const int size = 64;
unsigned char *p = NULL;
int i, res = 0;
if (!TEST_true(CRYPTO_secure_malloc_init(4096, 32))
|| !TEST_ptr(p = OPENSSL_secure_malloc(size)))
goto err;
for (i = 0; i < size; i++)
if (!TEST_uchar_eq(p[i], 0))
goto err;
for (i = 0; i < size; i++)
p[i] = (unsigned char)(i + ' ' + 1);
OPENSSL_secure_free(p);
/*
* A deliberate use after free here to verify that the memory has been
* cleared properly. Since secure free doesn't return the memory to
* libc's memory pool, it technically isn't freed. However, the header
* bytes have to be skipped and these consist of two pointers in the
* current implementation.
*/
for (i = sizeof(void *) * 2; i < size; i++)
if (!TEST_uchar_eq(p[i], 0))
return 0;
res = 1;
p = NULL;
err:
OPENSSL_secure_free(p);
CRYPTO_secure_malloc_done();
return res;
#else
return 1;
#endif
}
int setup_tests(void)
{
ADD_TEST(test_sec_mem);
ADD_TEST(test_sec_mem_clear);
return 1;
}
+14 -2
View File
@@ -299,6 +299,10 @@ ExpectedClientSignHash = SHA256
ExpectedClientSignType = RSA-PSS
ExpectedResult = Success
HandshakeMode = PostHandshakeAuth
client = 8-client-auth-TLSv1.3-require-post-handshake-client-extra
[8-client-auth-TLSv1.3-require-post-handshake-client-extra]
EnablePHA = Yes
# ===========================================================
@@ -337,6 +341,10 @@ ExpectedClientSignHash = SHA256
ExpectedClientSignType = RSA-PSS
ExpectedResult = Success
HandshakeMode = PostHandshakeAuth
client = 9-client-auth-TLSv1.3-require-non-empty-names-post-handshake-client-extra
[9-client-auth-TLSv1.3-require-non-empty-names-post-handshake-client-extra]
EnablePHA = Yes
# ===========================================================
@@ -369,6 +377,10 @@ VerifyMode = Peer
ExpectedResult = ServerFail
ExpectedServerAlert = UnknownCA
HandshakeMode = PostHandshakeAuth
client = 10-client-auth-TLSv1.3-noroot-post-handshake-client-extra
[10-client-auth-TLSv1.3-noroot-post-handshake-client-extra]
EnablePHA = Yes
# ===========================================================
@@ -401,7 +413,7 @@ HandshakeMode = PostHandshakeAuth
client = 11-client-auth-TLSv1.3-request-force-client-post-handshake-client-extra
[11-client-auth-TLSv1.3-request-force-client-post-handshake-client-extra]
ForcePHA = Yes
EnablePHA = Yes
# ===========================================================
@@ -471,6 +483,6 @@ client = 13-client-auth-TLSv1.3-request-force-both-post-handshake-client-extra
ForcePHA = Yes
[13-client-auth-TLSv1.3-request-force-both-post-handshake-client-extra]
ForcePHA = Yes
EnablePHA = Yes
+21 -12
View File
@@ -176,6 +176,9 @@ our @tests = (
"MaxProtocol" => "TLSv1.3",
"Certificate" => test_pem("ee-client-chain.pem"),
"PrivateKey" => test_pem("ee-key.pem"),
extra => {
"EnablePHA" => "Yes",
},
},
test => {
"ExpectedResult" => "Success",
@@ -201,6 +204,9 @@ our @tests = (
"MaxProtocol" => "TLSv1.3",
"Certificate" => test_pem("ee-client-chain.pem"),
"PrivateKey" => test_pem("ee-key.pem"),
extra => {
"EnablePHA" => "Yes",
},
},
test => {
"ExpectedResult" => "Success",
@@ -223,6 +229,9 @@ our @tests = (
"MaxProtocol" => "TLSv1.3",
"Certificate" => test_pem("ee-client-chain.pem"),
"PrivateKey" => test_pem("ee-key.pem"),
extra => {
"EnablePHA" => "Yes",
},
},
test => {
"ExpectedResult" => "ServerFail",
@@ -240,9 +249,9 @@ our @tests = (
client => {
"MinProtocol" => "TLSv1.3",
"MaxProtocol" => "TLSv1.3",
extra => {
"ForcePHA" => "Yes",
},
extra => {
"EnablePHA" => "Yes",
},
},
test => {
"ExpectedResult" => "Success",
@@ -255,9 +264,9 @@ our @tests = (
"MinProtocol" => "TLSv1.3",
"MaxProtocol" => "TLSv1.3",
"VerifyMode" => "RequestPostHandshake",
extra => {
"ForcePHA" => "Yes",
},
extra => {
"ForcePHA" => "Yes",
},
},
client => {
"MinProtocol" => "TLSv1.3",
@@ -274,16 +283,16 @@ our @tests = (
"MinProtocol" => "TLSv1.3",
"MaxProtocol" => "TLSv1.3",
"VerifyMode" => "RequestPostHandshake",
extra => {
"ForcePHA" => "Yes",
},
extra => {
"ForcePHA" => "Yes",
},
},
client => {
"MinProtocol" => "TLSv1.3",
"MaxProtocol" => "TLSv1.3",
extra => {
"ForcePHA" => "Yes",
},
extra => {
"EnablePHA" => "Yes",
},
},
test => {
"ExpectedResult" => "Success",
+3 -3
View File
@@ -629,9 +629,9 @@ __owur static int parse_expected_client_ca_names(SSL_TEST_CTX *test_ctx,
IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CTX, test, expected_cipher)
/* Client and Server ForcePHA */
/* Client and Server PHA */
IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CLIENT_CONF, client, force_pha)
IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CLIENT_CONF, client, enable_pha)
IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_SERVER_CONF, server, force_pha)
/* Known test options and their corresponding parse methods. */
@@ -689,7 +689,7 @@ static const ssl_test_client_option ssl_test_client_options[] = {
{ "SRPUser", &parse_client_srp_user },
{ "SRPPassword", &parse_client_srp_password },
{ "MaxFragmentLenExt", &parse_max_fragment_len_mode },
{ "ForcePHA", &parse_client_force_pha },
{ "EnablePHA", &parse_client_enable_pha },
};
/* Nested server options. */
+2 -2
View File
@@ -108,8 +108,8 @@ typedef struct {
char *reneg_ciphers;
char *srp_user;
char *srp_password;
/* Forced PHA */
int force_pha;
/* PHA enabled */
int enable_pha;
} SSL_TEST_CLIENT_CONF;
typedef struct {
+3 -4
View File
@@ -1270,7 +1270,7 @@ static int check_resumption(int idx, SSL_CTX *sctx, SSL_CTX *cctx, int succ)
|| !TEST_true(SSL_set_session(clientssl, sesscache[i])))
goto end;
SSL_force_post_handshake_auth(clientssl);
SSL_set_post_handshake_auth(clientssl, 1);
if (!TEST_true(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_NONE)))
@@ -1377,7 +1377,7 @@ static int test_tickets(int stateful, int idx)
&clientssl, NULL, NULL)))
goto end;
SSL_force_post_handshake_auth(clientssl);
SSL_set_post_handshake_auth(clientssl, 1);
if (!TEST_true(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_NONE))
@@ -4331,13 +4331,12 @@ static int test_pha_key_update(void)
|| !TEST_true(SSL_CTX_set_max_proto_version(cctx, TLS1_3_VERSION)))
goto end;
SSL_CTX_set_post_handshake_auth(cctx, 1);
if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,
NULL, NULL)))
goto end;
SSL_force_post_handshake_auth(clientssl);
if (!TEST_true(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_NONE)))
goto end;