-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssl: Revert checking of legacy schemes #8886
Open
IngelaAndin
wants to merge
1
commit into
erlang:maint
Choose a base branch
from
IngelaAndin:ingela/ssl/legacy-cert-sing/ERIERL-1137/OTP-19249
base: maint
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+153
−13
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,14 @@ | |
legacy_tls12_server_tls_client/1, | ||
tls13_client_tls11_server/0, | ||
tls13_client_tls11_server/1, | ||
tls12_legacy_cert_sign/0, | ||
tls12_legacy_cert_sign/1, | ||
tls13_legacy_cert_sign/0, | ||
tls13_legacy_cert_sign/1, | ||
tls13_legacy_cert_sign_with_pss_rsae/0, | ||
tls13_legacy_cert_sign_with_pss_rsae/1, | ||
tls12_legacy_cert_sign_with_pss_rsae/0, | ||
tls12_legacy_cert_sign_with_pss_rsae/1, | ||
middle_box_tls13_client/0, | ||
middle_box_tls13_client/1, | ||
middle_box_tls12_enabled_client/0, | ||
|
@@ -116,7 +124,11 @@ legacy_tests() -> | |
tls10_client_tls_server, | ||
tls11_client_tls_server, | ||
tls12_client_tls_server, | ||
tls13_client_tls11_server | ||
tls13_client_tls11_server, | ||
tls13_legacy_cert_sign, | ||
tls13_legacy_cert_sign_with_pss_rsae, | ||
tls12_legacy_cert_sign, | ||
tls12_legacy_cert_sign_with_pss_rsae | ||
]. | ||
|
||
init_per_suite(Config) -> | ||
|
@@ -342,6 +354,67 @@ legacy_tls12_server_tls_client(Config) when is_list(Config) -> | |
| ServerOpts0], | ||
ssl_test_lib:basic_test(ClientOpts, ServerOpts, Config). | ||
|
||
|
||
tls13_legacy_cert_sign() -> | ||
[{doc,"Test that a TLS 1.3 client can connect to TLS-1.3 server with pkcs1_SHA2 cert"}]. | ||
|
||
tls13_legacy_cert_sign(Config) when is_list(Config) -> | ||
ClientOpts = [{versions, ['tlsv1.3']}, | ||
{signature_algs, rsa_pss_rsae_algs() ++ legacy_rsa_algs()}], | ||
ServerOpts = [{versions, ['tlsv1.3']}, | ||
{signature_algs, rsa_pss_rsae_algs()}, | ||
{signature_algs_cert, legacy_rsa_algs()}], | ||
|
||
test_rsa_pcks1_cert(sha256, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha512, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha384, ClientOpts, ServerOpts, Config). | ||
|
||
tls13_legacy_cert_sign_with_pss_rsae() -> | ||
[{doc,"Test that a TLS 1.3 enabled client can connect to legacy TLS-1.2 server with legacy pkcs1_SHA2 cert"}]. | ||
|
||
tls13_legacy_cert_sign_with_pss_rsae(Config) when is_list(Config) -> | ||
ClientOpts = [{versions, ['tlsv1.3', 'tlsv1.2']}, | ||
{signature_algs, rsa_pss_rsae_algs()}, | ||
{signature_algs_cert, legacy_rsa_algs()} | ||
], | ||
ServerOpts = [{versions, ['tlsv1.2']}, | ||
{signature_algs, rsa_pss_rsae_algs()}, | ||
{signature_algs_cert, legacy_rsa_algs()} | ||
], | ||
|
||
test_rsa_pcks1_cert(sha256, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha512, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha384, ClientOpts, ServerOpts, Config). | ||
|
||
tls12_legacy_cert_sign() -> | ||
[{doc,"Test that a TLS 1.2 client (with old configuration) can connect to TLS-1.2 server with pkcs1_SHA2 cert"}]. | ||
|
||
tls12_legacy_cert_sign(Config) when is_list(Config) -> | ||
ClientOpts = [{versions, ['tlsv1.2']}, | ||
{signature_algs, rsa_algs()}], | ||
ServerOpts = [{versions, ['tlsv1.2']}, | ||
{signature_algs, rsa_algs()}], | ||
|
||
test_rsa_pcks1_cert(sha256, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha512, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha384, ClientOpts, ServerOpts, Config). | ||
|
||
tls12_legacy_cert_sign_with_pss_rsae() -> | ||
[{doc,"Test that a modern TLS 1.2 client can connect to TLS-1.2 server with legacy pkcs1_SHA2 cert"}]. | ||
|
||
tls12_legacy_cert_sign_with_pss_rsae(Config) when is_list(Config) -> | ||
ClientOpts = [{versions, ['tlsv1.2']}, | ||
{signature_algs, rsa_pss_rsae_algs() ++ rsa_algs()} | ||
], | ||
ServerOpts = [{versions, ['tlsv1.2']}, | ||
{signature_algs, rsa_pss_rsae_algs()}, | ||
{signature_algs_cert, legacy_rsa_algs()} | ||
], | ||
|
||
test_rsa_pcks1_cert(sha256, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha512, ClientOpts, ServerOpts, Config), | ||
test_rsa_pcks1_cert(sha384, ClientOpts, ServerOpts, Config). | ||
|
||
middle_box_tls13_client() -> | ||
[{doc,"Test that a TLS 1.3 client can connect to a 1.3 server with and without middle box compatible mode."}]. | ||
middle_box_tls13_client(Config) when is_list(Config) -> | ||
|
@@ -529,3 +602,42 @@ create_bad_client_certfile(NewClientCertFile, ClientOpts) -> | |
ClientOTPTbsCert = ClientOTPCert#'OTPCertificate'.tbsCertificate, | ||
NewClientDerCert = public_key:pkix_sign(ClientOTPTbsCert, Key), | ||
ssl_test_lib:der_to_pem(NewClientCertFile, [{'Certificate', NewClientDerCert, not_encrypted}]). | ||
|
||
test_rsa_pcks1_cert(SHA, COpts, SOpts, Config) -> | ||
#{client_config := ClientOpts, | ||
server_config := ServerOpts} = public_key:pkix_test_data(#{server_chain => #{root => root_key(SHA), | ||
intermediates => intermediates(SHA, 1), | ||
peer => peer_key(SHA)}, | ||
client_chain => #{root => root_key(SHA), | ||
intermediates => intermediates(SHA, 1), | ||
peer => peer_key(SHA)}}), | ||
ssl_test_lib:basic_test(COpts ++ ClientOpts, SOpts ++ ServerOpts, Config). | ||
|
||
root_key(SHA) -> | ||
%% As rsa keygen is not guaranteed to be fast | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what comment above relates to. |
||
[{digest, SHA},{key, ssl_test_lib:hardcode_rsa_key(6)}]. | ||
|
||
peer_key(SHA) -> | ||
%% As rsa keygen is not guaranteed to be fast | ||
[{digest, SHA}, {key, ssl_test_lib:hardcode_rsa_key(5)}]. | ||
|
||
intermediates(SHA, N) when N =< 2 -> | ||
Default = lists:duplicate(N, [{digest, SHA}]), | ||
%% As rsa keygen is not guaranteed to be fast | ||
hardcode_rsa_keys(Default, N, []). | ||
|
||
hardcode_rsa_keys([], 0, Acc) -> | ||
Acc; | ||
hardcode_rsa_keys([Head | Tail], N, Acc) -> | ||
hardcode_rsa_keys(Tail, N-1, [[{key, ssl_test_lib:hardcode_rsa_key(N)} | Head] | Acc]). | ||
|
||
|
||
rsa_algs() -> | ||
[{sha512, rsa}, {sha384, rsa}, {sha256, rsa}]. | ||
|
||
legacy_rsa_algs() -> | ||
[rsa_pkcs1_sha512,rsa_pkcs1_sha384,rsa_pkcs1_sha256]. | ||
|
||
rsa_pss_rsae_algs() -> | ||
[rsa_pss_rsae_sha512,rsa_pss_rsae_sha384,rsa_pss_rsae_sha256]. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we mark this change as potentially incompatible?