Skip to content

Commit c89cce7

Browse files
authored
Merge branch 'main' into nix_junit
2 parents 5386b83 + 6c7cdc8 commit c89cce7

File tree

417 files changed

+11253
-11609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

417 files changed

+11253
-11609
lines changed

.github/s2n_osx.sh

+9
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,12 @@ cmake . -Bbuild -GNinja \
2828

2929
cmake --build ./build -j $(nproc)
3030
time CTEST_PARALLEL_LEVEL=$(nproc) ninja -C build test
31+
32+
# Build shared library
33+
cmake . -Bbuild -GNinja \
34+
-DCMAKE_BUILD_TYPE=Debug \
35+
-DCMAKE_PREFIX_PATH=${OPENSSL_1_1_1_INSTALL_DIR} .. \
36+
-DBUILD_SHARED_LIBS=ON
37+
38+
cmake --build ./build -j $(nproc)
39+
time CTEST_PARALLEL_LEVEL=$(nproc) ninja -C build test

.github/workflows/ci_freebsd.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ on:
99

1010
jobs:
1111
testfreebsd:
12-
runs-on: macos-12
12+
runs-on: ubuntu-latest
1313
name: CI FreeBSD
1414
steps:
1515
- uses: actions/checkout@v3
1616
- name: Build and test in FreeBSD
1717
id: test
18-
uses: vmactions/[email protected]
18+
uses: vmactions/freebsd-vm@v1
19+
timeout-minutes: 45
1920
with:
2021
prepare: pkg install -y ninja cmake
2122
run: |

.github/workflows/ci_linting.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,16 @@ jobs:
7777
steps:
7878
- name: checkout
7979
uses: actions/checkout@v3
80-
- name: pep8 exp
81-
uses: harrisonkaiser/autopep8_action@python-latest
80+
- name: Run autopep8
81+
id: autopep8
82+
uses: peter-evans/autopep8@v2
8283
with:
83-
dry: true
84-
checkpath: ./tests/integrationv2/*.py
84+
args: --diff --exit-code .
85+
- name: Check exit code
86+
if: steps.autopep8.outputs.exit-code != 0
87+
run: |
88+
echo "Run 'autopep8 --in-place .' to fix"
89+
exit 1
8590
clang-format:
8691
runs-on: ubuntu-latest
8792
steps:

.github/workflows/ci_openbsd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v3
1616
- name: Build and test in OpenBSD
1717
id: test
18-
uses: cross-platform-actions/action@v0.10.0
18+
uses: cross-platform-actions/action@v0.21.1
1919
with:
2020
operating_system: openbsd
2121
architecture: x86-64

.github/workflows/ci_rust.yml

+20
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ jobs:
5959
./generate.sh
6060
ldd target/debug/integration | grep libs2n.so
6161
62+
# our benchmark testing includes interop tests between s2n-tls, rustls, and
63+
# openssl
64+
harness-interop-tests:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v3
68+
69+
- uses: actions-rs/toolchain@v1
70+
id: toolchain
71+
with:
72+
toolchain: stable
73+
override: true
74+
75+
- name: generate bindings
76+
run: ${{env.ROOT_PATH}}/generate.sh --skip-tests
77+
78+
- name: bench tests
79+
working-directory: ${{env.ROOT_PATH}}/bench
80+
run: cargo test
81+
6282
generate-openssl-102:
6383
runs-on: ubuntu-latest
6484
steps:

.github/workflows/dashboard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
if: contains(github.repository, 'aws/s2n-tls')
1010
runs-on: ubuntu-latest
1111
permissions:
12-
pages: write
12+
contents: write
1313
steps:
1414
- name: Check out repository
1515
uses: actions/checkout@v3

.github/workflows/proof_ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
run: |
6363
# Search within 5 most recent releases for latest available package
6464
CBMC_REL="https://api.github.com/repos/diffblue/cbmc/releases?page=1&per_page=5"
65-
CBMC_DEB=$(curl -s $CBMC_REL --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq -r '.[].assets[].browser_download_url' | grep -e 'ubuntu-20.04' | head -n 1)
65+
CBMC_DEB=$(curl -s $CBMC_REL --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq -r '.[]|select(.prerelease|not).assets[].browser_download_url' | grep -e 'ubuntu-20.04' | head -n 1)
6666
CBMC_ARTIFACT_NAME=$(basename $CBMC_DEB)
6767
curl -o $CBMC_ARTIFACT_NAME -L $CBMC_DEB
6868
sudo dpkg -i $CBMC_ARTIFACT_NAME
@@ -96,7 +96,7 @@ jobs:
9696
run: |
9797
# Search within 5 most recent releases for latest available package
9898
LITANI_REL="https://api.github.com/repos/awslabs/aws-build-accumulator/releases?page=1&per_page=5"
99-
LITANI_DEB=$(curl -s $LITANI_REL --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq -r '.[].assets[0].browser_download_url' | head -n 1)
99+
LITANI_DEB=$(curl -s $LITANI_REL --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq -r '.[]|select(.prerelease|not).assets[0].browser_download_url' | head -n 1)
100100
DBN_PKG_FILENAME=$(basename $LITANI_DEB)
101101
curl -L $LITANI_DEB -o $DBN_PKG_FILENAME
102102
sudo apt-get update

.github/workflows/usage_guide.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Publish Usage Guide
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
env:
11+
CDN: https://d3fqnyekunr9xg.cloudfront.net
12+
13+
# By default dependabot only receives read permissions. Explicitly give it write
14+
# permissions which is needed by the ouzi-dev/commit-status-updater task.
15+
#
16+
# Updating status is relatively safe (doesnt modify source code) and caution
17+
# should be taken before adding more permissions.
18+
permissions:
19+
contents: write
20+
statuses: write
21+
22+
jobs:
23+
build-deploy:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout s2n-tls repo
27+
uses: actions/checkout@v4
28+
29+
- uses: dtolnay/rust-toolchain@stable
30+
31+
- name: Set override
32+
run: rustup override set stable
33+
34+
- uses: camshaft/install@v1
35+
with:
36+
crate: mdbook
37+
38+
- name: Build book
39+
run: |
40+
cd docs/usage-guide
41+
mdbook build
42+
43+
- name: Deploy documentation to gh-pages
44+
uses: JamesIves/[email protected]
45+
if: github.event_name == 'push'
46+
with:
47+
target-folder: usage-guide
48+
folder: docs/usage-guide/book
49+
50+
- name: Configure AWS credentials
51+
uses: aws-actions/[email protected]
52+
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
53+
with:
54+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
55+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
56+
aws-region: us-west-1
57+
58+
- name: Upload to S3
59+
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
60+
id: s3
61+
run: |
62+
TARGET="${{ github.sha }}/book"
63+
aws s3 sync docs/usage-guide/book "s3://s2n-tls-ci-artifacts/$TARGET" --acl private --follow-symlinks
64+
URL="$CDN/$TARGET/index.html"
65+
echo "URL=$URL" >> $GITHUB_OUTPUT
66+
67+
- name: Output mdbook url
68+
uses: ouzi-dev/[email protected]
69+
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
70+
with:
71+
name: "book / url"
72+
status: "success"
73+
url: "${{ steps.s3.outputs.URL }}"

tests/integrationv2/.pep8 .pep8

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[pep8]
22
max_line_length = 120
3-
in-place = true
43
recursive = true

CMakeLists.txt

+7-61
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ set(VERSION_MAJOR 1)
1919
set(VERSION_MINOR 0)
2020
set(VERSION_PATCH 0)
2121

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)
2622
option(SEARCH_LIBCRYPTO "Set this if you want to let S2N search libcrypto for you,
2723
otherwise a crypto target needs to be defined." ON)
2824
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
3632
only available on platforms that support execinfo." ON)
3733
option(COVERAGE "Enable profiling collection for code coverage calculation" OFF)
3834
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)
4036
option(S2N_INSTALL_S2NC_S2ND "Install the binaries s2nc and s2nd" OFF)
4137
option(TSAN "Enable ThreadSanitizer to test thread safety" OFF)
4238
option(ASAN "Enable AddressSanitizer to test memory safety" OFF)
@@ -62,47 +58,25 @@ file(GLOB_RECURSE TLS_SRC "tls/*.c")
6258
file(GLOB UTILS_HEADERS "utils/*.h")
6359
file(GLOB UTILS_SRC "utils/*.c")
6460

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-
6961
message(STATUS "Detected CMAKE_SYSTEM_PROCESSOR as ${CMAKE_SYSTEM_PROCESSOR}")
7062

7163
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")
7465
else()
7566
message(STATUS "Detected 64-Bit system")
7667
endif()
7768

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-
9369
##be nice to visual studio users
9470
if(MSVC)
9571
source_group("Header Files\\s2n\\api" FILES ${API_HEADERS} ${API_UNSTABLE_HEADERS})
9672
source_group("Header Files\\s2n\\crypto" FILES ${CRYPTO_HEADERS})
9773
source_group("Header Files\\s2n\\error" FILES ${ERROR_HEADERS})
98-
source_group("Header Files\\s2n\\pq-crypto" FILES ${PQ_HEADERS})
9974
source_group("Header Files\\s2n\\stuffer" FILES ${STUFFER_HEADERS})
10075
source_group("Header Files\\s2n\\tls" FILES ${TLS_HEADERS})
10176
source_group("Header Files\\s2n\\utils" FILES ${UTILS_HEADERS})
10277

10378
source_group("Source Files\\crypto" FILES ${CRYPTO_SRC})
10479
source_group("Source Files\\error" FILES ${ERROR_SRC})
105-
source_group("Source Files\\pq-crypto" FILES ${PQ_SRC})
10680
source_group("Source Files\\stuffer" FILES ${STUFFER_SRC})
10781
source_group("Source Files\\tls" FILES ${TLS_SRC})
10882
source_group("Source Files\\utils" FILES ${UTILS_SRC})
@@ -135,7 +109,6 @@ file(GLOB S2N_HEADERS
135109
${API_UNSTABLE_HEADERS}
136110
${CRYPTO_HEADERS}
137111
${ERROR_HEADERS}
138-
${PQ_HEADERS}
139112
${STUFFER_HEADERS}
140113
${TLS_HEADERS}
141114
${UTILS_HEADERS}
@@ -144,7 +117,6 @@ file(GLOB S2N_HEADERS
144117
file(GLOB S2N_SRC
145118
${CRYPTO_SRC}
146119
${ERROR_SRC}
147-
${PQ_SRC}
148120
${STUFFER_SRC}
149121
${TLS_SRC}
150122
${UTILS_SRC}
@@ -186,10 +158,6 @@ if(NOT APPLE)
186158
set(CMAKE_SHARED_LINKER_FLAGS -Wl,-z,noexecstack,-z,relro,-z,now)
187159
endif()
188160

189-
if(S2N_NO_PQ)
190-
add_definitions(-DS2N_NO_PQ)
191-
endif()
192-
193161
# Whether to fail the build when compiling s2n's portable C code with non-portable assembly optimizations. Doing this
194162
# can lead to runtime crashes if build artifacts are built on modern hardware, but deployed to older hardware without
195163
# 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)
367335
endif()
368336
feature_probe_result(S2N_STACKTRACE ${S2N_STACKTRACE})
369337

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-
396338
if (S2N_INTERN_LIBCRYPTO)
397339

398340
# Check if the AWS::crypto target has beeen added and handle it
@@ -558,7 +500,7 @@ if (BUILD_TESTING)
558500
find . -name '${test_case_name}.c.o' -exec objcopy --redefine-syms libcrypto.symbols {} \\\;
559501
)
560502
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)
562504
if (S2N_LTO)
563505
target_compile_options(${test_case_name} PRIVATE -flto)
564506
endif()
@@ -609,6 +551,10 @@ if (BUILD_TESTING)
609551
if (S2N_INTEG_TESTS)
610552
find_package (Python3 COMPONENTS Interpreter Development)
611553
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()
612558
foreach(test_file_path ${integv2_test_files})
613559
get_filename_component(test_filename ${test_file_path} NAME_WE)
614560
string(REGEX REPLACE "^test_" "integrationv2_" test_target ${test_filename})

LICENSE

-22
Original file line numberDiff line numberDiff line change
@@ -200,25 +200,3 @@
200200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201
See the License for the specific language governing permissions and
202202
limitations under the License.
203-
204-
205-
============================================================================
206-
S2N SUBCOMPONENTS:
207-
208-
The s2n Project contains subcomponents with separate copyright notices
209-
and license terms. Your use of the source code for these subcomponents is
210-
subject to the terms and conditions of the following licenses.
211-
212-
213-
========================================================================
214-
Third party MIT licenses
215-
========================================================================
216-
217-
The following components are provided under the MIT License. See project link for details.
218-
219-
220-
SIKE
221-
-> s2n/pq-crypto/sike_r1/LICENSE.txt
222-
223-
224-

0 commit comments

Comments
 (0)