Update pre9
This commit is contained in:
+19
-15
@@ -15,7 +15,7 @@ use OpenSSL::Test qw/:DEFAULT srctop_file/;
|
||||
|
||||
setup("test_req");
|
||||
|
||||
plan tests => 8;
|
||||
plan tests => 9;
|
||||
|
||||
require_ok(srctop_file('test','recipes','tconversion.pl'));
|
||||
|
||||
@@ -23,26 +23,30 @@ open RND, ">>", ".rnd";
|
||||
print RND "string to make the random number generator think it has randomness";
|
||||
close RND;
|
||||
|
||||
# Check for duplicate -addext parameters
|
||||
# What type of key to generate?
|
||||
my @req_new;
|
||||
if (disabled("rsa")) {
|
||||
@req_new = ("-newkey", "dsa:".srctop_file("apps", "dsa512.pem"));
|
||||
} else {
|
||||
@req_new = ("-new");
|
||||
note("There should be a 2 sequences of .'s and some +'s.");
|
||||
note("There should not be more that at most 80 per line");
|
||||
}
|
||||
|
||||
# Check for duplicate -addext parameters, and one "working" case.
|
||||
my @addext_args = ( "openssl", "req", "-new", "-out", "testreq.pem",
|
||||
"-config", srctop_file("test", "test.cnf"), @req_new );
|
||||
my $val = "subjectAltName=DNS:example.com";
|
||||
my $val2 = " " . $val;
|
||||
my $val3 = $val;
|
||||
$val3 =~ s/=/ =/;
|
||||
ok(!run(app(["openssl", "req", "-new", "-addext", $val, "-addext", $val])));
|
||||
ok(!run(app(["openssl", "req", "-new", "-addext", $val, "-addext", $val2])));
|
||||
ok(!run(app(["openssl", "req", "-new", "-addext", $val, "-addext", $val3])));
|
||||
ok(!run(app(["openssl", "req", "-new", "-addext", $val2, "-addext", $val3])));
|
||||
ok( run(app([@addext_args, "-addext", $val])));
|
||||
ok(!run(app([@addext_args, "-addext", $val, "-addext", $val])));
|
||||
ok(!run(app([@addext_args, "-addext", $val, "-addext", $val2])));
|
||||
ok(!run(app([@addext_args, "-addext", $val, "-addext", $val3])));
|
||||
ok(!run(app([@addext_args, "-addext", $val2, "-addext", $val3])));
|
||||
|
||||
subtest "generating certificate requests" => sub {
|
||||
my @req_new;
|
||||
if (disabled("rsa")) {
|
||||
@req_new = ("-newkey", "dsa:".srctop_file("apps", "dsa512.pem"));
|
||||
} else {
|
||||
@req_new = ("-new");
|
||||
note("There should be a 2 sequences of .'s and some +'s.");
|
||||
note("There should not be more that at most 80 per line");
|
||||
}
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
|
||||
|
||||
@@ -18436,3 +18436,41 @@ Ctrl = digest:SM3
|
||||
Input = D7AD397F6FFA5D4F7F11E7217F241607DC30618C236D2C09C1B9EA8FDADEE2E8
|
||||
Output = 3045022100f11bf36e75bb304f094fb42a4ca22377d0cc768637c5011cd59fb9ed4b130c98022035545ffe2c2efb3abee4fee661468946d886004fae8ea5311593e48f7fe21b91
|
||||
Result = KEYOP_MISMATCH
|
||||
|
||||
Title = Chosen Wycheproof vectors
|
||||
|
||||
PrivateKeyRaw = WychePRIVATE0:X25519:288796bc5aff4b81a37501757bc0753a3c21964790d38699308debc17a6eaf8d
|
||||
|
||||
PublicKeyRaw = WychePUBLIC0:X25519:f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f
|
||||
|
||||
Derive=WychePRIVATE0
|
||||
PeerKey=WychePUBLIC0
|
||||
SharedSecret=b4e0dd76da7b071728b61f856771aa356e57eda78a5b1655cc3820fb5f854c5c
|
||||
|
||||
PrivateKeyRaw = WychePRIVATE1:X25519:60887b3dc72443026ebedbbbb70665f42b87add1440e7768fbd7e8e2ce5f639d
|
||||
|
||||
PublicKeyRaw = WychePUBLIC1:X25519:f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
|
||||
Derive=WychePRIVATE1
|
||||
PeerKey=WychePUBLIC1
|
||||
SharedSecret=38d6304c4a7e6d9f7959334fb5245bd2c754525d4c91db950206926234c1f633
|
||||
|
||||
PrivateKeyRaw = WychePRIVATE2:X25519:a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63
|
||||
|
||||
PublicKeyRaw = WychePUBLIC2:X25519:0ab4e76380d84dde4f6833c58f2a9fb8f83bb0169b172be4b6e0592887741a36
|
||||
|
||||
Derive=WychePRIVATE2
|
||||
PeerKey=WychePUBLIC2
|
||||
SharedSecret=0200000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
PublicKeyRaw = WychePUBLIC3:X25519:89e10d5701b4337d2d032181538b1064bd4084401ceca1fd12663a1959388000
|
||||
|
||||
Derive=WychePRIVATE2
|
||||
PeerKey=WychePUBLIC3
|
||||
SharedSecret=0900000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
PublicKeyRaw = WychePUBLIC4:X25519:2b55d3aa4a8f80c8c0b2ae5f933e85af49beac36c2fa7394bab76c8933f8f81d
|
||||
|
||||
Derive=WychePRIVATE2
|
||||
PeerKey=WychePUBLIC4
|
||||
SharedSecret=1000000000000000000000000000000000000000000000000000000000000000
|
||||
@@ -53,12 +53,12 @@ use constant {
|
||||
|
||||
#Test 1: Default sig algs should succeed
|
||||
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
|
||||
plan tests => 21;
|
||||
plan tests => 22;
|
||||
ok(TLSProxy::Message->success, "Default sigalgs");
|
||||
my $testtype;
|
||||
|
||||
SKIP: {
|
||||
skip "TLSv1.3 disabled", 5 if disabled("tls1_3");
|
||||
skip "TLSv1.3 disabled", 6 if disabled("tls1_3");
|
||||
|
||||
$proxy->filter(\&sigalgs_filter);
|
||||
|
||||
@@ -94,12 +94,21 @@ SKIP: {
|
||||
$testtype = PSS_ONLY_SIG_ALGS;
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->success, "PSS only sigalgs in TLSv1.3");
|
||||
|
||||
#Test 7: Modify the CertificateVerify sigalg from rsa_pss_rsae_sha256 to
|
||||
# rsa_pss_pss_sha256. This should fail because the public key OID
|
||||
# in the certificate is rsaEncryption and not rsassaPss
|
||||
$proxy->filter(\&modify_cert_verify_sigalg);
|
||||
$proxy->clear();
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->fail,
|
||||
"Mismatch between CertVerify sigalg and public key OID");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "EC or TLSv1.3 disabled", 1
|
||||
if disabled("tls1_3") || disabled("ec");
|
||||
#Test 7: Sending a valid sig algs list but not including a sig type that
|
||||
#Test 8: Sending a valid sig algs list but not including a sig type that
|
||||
# matches the certificate should fail in TLSv1.3.
|
||||
$proxy->clear();
|
||||
$proxy->clientflags("-sigalgs ECDSA+SHA256");
|
||||
@@ -112,7 +121,7 @@ SKIP: {
|
||||
skip "EC, TLSv1.3 or TLSv1.2 disabled", 1
|
||||
if disabled("tls1_2") || disabled("tls1_3") || disabled("ec");
|
||||
|
||||
#Test 8: Sending a full list of TLSv1.3 sig algs but negotiating TLSv1.2
|
||||
#Test 9: Sending a full list of TLSv1.3 sig algs but negotiating TLSv1.2
|
||||
# should succeed
|
||||
$proxy->clear();
|
||||
$proxy->serverflags("-no_tls1_3");
|
||||
@@ -127,7 +136,7 @@ SKIP: {
|
||||
|
||||
$proxy->filter(\&sigalgs_filter);
|
||||
|
||||
#Test 9: Sending no sig algs extension in TLSv1.2 should succeed
|
||||
#Test 10: Sending no sig algs extension in TLSv1.2 should succeed
|
||||
$proxy->clear();
|
||||
$testtype = NO_SIG_ALGS_EXT;
|
||||
$proxy->clientflags("-no_tls1_3");
|
||||
@@ -135,7 +144,7 @@ SKIP: {
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->success, "No TLSv1.2 sigalgs");
|
||||
|
||||
#Test 10: Sending an empty sig algs extension in TLSv1.2 should fail
|
||||
#Test 11: Sending an empty sig algs extension in TLSv1.2 should fail
|
||||
$proxy->clear();
|
||||
$testtype = EMPTY_SIG_ALGS_EXT;
|
||||
$proxy->clientflags("-no_tls1_3");
|
||||
@@ -143,7 +152,7 @@ SKIP: {
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->fail, "Empty TLSv1.2 sigalgs");
|
||||
|
||||
#Test 11: Sending a list with no recognised sig algs in TLSv1.2 should fail
|
||||
#Test 12: Sending a list with no recognised sig algs in TLSv1.2 should fail
|
||||
$proxy->clear();
|
||||
$testtype = NO_KNOWN_SIG_ALGS;
|
||||
$proxy->clientflags("-no_tls1_3");
|
||||
@@ -151,7 +160,7 @@ SKIP: {
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->fail, "No known TLSv1.3 sigalgs");
|
||||
|
||||
#Test 12: Sending a sig algs list without pss for an RSA cert in TLSv1.2
|
||||
#Test 13: Sending a sig algs list without pss for an RSA cert in TLSv1.2
|
||||
# should succeed
|
||||
$proxy->clear();
|
||||
$testtype = NO_PSS_SIG_ALGS;
|
||||
@@ -160,7 +169,7 @@ SKIP: {
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->success, "No PSS TLSv1.2 sigalgs");
|
||||
|
||||
#Test 13: Sending only TLSv1.3 PSS sig algs in TLSv1.2 should succeed
|
||||
#Test 14: Sending only TLSv1.3 PSS sig algs in TLSv1.2 should succeed
|
||||
$proxy->clear();
|
||||
$testtype = PSS_ONLY_SIG_ALGS;
|
||||
$proxy->serverflags("-no_tls1_3");
|
||||
@@ -168,7 +177,7 @@ SKIP: {
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->success, "PSS only sigalgs in TLSv1.2");
|
||||
|
||||
#Test 14: Responding with a sig alg we did not send in TLSv1.2 should fail
|
||||
#Test 15: Responding with a sig alg we did not send in TLSv1.2 should fail
|
||||
# We send rsa_pkcs1_sha256 and respond with rsa_pss_rsae_sha256
|
||||
# TODO(TLS1.3): Add a similar test to the TLSv1.3 section above
|
||||
# when we have an API capable of configuring the TLSv1.3 sig algs
|
||||
@@ -179,7 +188,7 @@ SKIP: {
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->fail, "Sigalg we did not send in TLSv1.2");
|
||||
|
||||
#Test 15: Sending a valid sig algs list but not including a sig type that
|
||||
#Test 16: Sending a valid sig algs list but not including a sig type that
|
||||
# matches the certificate should fail in TLSv1.2
|
||||
$proxy->clear();
|
||||
$proxy->clientflags("-no_tls1_3 -sigalgs ECDSA+SHA256");
|
||||
@@ -189,7 +198,7 @@ SKIP: {
|
||||
ok(TLSProxy::Message->fail, "No matching TLSv1.2 sigalgs");
|
||||
$proxy->filter(\&sigalgs_filter);
|
||||
|
||||
#Test 16: No sig algs extension, ECDSA cert, TLSv1.2 should succeed
|
||||
#Test 17: No sig algs extension, ECDSA cert, TLSv1.2 should succeed
|
||||
$proxy->clear();
|
||||
$testtype = NO_SIG_ALGS_EXT;
|
||||
$proxy->clientflags("-no_tls1_3");
|
||||
@@ -205,7 +214,7 @@ SKIP: {
|
||||
my ($dsa_status, $sha1_status, $sha224_status);
|
||||
SKIP: {
|
||||
skip "TLSv1.3 disabled", 2 if disabled("tls1_3") || disabled("dsa");
|
||||
#Test 17: signature_algorithms with 1.3-only ClientHello
|
||||
#Test 18: signature_algorithms with 1.3-only ClientHello
|
||||
$testtype = PURE_SIGALGS;
|
||||
$dsa_status = $sha1_status = $sha224_status = 0;
|
||||
$proxy->clear();
|
||||
@@ -215,7 +224,7 @@ SKIP: {
|
||||
ok($dsa_status && $sha1_status && $sha224_status,
|
||||
"DSA/SHA2 sigalg sent for 1.3-only ClientHello");
|
||||
|
||||
#Test 18: signature_algorithms with backwards compatible ClientHello
|
||||
#Test 19: signature_algorithms with backwards compatible ClientHello
|
||||
SKIP: {
|
||||
skip "TLSv1.2 disabled", 1 if disabled("tls1_2");
|
||||
$testtype = COMPAT_SIGALGS;
|
||||
@@ -230,21 +239,21 @@ SKIP: {
|
||||
|
||||
SKIP: {
|
||||
skip "TLSv1.3 disabled", 3 if disabled("tls1_3");
|
||||
#Test 19: Insert signature_algorithms_cert that match normal sigalgs
|
||||
#Test 20: Insert signature_algorithms_cert that match normal sigalgs
|
||||
$testtype = SIGALGS_CERT_ALL;
|
||||
$proxy->clear();
|
||||
$proxy->filter(\&modify_sigalgs_cert_filter);
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->success, "sigalgs_cert in TLSv1.3");
|
||||
|
||||
#Test 19: Insert signature_algorithms_cert that forces PKCS#1 cert
|
||||
#Test 21: Insert signature_algorithms_cert that forces PKCS#1 cert
|
||||
$testtype = SIGALGS_CERT_PKCS;
|
||||
$proxy->clear();
|
||||
$proxy->filter(\&modify_sigalgs_cert_filter);
|
||||
$proxy->start();
|
||||
ok(TLSProxy::Message->success, "sigalgs_cert in TLSv1.3 with PKCS#1 cert");
|
||||
|
||||
#Test 19: Insert signature_algorithms_cert that fails
|
||||
#Test 22: Insert signature_algorithms_cert that fails
|
||||
$testtype = SIGALGS_CERT_INVALID;
|
||||
$proxy->clear();
|
||||
$proxy->filter(\&modify_sigalgs_cert_filter);
|
||||
@@ -380,3 +389,20 @@ sub modify_sigalgs_cert_filter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub modify_cert_verify_sigalg
|
||||
{
|
||||
my $proxy = shift;
|
||||
|
||||
# We're only interested in the CertificateVerify
|
||||
if ($proxy->flight != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach my $message (@{$proxy->message_list}) {
|
||||
if ($message->mt == TLSProxy::Message::MT_CERTIFICATE_VERIFY) {
|
||||
$message->sigalg(TLSProxy::Message::SIG_ALG_RSA_PSS_PSS_SHA256);
|
||||
$message->repack();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
# in the file LICENSE in the source distribution or at
|
||||
# https://www.openssl.org/source/license.html
|
||||
|
||||
use OpenSSL::Test::Utils;
|
||||
use OpenSSL::Test qw/:DEFAULT srctop_file/;
|
||||
|
||||
setup("test_gost");
|
||||
|
||||
# The GOST ciphers are dynamically loaded via the GOST engine, so we must be
|
||||
# able to support that. The engine also uses DSA and CMS symbols, so we skip
|
||||
# this test on no-dsa or no-cms.
|
||||
plan skip_all => "GOST support is disabled in this OpenSSL build"
|
||||
if disabled("gost") || disabled("engine") || disabled("dynamic-engine")
|
||||
|| disabled("dsa") || disabled("cms");
|
||||
|
||||
plan skip_all => "TLSv1.3 or TLSv1.2 are disabled in this OpenSSL build"
|
||||
if disabled("tls1_3") || disabled("tls1_2");
|
||||
|
||||
plan skip_all => "No test GOST engine found"
|
||||
if !$ENV{OPENSSL_GOST_ENGINE_SO};
|
||||
|
||||
plan tests => 1;
|
||||
|
||||
$ENV{OPENSSL_CONF} = srctop_file("test", "recipes", "90-test_gost_data",
|
||||
"gost.conf");
|
||||
|
||||
ok(run(test(["gosttest",
|
||||
srctop_file("test", "recipes", "90-test_gost_data",
|
||||
"server-cert2001.pem"),
|
||||
srctop_file("test", "recipes", "90-test_gost_data",
|
||||
"server-key2001.pem"),
|
||||
srctop_file("test", "recipes", "90-test_gost_data",
|
||||
"server-cert2012.pem"),
|
||||
srctop_file("test", "recipes", "90-test_gost_data",
|
||||
"server-key2012.pem")])),
|
||||
"running gosttest");
|
||||
@@ -0,0 +1,13 @@
|
||||
openssl_conf = openssl_def
|
||||
[openssl_def]
|
||||
engines = engine_section
|
||||
|
||||
[engine_section]
|
||||
gost = gost_section
|
||||
|
||||
[gost_section]
|
||||
engine_id = gost
|
||||
dynamic_path = $ENV::OPENSSL_GOST_ENGINE_SO
|
||||
default_algorithms = ALL
|
||||
CRYPT_PARAMS = id-Gost28147-89-CryptoPro-A-ParamSet
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB4jCCAY+gAwIBAgIUNKO10+LkPoYGkOqNJ2wv1YI8RpQwCgYGKoUDAgIDBQAw
|
||||
RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu
|
||||
dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0xODA3MTMxNTAzMDFaFw0yODA3MTAx
|
||||
NTAzMDFaME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plQ3nHf1A+7ayjYw9B1X0wHwYDVR0jBBgwFoAUFZtRh6plQ3nH
|
||||
f1A+7ayjYw9B1X0wDwYDVR0TAQH/BAUwAwEB/zAMBggqhQMHAQEDAgUAA0EAMttA
|
||||
fMPa3YFO9db/xIS9wMB7ntbtibeZEJlngaPu5gvfdNmCY0uzjY2c3yPr9dDq84j7
|
||||
gSqY1VwVBLuKrpLC+w==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,4 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MEMCAQAwHAYGKoUDAgITMBIGByqFAwICIwEGByqFAwICHgEEIJgoLqJR/05zND0f
|
||||
8Wnma1MFMxE7ezisZhkS/DL4DXb6
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,4 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MEYCAQAwHwYIKoUDBwEBAQEwEwYHKoUDAgIjAQYIKoUDBwEBAgIEILemtIak5CeX
|
||||
Jd75HfVqAMi1MfhxW7kGvGDj8l1/nF45
|
||||
-----END PRIVATE KEY-----
|
||||
Reference in New Issue
Block a user