Skip to content

Commit 3028665

Browse files
authored
Merge branch 'main' into ecdsa_sigalg
2 parents a1c1961 + fc9ad97 commit 3028665

File tree

136 files changed

+2076
-1551
lines changed

Some content is hidden

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

136 files changed

+2076
-1551
lines changed

.github/workflows/proof_ci.yaml

+52-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: MIT-0
3-
# CBMC starter kit 2.9
3+
# CBMC starter kit 2.10
44
name: Run CBMC proofs
55
on:
66
push:
@@ -38,11 +38,11 @@ jobs:
3838
- name: Parse config file
3939
run: |
4040
CONFIG_FILE='.github/workflows/proof_ci_resources/config.yaml'
41-
for setting in cadical-tag cbmc-version cbmc-viewer-version kissat-tag litani-version proofs-dir run-cbmc-proofs-command; do
41+
for setting in cadical-tag cbmc-version cbmc-viewer-version kissat-tag litani-version z3-version bitwuzla-version proofs-dir run-cbmc-proofs-command; do
4242
VAR=$(echo $setting | tr "[:lower:]" "[:upper:]" | tr - _)
4343
echo "${VAR}"=$(yq .$setting $CONFIG_FILE) >> $GITHUB_ENV
4444
done
45-
- name: Ensure CBMC, CBMC viewer, Litani versions have been specified
45+
- name: Ensure CBMC, CBMC viewer, Litani, Z3, Bitwuzla versions have been specified
4646
shell: bash
4747
run: |
4848
should_exit=false
@@ -58,6 +58,22 @@ jobs:
5858
echo "You must specify a Litani version (e.g. 'latest' or '1.27.0')"
5959
should_exit=true
6060
fi
61+
if [ "${{ env.Z3_VERSION }}" == "" ]; then
62+
echo "You must specify a Z3 version (e.g. '4.13.0')"
63+
should_exit=true
64+
fi
65+
if [ "${{ env.Z3_VERSION }}" == "latest" ]; then
66+
echo "Z3 latest not supported at this time. You must specify an exact Z3 version (e.g. '4.13.0')"
67+
should_exit=true
68+
fi
69+
if [ "${{ env.BITWUZLA_VERSION }}" == "" ]; then
70+
echo "You must specify a Bitwuzla version (e.g. '0.5.0')"
71+
should_exit=true
72+
fi
73+
if [ "${{ env.BITWUZLA_VERSION }}" == "latest" ]; then
74+
echo "Bitwuzla latest not supported at this time. You must specify an exact version (e.g. '0.5.0')"
75+
should_exit=true
76+
fi
6177
if [[ "$should_exit" == true ]]; then exit 1; fi
6278
- name: Install latest CBMC
6379
if: ${{ env.CBMC_VERSION == 'latest' }}
@@ -84,15 +100,15 @@ jobs:
84100
run: |
85101
CBMC_VIEWER_REL="https://api.github.com/repos/model-checking/cbmc-viewer/releases/latest"
86102
CBMC_VIEWER_VERSION=$(curl -s $CBMC_VIEWER_REL --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq -r .name | sed 's/viewer-//')
87-
pip3 install cbmc-viewer==$CBMC_VIEWER_VERSION
103+
sudo pip3 install cbmc-viewer==$CBMC_VIEWER_VERSION
88104
- name: Install CBMC viewer ${{ env.CBMC_VIEWER_VERSION }}
89105
if: ${{ env.CBMC_VIEWER_VERSION != 'latest' }}
90106
shell: bash
91107
run: |
92108
sudo apt-get update
93109
sudo apt-get install --no-install-recommends --yes \
94110
build-essential universal-ctags
95-
pip3 install cbmc-viewer==${{ env.CBMC_VIEWER_VERSION }}
111+
sudo pip3 install cbmc-viewer==${{ env.CBMC_VIEWER_VERSION }}
96112
- name: Install latest Litani
97113
if: ${{ env.LITANI_VERSION == 'latest' }}
98114
shell: bash
@@ -114,6 +130,37 @@ jobs:
114130
sudo apt-get update
115131
sudo apt-get install --no-install-recommends --yes ./litani.deb
116132
rm ./litani.deb
133+
- name: Install Z3 ${{ env.Z3_VERSION }}
134+
if: ${{ env.Z3_VERSION != 'latest' }}
135+
shell: bash
136+
run: |
137+
curl -o z3.zip -L \
138+
https://github.com/Z3Prover/z3/releases/download/z3-${{ env.Z3_VERSION }}/z3-${{ env.Z3_VERSION }}-x64-glibc-2.31.zip
139+
sudo apt-get install --no-install-recommends --yes unzip
140+
unzip z3.zip
141+
cd z3-${{ env.Z3_VERSION }}-x64-glibc-2.31/bin \
142+
&& echo "Adding $(pwd) to PATH for Z3" \
143+
&& echo "$(pwd)" >> $GITHUB_PATH
144+
rm ../../z3.zip
145+
- name: Build and Install Bitwuzla ${{ env.BITWUZLA_VERSION }}
146+
if: ${{ env.BITWUZLA_VERSION != 'latest' }}
147+
shell: bash
148+
run: |
149+
echo "Installing Bitwuzla dependencies"
150+
sudo apt-get update
151+
sudo apt-get install --no-install-recommends --yes libgmp-dev cmake
152+
sudo pip3 install meson
153+
echo "Building Bitwuzla"
154+
BITWUZLA_TAG_NAME=${{ env.BITWUZLA_VERSION }}
155+
git clone https://github.com/bitwuzla/bitwuzla.git \
156+
&& cd bitwuzla \
157+
&& git checkout $BITWUZLA_TAG_NAME \
158+
&& ./configure.py \
159+
&& cd build \
160+
&& ninja;
161+
cd src/main \
162+
&& echo "Adding $(pwd) to PATH for Bitwuzla" \
163+
&& echo "$(pwd)" >> $GITHUB_PATH
117164
- name: Install ${{ env.KISSAT_TAG }} kissat
118165
if: ${{ env.KISSAT_TAG != '' }}
119166
shell: bash
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
cadical-tag: latest
2-
cbmc-version: "5.95.1"
2+
cbmc-version: "6.1.0"
33
cbmc-viewer-version: latest
44
kissat-tag: latest
55
litani-version: latest
6+
z3-version: "4.13.0"
7+
bitwuzla-version: "0.5.0"
68
proofs-dir: tests/cbmc/proofs
79
run-cbmc-proofs-command: ./run-cbmc-proofs.py

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ tests/unit/*_test
2121
tests/fuzz/*_test
2222
tests/fuzz/*.txt
2323
tests/fuzz/fuzz-*.log
24-
tests/benchmark/*_benchmark
2524
bin/s2nc
2625
bin/s2nd
2726
bin/policy

CMakeLists.txt

-20
Original file line numberDiff line numberDiff line change
@@ -539,26 +539,6 @@ if (BUILD_TESTING)
539539
target_compile_options(s2nd PRIVATE -flto)
540540
endif()
541541

542-
if(BENCHMARK)
543-
find_package(benchmark REQUIRED)
544-
file(GLOB BENCHMARK_SRC "tests/benchmark/*.cc")
545-
file(GLOB BENCHMARK_UTILS "tests/benchmark/utils/*.cc")
546-
enable_language(CXX)
547-
foreach(benchmark ${BENCHMARK_SRC})
548-
string(REGEX REPLACE ".+\\/(.+)\\.cc" "\\1" benchmark_name ${benchmark})
549-
add_executable(${benchmark_name} ${benchmark} "bin/echo.c" "bin/common.c" ${BENCHMARK_UTILS})
550-
target_include_directories(${benchmark_name} PRIVATE api)
551-
target_include_directories(${benchmark_name} PRIVATE tests)
552-
target_link_libraries(${benchmark_name} PUBLIC ${PROJECT_NAME} testss2n benchmark::benchmark)
553-
554-
# Based off the flags in tests/benchmark/Makefile
555-
target_compile_options(${benchmark_name} PRIVATE -pedantic -Wall -Werror -Wunused -Wcomment -Wchar-subscripts
556-
-Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -Wno-deprecated-declarations
557-
-Wno-unknown-pragmas -Wformat-security -Wno-missing-braces -fvisibility=hidden -Wno-unreachable-code
558-
-Wno-unused-but-set-variable)
559-
endforeach(benchmark)
560-
endif()
561-
562542
if (S2N_INTEG_TESTS)
563543
find_package (Python3 COMPONENTS Interpreter Development)
564544
file(GLOB integv2_test_files "${PROJECT_SOURCE_DIR}/tests/integrationv2/test_*.py")

Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ fuzz-linux : export S2N_UNSAFE_FUZZING_MODE = 1
8888
fuzz-linux : bin
8989
$(MAKE) -C tests fuzz
9090

91-
.PHONY : benchmark
92-
benchmark: bin
93-
$(MAKE) -C tests benchmark
94-
9591
.PHONY : coverage
9692
coverage: run-lcov run-genhtml
9793

bin/common.c

+3
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ int s2n_setup_external_psk_list(struct s2n_connection *conn, char *psk_optarg_li
314314

315315
int s2n_set_common_server_config(int max_early_data, struct s2n_config *config, struct conn_settings conn_settings, const char *cipher_prefs, const char *session_ticket_key_file_path)
316316
{
317+
/* The s2n-tls blinding security feature is disabled for testing purposes to make debugging easier. */
318+
GUARD_EXIT(s2n_config_set_max_blinding_delay(config, 0), "Error setting blinding delay");
319+
317320
GUARD_EXIT(s2n_config_set_server_max_early_data_size(config, max_early_data), "Error setting max early data");
318321

319322
GUARD_EXIT(s2n_config_add_dhparams(config, dhparams), "Error adding DH parameters");

bin/s2nc.c

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "api/unstable/npn.h"
3434
#include "api/unstable/renegotiate.h"
3535
#include "common.h"
36+
#include "crypto/s2n_libcrypto.h"
3637
#include "error/s2n_errno.h"
3738
#include "tls/s2n_connection.h"
3839

@@ -76,6 +77,9 @@ const char default_trusted_cert[] =
7677
void usage()
7778
{
7879
/* clang-format off */
80+
fprintf(stderr, "s2nc is an s2n-tls client testing utility.\n");
81+
fprintf(stderr, "It is not intended for production use.\n");
82+
fprintf(stderr, "\n");
7983
fprintf(stderr, "usage: s2nc [options] host [port]\n");
8084
fprintf(stderr, " host: hostname or IP address to connect to\n");
8185
fprintf(stderr, " port: port to connect to\n");
@@ -201,6 +205,9 @@ static void setup_s2n_config(struct s2n_config *config, const char *cipher_prefs
201205
exit(1);
202206
}
203207

208+
/* The s2n-tls blinding security feature is disabled for testing purposes to make debugging easier. */
209+
GUARD_EXIT(s2n_config_set_max_blinding_delay(config, 0), "Error setting blinding delay");
210+
204211
GUARD_EXIT(s2n_config_set_cipher_preferences(config, cipher_prefs), "Error setting cipher prefs");
205212

206213
GUARD_EXIT(s2n_config_set_status_request_type(config, type), "OCSP validation is not supported by the linked libCrypto implementation. It cannot be set.");
@@ -585,6 +592,7 @@ int main(int argc, char *const *argv)
585592
}
586593

587594
GUARD_EXIT(s2n_init(), "Error running s2n_init()");
595+
printf("libcrypto: %s\n", s2n_libcrypto_get_version_name());
588596

589597
if ((r = getaddrinfo(host, port, &hints, &ai_list)) != 0) {
590598
fprintf(stderr, "error: %s\n", gai_strerror(r));

bin/s2nd.c

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "api/s2n.h"
3535
#include "api/unstable/npn.h"
3636
#include "common.h"
37+
#include "crypto/s2n_libcrypto.h"
3738
#include "utils/s2n_safety.h"
3839

3940
#define MAX_CERTIFICATES 50
@@ -138,6 +139,9 @@ static char default_private_key[] =
138139
void usage()
139140
{
140141
/* clang-format off */
142+
fprintf(stderr, "s2nd is an s2n-tls server testing utility.\n");
143+
fprintf(stderr, "It is not intended for production use.\n");
144+
fprintf(stderr, "\n");
141145
fprintf(stderr, "usage: s2nd [options] host port\n");
142146
fprintf(stderr, " host: hostname or IP address to listen on\n");
143147
fprintf(stderr, " port: port to listen on\n");
@@ -562,6 +566,7 @@ int main(int argc, char *const *argv)
562566
}
563567

564568
GUARD_EXIT(s2n_init(), "Error running s2n_init()");
569+
printf("libcrypto: %s\n", s2n_libcrypto_get_version_name());
565570

566571
printf("Listening on %s:%s\n", host, port);
567572

bindings/rust/s2n-tls-hyper/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ edition = "2021"
77
rust-version = "1.63.0"
88
repository = "https://github.com/aws/s2n-tls"
99
license = "Apache-2.0"
10+
publish = false
1011

1112
[features]
1213
default = []
1314

1415
[dependencies]
15-
s2n-tls = { version = "=0.2.9", path = "../s2n-tls" }
16-
s2n-tls-tokio = { version = "=0.2.9", path = "../s2n-tls-tokio" }
16+
s2n-tls = { version = "=0.3.0", path = "../s2n-tls" }
17+
s2n-tls-tokio = { version = "=0.3.0", path = "../s2n-tls-tokio" }
1718
hyper = { version = "1" }
1819
hyper-util = { version = "0.1", features = ["client-legacy", "tokio", "http1"] }
1920
tower-service = { version = "0.3" }

bindings/rust/s2n-tls-sys/templates/Cargo.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "s2n-tls-sys"
33
description = "A C99 implementation of the TLS/SSL protocols"
4-
version = "0.2.9"
4+
version = "0.3.0"
55
authors = ["AWS s2n"]
66
edition = "2021"
77
rust-version = "1.63.0"

bindings/rust/s2n-tls-tokio/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "s2n-tls-tokio"
33
description = "An implementation of TLS streams for Tokio built on top of s2n-tls"
4-
version = "0.2.9"
4+
version = "0.3.0"
55
authors = ["AWS s2n"]
66
edition = "2021"
77
rust-version = "1.63.0"
@@ -15,7 +15,7 @@ default = []
1515
errno = { version = "0.3" }
1616
libc = { version = "0.2" }
1717
pin-project-lite = { version = "0.2" }
18-
s2n-tls = { version = "=0.2.9", path = "../s2n-tls" }
18+
s2n-tls = { version = "=0.3.0", path = "../s2n-tls" }
1919
tokio = { version = "1", features = ["net", "time"] }
2020

2121
[dev-dependencies]

0 commit comments

Comments
 (0)