Skip to content

Commit 3f615eb

Browse files
committed
implement "cipher_suites"
manual port of commit fd11a85
1 parent da28c0a commit 3f615eb

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

raddb/mods-available/eap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,22 @@ eap {
527527
#
528528
# psk_query = "%sql(select hex(key) from psk_keys where keyid = '%{TLS-PSK-Identity}')"
529529

530+
#
531+
# cipher_suites:: TLS 1.3 cipher suites.
532+
#
533+
# For TLS-PSK, uncomment the following line to use
534+
# standard ciphers for TLS 1.3.
535+
#
536+
# TLS-PSK may work without this line, but it is
537+
# likely to not work when the "next hop" home_server
538+
# accepts both certificates and PSK. OpenSSL will
539+
# negotiate cipher suites which are incompatible with
540+
# PSK, and then fail.
541+
#
542+
# Setting the `cipher_suites` here forces PSK to be negotiated.
543+
#
544+
# cipher_suites = "TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"
545+
530546
#
531547
# You can create the DH parameters by running the
532548
# following command:

src/lib/tls/conf-h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ struct fr_tls_conf_s {
158158
uint32_t padding_block_size; //!< for TLS 1.3, pad blocks to multiple of this size.
159159

160160
char const *cipher_list; //!< Acceptable ciphers.
161+
char const *cipher_suites; //!< Acceptable TLS 1.3 cipher suites.
161162
bool cipher_server_preference; //!< use server preferences for cipher selection
162163
#ifdef SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS
163164
bool allow_renegotiation; //!< Whether or not to allow cipher renegotiation.

src/lib/tls/conf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ conf_parser_t fr_tls_server_config[] = {
184184
{ FR_CONF_OFFSET("disable_single_dh_use", fr_tls_conf_t, disable_single_dh_use) },
185185

186186
{ FR_CONF_OFFSET("cipher_list", fr_tls_conf_t, cipher_list) },
187+
#ifdef TLS1_3_VERSION
188+
{ FR_CONF_OFFSET("cipher_suites", fr_tls_conf_t, cipher_suites) },
189+
#endif
187190
{ FR_CONF_OFFSET("cipher_server_preference", fr_tls_conf_t, cipher_server_preference), .dflt = "yes" },
188191
#ifdef SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS
189192
{ FR_CONF_OFFSET("allow_renegotiation", fr_tls_conf_t, allow_renegotiation), .dflt = "no" },
@@ -232,6 +235,9 @@ conf_parser_t fr_tls_client_config[] = {
232235
{ FR_CONF_OFFSET("fragment_size", fr_tls_conf_t, fragment_size), .dflt = "1024" },
233236

234237
{ FR_CONF_OFFSET("cipher_list", fr_tls_conf_t, cipher_list) },
238+
#ifdef TLS1_3_VERSION
239+
{ FR_CONF_OFFSET("cipher_suites", fr_tls_conf_t, cipher_suites) },
240+
#endif
235241

236242
#ifndef OPENSSL_NO_ECDH
237243
{ FR_CONF_OFFSET("ecdh_curve", fr_tls_conf_t, ecdh_curve), .dflt = "prime256v1" },

src/lib/tls/ctx.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,22 @@ SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client)
930930
}
931931
}
932932

933+
#ifdef TLS1_3_VERSION
934+
/*
935+
* Set the TLS 1.3 cipher suites if we were told to.
936+
*
937+
* This helps with TLS-PSK: OpenSSL will otherwise
938+
* negotiate cipher suites which are incompatible with
939+
* PSK, and then fail.
940+
*/
941+
if (conf->cipher_suites) {
942+
if (!SSL_CTX_set_ciphersuites(ctx, conf->cipher_suites)) {
943+
fr_tls_log(NULL, "Failed setting cipher suites");
944+
goto error;
945+
}
946+
}
947+
#endif
948+
933949
/*
934950
* Print the actual cipher list
935951
*/

0 commit comments

Comments
 (0)