@@ -9,16 +9,20 @@ SCRATCH_FOLDER=${SYS_ROOT}/"pq-tls-scratch"
9
9
10
10
AWS_LC_BUILD_FOLDER=" ${SCRATCH_FOLDER} /aws-lc-build"
11
11
AWS_LC_INSTALL_FOLDER=" ${SCRATCH_FOLDER} /aws-lc-install"
12
+ AWS_LC_CMD=" ${AWS_LC_BUILD_FOLDER} /tool/bssl"
12
13
13
14
S2N_URL=' https://github.com/aws/s2n-tls.git'
14
15
S2N_BRANCH=' main'
15
16
S2N_TLS_SRC_FOLDER=" ${SCRATCH_FOLDER} /s2n-tls"
16
17
S2N_TLS_BUILD_FOLDER=" ${SCRATCH_FOLDER} /s2n-tls-build"
18
+ S2NC_CMD=${S2N_TLS_BUILD_FOLDER} /bin/s2nc
19
+ S2ND_CMD=${S2N_TLS_BUILD_FOLDER} /bin/s2nd
17
20
18
21
BSSL_URL=' https://github.com/google/boringssl.git'
19
22
BSSL_BRANCH=' main'
20
23
BSSL_SRC_FOLDER=" ${SCRATCH_FOLDER} /boring-ssl"
21
24
BSSL_BUILD_FOLDER=" ${SCRATCH_FOLDER} /boring-ssl-build"
25
+ BSSL_CMD=" ${SCRATCH_FOLDER} /boring-ssl-build/bssl"
22
26
23
27
rm -rf " ${SCRATCH_FOLDER:? } "
24
28
mkdir -p " $SCRATCH_FOLDER "
@@ -27,6 +31,9 @@ echo "build and install aws-lc"
27
31
# Using Debug build as it uses the '-g' compiler flag with gcc without any optimization
28
32
aws_lc_build " $SRC_ROOT " " $AWS_LC_BUILD_FOLDER " " $AWS_LC_INSTALL_FOLDER " -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF
29
33
34
+ [[ -f ${AWS_LC_CMD} ]] || ( echo " Error building AWS-LC. ${AWS_LC_CMD} not found." && exit 1 )
35
+ echo " AWS-LC build succeeded. Found ${AWS_LC_CMD} "
36
+
30
37
echo " clone s2n-tls"
31
38
git clone --depth 1 --branch " $S2N_BRANCH " " $S2N_URL " " $S2N_TLS_SRC_FOLDER "
32
39
@@ -38,14 +45,18 @@ cmake . "-B$S2N_TLS_BUILD_FOLDER" -GNinja \
38
45
# Suppress stdout for build
39
46
ninja -C " $S2N_TLS_BUILD_FOLDER " -j " $NUM_CPU_THREADS " > /dev/null
40
47
48
+ [[ -f ${S2NC_CMD} ]] || ( echo " Error building s2nc. ${S2NC_CMD} not found." && exit 1 )
49
+ [[ -f ${S2ND_CMD} ]] || ( echo " Error building s2nd. ${S2ND_CMD} not found." && exit 1 )
50
+ echo " s2n build succeeded. Found: ${S2NC_CMD} ${S2ND_CMD} "
51
+
41
52
for GROUP in X25519MLKEM768 SecP256r1MLKEM768; do
42
53
echo " TLS Handshake: aws-lc server (bssl) with s2n-tls client (s2nc) for group $GROUP "
43
- " $AWS_LC_BUILD_FOLDER " /tool/bssl s_server -curves $GROUP -accept 45000 -debug \
54
+ ${AWS_LC_CMD} s_server -curves $GROUP -accept 45000 -debug \
44
55
& > " $AWS_LC_BUILD_FOLDER " /s_server_out &
45
56
sleep 5 # to allow for the server to startup in the background thread
46
57
S_PID=$!
47
58
# Relying on s2nc behavior that it exits after the first handshake
48
- " $S2N_TLS_BUILD_FOLDER " /bin/s2nc -c default_pq -i localhost 45000 & > " $S2N_TLS_BUILD_FOLDER " /s2nc_out
59
+ ${S2NC_CMD} -c default_pq -i localhost 45000 & > " $S2N_TLS_BUILD_FOLDER " /s2nc_out
49
60
wait $S_PID || true
50
61
cat " $AWS_LC_BUILD_FOLDER " /s_server_out
51
62
cat " $S2N_TLS_BUILD_FOLDER " /s2nc_out
@@ -54,12 +65,12 @@ for GROUP in X25519MLKEM768 SecP256r1MLKEM768; do
54
65
grep " KEM Group" " $S2N_TLS_BUILD_FOLDER " /s2nc_out | grep " $GROUP "
55
66
56
67
echo " TLS Handshake: s2n-tls server (s2nd) with aws-lc client (bssl) for group $GROUP "
57
- " $S2N_TLS_BUILD_FOLDER " /bin/s2nd -c default_pq -i localhost 45000 & > " $S2N_TLS_BUILD_FOLDER " /s2nd_out &
68
+ ${S2ND_CMD} -c default_pq -i localhost 45000 & > " $S2N_TLS_BUILD_FOLDER " /s2nd_out &
58
69
sleep 5 # to allow for the server to startup in the background thread
59
70
S_PID=$!
60
71
# bssl s_client normally does not exit after a handshake, but when run as a background process
61
72
# seems to exit by closing the connection after the first handshake. Relying on that behavior here.
62
- " $AWS_LC_BUILD_FOLDER " /tool/bssl s_client -curves $GROUP -connect localhost:45000 -debug \
73
+ ${AWS_LC_CMD} s_client -curves $GROUP -connect localhost:45000 -debug \
63
74
& > " $AWS_LC_BUILD_FOLDER " /s_client_out &
64
75
wait $S_PID || true
65
76
cat " $S2N_TLS_BUILD_FOLDER " /s2nd_out
@@ -82,14 +93,17 @@ cmake . "-B$BSSL_BUILD_FOLDER" -GNinja -DCMAKE_BUILD_TYPE=Debug
82
93
# Suppress stdout for build
83
94
ninja -C " $BSSL_BUILD_FOLDER " -j " $NUM_CPU_THREADS " > /dev/null
84
95
96
+ [[ -f ${BSSL_CMD} ]] || ( echo " Error building BoringSSL. ${BSSL_CMD} not found." && exit 1 )
97
+ echo " BoringSSL build succeeded. Found ${BSSL_CMD} "
98
+
85
99
# BoringSSL supports only X25519MLKEM768 but not SecP256r1MLKEM768 for key exchange
86
100
for GROUP in X25519MLKEM768; do
87
101
echo " TLS Handshake: aws-lc server (bssl) with boring-ssl client (bssl) for group $GROUP "
88
- " $AWS_LC_BUILD_FOLDER " /tool/bssl s_server -curves $GROUP -accept 45000 -debug \
102
+ ${AWS_LC_CMD} s_server -curves $GROUP -accept 45000 -debug \
89
103
& > " $AWS_LC_BUILD_FOLDER " /s_server_out &
90
104
sleep 5 # to allow for the server to startup in the background thread
91
105
S_PID=$!
92
- " $BSSL_BUILD_FOLDER " /tool/bssl s_client -curves $GROUP -connect localhost:45000 -debug \
106
+ ${BSSL_CMD} s_client -curves $GROUP -connect localhost:45000 -debug \
93
107
& > " $BSSL_BUILD_FOLDER " /s_client_out &
94
108
wait $S_PID || true
95
109
cat " $AWS_LC_BUILD_FOLDER " /s_server_out
@@ -101,11 +115,11 @@ for GROUP in X25519MLKEM768; do
101
115
grep " subject" " $BSSL_BUILD_FOLDER " /s_client_out | grep " BoringSSL"
102
116
103
117
echo " TLS Handshake: boring-ssl server (bssl) with aws-lc client (bssl) for group $GROUP "
104
- " $BSSL_BUILD_FOLDER " /tool/bssl s_server -curves $GROUP -accept 45000 -debug \
118
+ ${BSSL_CMD} s_server -curves $GROUP -accept 45000 -debug \
105
119
& > " $BSSL_BUILD_FOLDER " /s_server_out &
106
120
sleep 5 # to allow for the server to startup in the background thread
107
121
S_PID=$!
108
- " $AWS_LC_BUILD_FOLDER " /tool/bssl s_client -curves $GROUP -connect localhost:45000 -debug \
122
+ ${AWS_LC_CMD} s_client -curves $GROUP -connect localhost:45000 -debug \
109
123
& > " $AWS_LC_BUILD_FOLDER " /s_client_out &
110
124
wait $S_PID || true
111
125
cat " $BSSL_BUILD_FOLDER " /s_server_out
0 commit comments