Skip to content

Commit ca384b8

Browse files
test_ssl_session.rb: test adjustments to work with AWS-LC
The SSL SESSION files we were originally testing against use DHE and SSLv3. AWS-LC happens to have no support for either and we have newer possible alternatives available, so I've updated the respective files to use ECDHE-RSA-AES256-SHA with TLS 1.1 and 1.2. I've verified that these work as expected with all libcryptos we support. There are also a few SSL session discrepencies in AWS-LC when compared to OpenSSL. 1. AWS-LC has no support for internal session caching on the client-end. 2. AWS-LC supports internal session caching on the server, but SSL_get1_session does not return a resumable session with TLS 1.3 in AWS-LC. Users have to use the SSL_CTX_sess_set_new_cb (ctx.session_new_cb in Ruby) to retrieve the resumable session ticket. 3. AWS-LC has no current support for external session caching in TLS 1.3.
1 parent a60d050 commit ca384b8

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

test/openssl/test_ssl_session.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ def test_session
3030
end
3131
end
3232

33+
# PEM file updated to use TLS 1.2 with ECDHE-RSA-AES256-SHA.
3334
DUMMY_SESSION = <<__EOS__
3435
-----BEGIN SSL SESSION PARAMETERS-----
35-
MIIDzQIBAQICAwEEAgA5BCAF219w9ZEV8dNA60cpEGOI34hJtIFbf3bkfzSgMyad
36+
MIIDzQIBAQICAwMEAsAUBCAF219w9ZEV8dNA60cpEGOI34hJtIFbf3bkfzSgMyad
3637
MQQwyGLbkCxE4OiMLdKKem+pyh8V7ifoP7tCxhdmwoDlJxI1v6nVCjai+FGYuncy
3738
NNSWoQYCBE4DDWuiAwIBCqOCAo4wggKKMIIBcqADAgECAgECMA0GCSqGSIb3DQEB
3839
BQUAMD0xEzARBgoJkiaJk/IsZAEZFgNvcmcxGTAXBgoJkiaJk/IsZAEZFglydWJ5
@@ -56,9 +57,10 @@ def test_session
5657
-----END SSL SESSION PARAMETERS-----
5758
__EOS__
5859

60+
# PEM file updated to use TLS 1.1 with ECDHE-RSA-AES256-SHA.
5961
DUMMY_SESSION_NO_EXT = <<-__EOS__
6062
-----BEGIN SSL SESSION PARAMETERS-----
61-
MIIDCAIBAQICAwAEAgA5BCDyAW7rcpzMjDSosH+Tv6sukymeqgq3xQVVMez628A+
63+
MIIDCAIBAQICAwIEAsAUBCDyAW7rcpzMjDSosH+Tv6sukymeqgq3xQVVMez628A+
6264
lAQw9TrKzrIqlHEh6ltuQaqv/Aq83AmaAlogYktZgXAjOGnhX7ifJDNLMuCfQq53
6365
hPAaoQYCBE4iDeeiBAICASyjggKOMIICijCCAXKgAwIBAgIBAjANBgkqhkiG9w0B
6466
AQUFADA9MRMwEQYKCZImiZPyLGQBGRYDb3JnMRkwFwYKCZImiZPyLGQBGRYJcnVi
@@ -122,7 +124,8 @@ def test_resumption
122124
ctx.options &= ~OpenSSL::SSL::OP_NO_TICKET
123125
# Disable server-side session cache which is enabled by default
124126
ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_OFF
125-
ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION if libressl?
127+
# Session tickets must be retrieved via ctx.session_new_cb in TLS 1.3 in AWS-LC.
128+
ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION if libressl? || aws_lc?
126129
}
127130
start_server(ctx_proc: ctx_proc) do |port|
128131
sess1 = server_connect_with_session(port, nil, nil) { |ssl|
@@ -239,20 +242,25 @@ def test_ctx_client_session_cb_tls12
239242
end
240243

241244
server_connect_with_session(port, ctx, nil) { |ssl|
242-
assert_equal(1, ctx.session_cache_stats[:cache_num])
243245
assert_equal(1, ctx.session_cache_stats[:connect_good])
244246
assert_equal([ssl, ssl.session], called[:new])
245-
assert_equal(true, ctx.session_remove(ssl.session))
246-
assert_equal(false, ctx.session_remove(ssl.session))
247-
if TEST_SESSION_REMOVE_CB
248-
assert_equal([ctx, ssl.session], called[:remove])
247+
# AWS-LC doesn't support internal session caching on the client, but
248+
# the callback is still enabled as expected.
249+
unless aws_lc?
250+
assert_equal(1, ctx.session_cache_stats[:cache_num])
251+
assert_equal(true, ctx.session_remove(ssl.session))
252+
if TEST_SESSION_REMOVE_CB
253+
assert_equal([ctx, ssl.session], called[:remove])
254+
end
249255
end
256+
assert_equal(false, ctx.session_remove(ssl.session))
250257
}
251258
end
252259
end
253260

254261
def test_ctx_client_session_cb_tls13
255262
omit "LibreSSL does not call session_new_cb in TLS 1.3" if libressl?
263+
omit "AWS-LC does not support internal session caching on the client" if aws_lc?
256264

257265
start_server do |port|
258266
called = {}

0 commit comments

Comments
 (0)