Skip to content

Commit 8906a02

Browse files
Default to PQ TLS for s2n handlers if TLSv1.3 is negotiated (#740)
Co-authored-by: Dmitriy Musatkin <[email protected]>
1 parent 9b8d716 commit 8906a02

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ else()
232232
set (TARGET_DIR "static")
233233
endif()
234234

235+
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
236+
# OpenBSD by defaults links with --execute-only, which is problematic because
237+
# some AWS assembly sources still have references to static data in the .text section
238+
if(NOT BUILD_SHARED_LIBS)
239+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-execute-only")
240+
else()
241+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-execute-only")
242+
endif()
243+
endif()
244+
235245
install(EXPORT "${PROJECT_NAME}-targets"
236246
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${TARGET_DIR}"
237247
NAMESPACE AWS::

include/aws/io/tls_channel_handler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ enum aws_tls_cipher_pref {
5151
*/
5252
AWS_IO_TLS_CIPHER_PREF_TLSV1_2_2025_07 = 9,
5353

54+
/* This security policy was the system default before PQ was enabled by default. */
55+
AWS_IO_TLS_CIPHER_PREF_TLSV1_0_2023_06 = 10,
56+
5457
AWS_IO_TLS_CIPHER_PREF_END_RANGE = 0xFFFF
5558
};
5659

source/s2n/s2n_tls_channel_handler.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,9 @@ bool aws_tls_is_alpn_available(void) {
264264

265265
bool aws_tls_is_cipher_pref_supported(enum aws_tls_cipher_pref cipher_pref) {
266266
switch (cipher_pref) {
267-
case AWS_IO_TLS_CIPHER_PREF_SYSTEM_DEFAULT:
268-
return true;
269-
/* PQ Crypto no-ops on android for now */
270-
#ifndef ANDROID
271-
case AWS_IO_TLS_CIPHER_PREF_PQ_TLSV1_2_2024_10:
272-
return true;
273267
case AWS_IO_TLS_CIPHER_PREF_PQ_DEFAULT:
274-
return true;
275-
#endif
276-
268+
case AWS_IO_TLS_CIPHER_PREF_PQ_TLSV1_2_2024_10:
269+
case AWS_IO_TLS_CIPHER_PREF_SYSTEM_DEFAULT:
277270
case AWS_IO_TLS_CIPHER_PREF_TLSV1_2_2025_07:
278271
return true;
279272
default:
@@ -1519,14 +1512,14 @@ static struct aws_tls_ctx *s_tls_ctx_new(
15191512
security_policy = "AWS-CRT-SDK-TLSv1.1-2023";
15201513
break;
15211514
case AWS_IO_TLSv1_2:
1522-
security_policy = "AWS-CRT-SDK-TLSv1.2-2023";
1515+
security_policy = "AWS-CRT-SDK-TLSv1.2-2025-PQ";
15231516
break;
15241517
case AWS_IO_TLSv1_3:
1525-
security_policy = "AWS-CRT-SDK-TLSv1.3-2023";
1518+
security_policy = "AWS-CRT-SDK-TLSv1.3-2025-PQ";
15261519
break;
15271520
case AWS_IO_TLS_VER_SYS_DEFAULTS:
15281521
default:
1529-
security_policy = "AWS-CRT-SDK-TLSv1.0-2023";
1522+
security_policy = "AWS-CRT-SDK-TLSv1.0-2025-PQ";
15301523
}
15311524
}
15321525

@@ -1537,14 +1530,17 @@ static struct aws_tls_ctx *s_tls_ctx_new(
15371530
break;
15381531
case AWS_IO_TLS_CIPHER_PREF_PQ_DEFAULT:
15391532
/* The specific PQ policy used here may change over time. */
1540-
security_policy = "AWS-CRT-SDK-TLSv1.2-2023-PQ";
1533+
security_policy = "AWS-CRT-SDK-TLSv1.2-2025-PQ";
15411534
break;
15421535
case AWS_IO_TLS_CIPHER_PREF_PQ_TLSV1_2_2024_10:
15431536
security_policy = "AWS-CRT-SDK-TLSv1.2-2023-PQ";
15441537
break;
15451538
case AWS_IO_TLS_CIPHER_PREF_TLSV1_2_2025_07:
15461539
security_policy = "AWS-CRT-SDK-TLSv1.2-2025";
15471540
break;
1541+
case AWS_IO_TLS_CIPHER_PREF_TLSV1_0_2023_06:
1542+
security_policy = "AWS-CRT-SDK-TLSv1.2-2025";
1543+
break;
15481544
default:
15491545
AWS_LOGF_ERROR(AWS_LS_IO_TLS, "Unrecognized TLS Cipher Preference: %d", options->cipher_pref);
15501546
aws_raise_error(AWS_IO_TLS_CIPHER_PREF_UNSUPPORTED);

0 commit comments

Comments
 (0)