@@ -19,10 +19,6 @@ set(VERSION_MAJOR 1)
19
19
set (VERSION_MINOR 0)
20
20
set (VERSION_PATCH 0)
21
21
22
- option (S2N_NO_PQ "Disables all Post Quantum Crypto code. You likely want this
23
- for older compilers or uncommon platforms." OFF )
24
- option (S2N_NO_PQ_ASM "Turns off the ASM for PQ Crypto even if it's available for the toolchain.
25
- You likely want this on older compilers." OFF )
26
22
option (SEARCH_LIBCRYPTO "Set this if you want to let S2N search libcrypto for you,
27
23
otherwise a crypto target needs to be defined." ON )
28
24
option (UNSAFE_TREAT_WARNINGS_AS_ERRORS "Compiler warnings are treated as errors. Warnings may
@@ -36,7 +32,7 @@ option(S2N_STACKTRACE "Enables stacktrace functionality in s2n-tls. Note that th
36
32
only available on platforms that support execinfo." ON )
37
33
option (COVERAGE "Enable profiling collection for code coverage calculation" OFF )
38
34
option (S2N_INTEG_TESTS "Enable the integrationv2 tests" OFF )
39
- option (S2N_FAST_INTEG_TESTS "Enable the integrationv2 with more parallelism, only has effect if S2N_INTEG_TESTS=ON" OFF )
35
+ option (S2N_FAST_INTEG_TESTS "Enable the integrationv2 with more parallelism, only has effect if S2N_INTEG_TESTS=ON" ON )
40
36
option (S2N_INSTALL_S2NC_S2ND "Install the binaries s2nc and s2nd" OFF )
41
37
option (TSAN "Enable ThreadSanitizer to test thread safety" OFF )
42
38
option (ASAN "Enable AddressSanitizer to test memory safety" OFF )
@@ -62,47 +58,25 @@ file(GLOB_RECURSE TLS_SRC "tls/*.c")
62
58
file (GLOB UTILS_HEADERS "utils/*.h" )
63
59
file (GLOB UTILS_SRC "utils/*.c" )
64
60
65
- # Always include the top-level pq-crypto/ files
66
- file (GLOB PQ_HEADERS "pq-crypto/*.h" )
67
- file (GLOB PQ_SRC "pq-crypto/*.c" )
68
-
69
61
message (STATUS "Detected CMAKE_SYSTEM_PROCESSOR as ${CMAKE_SYSTEM_PROCESSOR} " )
70
62
71
63
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
72
- message (STATUS "Detected 32-Bit system - disabling PQ crypto assembly optimizations" )
73
- set (S2N_NO_PQ_ASM ON )
64
+ message (STATUS "Detected 32-Bit system" )
74
65
else ()
75
66
message (STATUS "Detected 64-Bit system" )
76
67
endif ()
77
68
78
- if (S2N_NO_PQ)
79
- # PQ is disabled, so we do not include any PQ crypto code
80
- message (STATUS "S2N_NO_PQ flag was detected - disabling PQ crypto" )
81
- set (S2N_NO_PQ_ASM ON )
82
- else ()
83
- # PQ is enabled, so include all of the PQ crypto code
84
- file (GLOB PQ_HEADERS
85
- "pq-crypto/*.h"
86
- "pq-crypto/kyber_r3/*.h" )
87
-
88
- file (GLOB PQ_SRC
89
- "pq-crypto/*.c"
90
- "pq-crypto/kyber_r3/*.c" )
91
- endif ()
92
-
93
69
##be nice to visual studio users
94
70
if (MSVC )
95
71
source_group ("Header Files\\ s2n\\ api" FILES ${API_HEADERS} ${API_UNSTABLE_HEADERS} )
96
72
source_group ("Header Files\\ s2n\\ crypto" FILES ${CRYPTO_HEADERS} )
97
73
source_group ("Header Files\\ s2n\\ error" FILES ${ERROR_HEADERS} )
98
- source_group ("Header Files\\ s2n\\ pq-crypto" FILES ${PQ_HEADERS} )
99
74
source_group ("Header Files\\ s2n\\ stuffer" FILES ${STUFFER_HEADERS} )
100
75
source_group ("Header Files\\ s2n\\ tls" FILES ${TLS_HEADERS} )
101
76
source_group ("Header Files\\ s2n\\ utils" FILES ${UTILS_HEADERS} )
102
77
103
78
source_group ("Source Files\\ crypto" FILES ${CRYPTO_SRC} )
104
79
source_group ("Source Files\\ error" FILES ${ERROR_SRC} )
105
- source_group ("Source Files\\ pq-crypto" FILES ${PQ_SRC} )
106
80
source_group ("Source Files\\ stuffer" FILES ${STUFFER_SRC} )
107
81
source_group ("Source Files\\ tls" FILES ${TLS_SRC} )
108
82
source_group ("Source Files\\ utils" FILES ${UTILS_SRC} )
@@ -135,7 +109,6 @@ file(GLOB S2N_HEADERS
135
109
${API_UNSTABLE_HEADERS}
136
110
${CRYPTO_HEADERS}
137
111
${ERROR_HEADERS}
138
- ${PQ_HEADERS}
139
112
${STUFFER_HEADERS}
140
113
${TLS_HEADERS}
141
114
${UTILS_HEADERS}
@@ -144,7 +117,6 @@ file(GLOB S2N_HEADERS
144
117
file (GLOB S2N_SRC
145
118
${CRYPTO_SRC}
146
119
${ERROR_SRC}
147
- ${PQ_SRC}
148
120
${STUFFER_SRC}
149
121
${TLS_SRC}
150
122
${UTILS_SRC}
@@ -186,10 +158,6 @@ if(NOT APPLE)
186
158
set (CMAKE_SHARED_LINKER_FLAGS -Wl,-z,noexecstack,-z,relro,-z,now)
187
159
endif ()
188
160
189
- if (S2N_NO_PQ)
190
- add_definitions (-DS2N_NO_PQ)
191
- endif ()
192
-
193
161
# Whether to fail the build when compiling s2n's portable C code with non-portable assembly optimizations. Doing this
194
162
# can lead to runtime crashes if build artifacts are built on modern hardware, but deployed to older hardware without
195
163
# newer CPU instructions. s2n, by default, should be backwards compatible with older CPU types so this flag should be
@@ -367,32 +335,6 @@ if (NOT S2N_EXECINFO_AVAILABLE)
367
335
endif ()
368
336
feature_probe_result(S2N_STACKTRACE ${S2N_STACKTRACE} )
369
337
370
- set (S2N_KYBER512R3_AVX2_BMI2 FALSE )
371
- if (NOT S2N_NO_PQ_ASM)
372
- # Kyber Round-3 code has several different optimizations which require
373
- # specific compiler flags to be supported by the compiler.
374
- # So for each needed instruction set extension we check if the compiler
375
- # supports it and set proper compiler flags to be added later to the
376
- # Kyber compilation units.
377
- if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|amd64|AMD64)$" )
378
- # Some platforms support -mavx2 flag but not m256 intrinsics required to use them. Only enable Kyber assembly
379
- # optimizations if both are supported. See https://github.com/aws/s2n-tls/pull/3005 for more info.
380
- if (S2N_KYBER512R3_AVX2_BMI2_SUPPORTED AND S2N_KYBER512R3_M256_INTRINSICS_SUPPORTED)
381
- set (S2N_KYBER512R3_AVX2_BMI2 TRUE )
382
- enable_language (ASM)
383
-
384
- # add the assembly files to the project
385
- FILE (GLOB KYBER512R3_AVX2_BMI2_ASM_SRCS "pq-crypto/kyber_r3/*_avx2.S" )
386
- target_sources (${PROJECT_NAME} PRIVATE ${KYBER512R3_AVX2_BMI2_ASM_SRCS} )
387
-
388
- # compile the C files with avx flags
389
- FILE (GLOB KYBER512R3_AVX2_BMI2_SRCS "pq-crypto/kyber_r3/*_avx2.c" )
390
- set_source_files_properties (${KYBER512R3_AVX2_BMI2_SRCS} PROPERTIES COMPILE_FLAGS ${S2N_KYBER512R3_AVX2_BMI2_SUPPORTED_FLAGS} )
391
- endif ()
392
- endif ()
393
- endif ()
394
- feature_probe_result(S2N_KYBER512R3_AVX2_BMI2 ${S2N_KYBER512R3_AVX2_BMI2} )
395
-
396
338
if (S2N_INTERN_LIBCRYPTO)
397
339
398
340
# Check if the AWS::crypto target has beeen added and handle it
@@ -558,7 +500,7 @@ if (BUILD_TESTING)
558
500
find . -name '${test_case_name} .c.o' -exec objcopy --redefine-syms libcrypto.symbols {} \\\;
559
501
)
560
502
endif ()
561
- target_compile_options (${test_case_name} PRIVATE -Wno-implicit-function-declaration -Wno-deprecated -D_POSIX_C_SOURCE=200809L -std=gnu99)
503
+ target_compile_options (${test_case_name} PRIVATE -Wno-implicit-function-declaration -Wno-deprecated -Wunused-result - D_POSIX_C_SOURCE=200809L -std=gnu99)
562
504
if (S2N_LTO)
563
505
target_compile_options (${test_case_name} PRIVATE -flto)
564
506
endif ()
@@ -609,6 +551,10 @@ if (BUILD_TESTING)
609
551
if (S2N_INTEG_TESTS)
610
552
find_package (Python3 COMPONENTS Interpreter Development)
611
553
file (GLOB integv2_test_files "${PROJECT_SOURCE_DIR} /tests/integrationv2/test_*.py" )
554
+ set (N 1)
555
+ if (S2N_FAST_INTEG_TESTS)
556
+ set (N auto)
557
+ endif ()
612
558
foreach (test_file_path ${integv2_test_files} )
613
559
get_filename_component (test_filename ${test_file_path} NAME_WE )
614
560
string (REGEX REPLACE "^test_" "integrationv2_" test_target ${test_filename} )
0 commit comments