View Ticket
Ticket Hash: d0518a5645151339f345c259e25b512c2bf3d63f
Title: tls::socket -cipher arg not working as expected when -tls1.3 is true
Status: Closed Type: Code Defect
Severity: Critical Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2024-06-28 22:37:13
Version Found In: 1.7.17
User Comments:
anonymous added on 2019-04-15 21:26:20:
The "-cipher" switch in the tls::socket command should allow an explicit cipher 
to use for a session.  It does not do this when the tls1.3 switch is set to true.

Openssl version is 1.1.1b
tcltls version 1.7.17

When the socket is set up in the following fashion it functions correctly 
allowing the passed cipher to be used explicitly.  

Examples of individually passed ciphers include:
 
DHE-RSA-AES256-GCM-SHA384 
DHE-RSA-AES256-SHA256 
AES256-GCM-SHA384 
AES256-SHA256 
DHE-RSA-AES128-GCM-SHA256 
DHE-RSA-AES128-SHA256 
AES128-GCM-SHA256 
AES128-SHA256     ...... and so on 

set server_channel [tls::socket \
   -tls1.3 0 \
   -tls1.2 1 
   -tls1 0 \
   -tls1.1 0 \
   -ssl2 0 \
   -ssl3 0 \
   -server EchoAccept \
   -request 1 \
   -require 1 \
   -cafile $CA_CERTIFICATE \
   -certfile $CERTFILE \
   -keyfile $PRIVATE_KEY \
   -password get_master_password \
   -cipher $ENCRYPTION_CIPHER \
   $LISTEN_SOCKET ]

A similar setup is in place for the client.

When the tls1.3 switch is set to true, the ability to individually select the explicit cipher goes away.  
In my setup, it always defaults to TLS_AES_256_GCM_SHA384.

When tls1.2 is true and tls1.3 is false is works as expected.
When tls1.3 is true, it does not function as expected (regarless of how tls1.2 is set).

Correct and corresponding setup was done on the client side when investigated.

anonymous added on 2019-04-18 01:13:29:
After reading further, it seems that tls1.3 configuration will require hooks into 
the SSL_CTX_set_ciphersuites() or SSL_set_ciphersuites() functions to configure 
TLSv1.3 ciphersuites.  The functions SSL_CTX_get_ciphers() and SSL_get_ciphers() 
will return the full list of ciphersuites that have been configured for both 
TLSv1.2 and below and TLSv1.3. 

The code in tls.c uses SSL_CTX_get_ciphers() and there is no function for the 
ciphersuites functions.  As a consequence, it is not possible to configure tls1.3 
for use with this version of tcltls.

bohagan added on 2024-06-28 22:31:12:
This has been fixed in commit [cd11c125e83b2546]. A new option -ciphersuites was added to set the TLS 1.3 cipher suites.

bohagan added on 2024-06-28 22:37:13:
The ciphers command was extended to allow you to query the allowed cipher suites in commit [05b2dd47be4c7432].