Debian Codegraph @

crt/s2n/codebuild/bin/install_default_dependencies.sh

raw symbols SCIP
1 #!/bin/bash
2 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License").
5 # You may not use this file except in compliance with the License.
6 # A copy of the License is located at
7 #
8 # http://aws.amazon.com/apache2.0
9 #
10 # or in the "license" file accompanying this file. This file is distributed
11 # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 # express or implied. See the License for the specific language governing
13 # permissions and limitations under the License.
14 #
15
16 set -ex
17 source codebuild/bin/s2n_setup_env.sh
18
19
20 # Install latest version of clang, clang++, and llvm-symbolizer. Needed for fuzzing.
21 if [[ "$TESTS" == "fuzz" || "$TESTS" == "ALL" || "$LATEST_CLANG" == "true" ]]; then
22 mkdir -p "$LATEST_CLANG_INSTALL_DIR"||true
23 codebuild/bin/install_clang.sh "$(mktemp -d)" "$LATEST_CLANG_INSTALL_DIR" "$OS_NAME" > /dev/null ;
24 fi
25
26 # Download and Install Openssl 1.1.1
27 if [[ ("$S2N_LIBCRYPTO" == "openssl-1.1.1") || ( "$TESTS" == "integrationv2" || "$TESTS" == "ALL" ) ]]; then
28 if [[ ! -x "$OPENSSL_1_1_1_INSTALL_DIR/bin/openssl" ]]; then
29 mkdir -p "$OPENSSL_1_1_1_INSTALL_DIR"||true
30 codebuild/bin/install_openssl_1_1_1.sh "$(mktemp -d)" "$OPENSSL_1_1_1_INSTALL_DIR" "$OS_NAME" > /dev/null ;
31 fi
32 fi
33
34 # Download and Install Openssl 3.0
35 if [[ "$S2N_LIBCRYPTO" == "openssl-3.0" && ! -d "$OPENSSL_3_0_INSTALL_DIR" ]]; then
36 mkdir -p "$OPENSSL_3_0_INSTALL_DIR"
37 codebuild/bin/install_openssl_3_0.sh "$(mktemp -d)" "$OPENSSL_3_0_INSTALL_DIR" "$OS_NAME" > /dev/null ;
38 fi
39
40 # Download and Install Openssl 3.0 FIPS
41 if [[ "$S2N_LIBCRYPTO" == "openssl-3.0-fips" && ! -d "$OPENSSL_3_FIPS_INSTALL_DIR" ]]; then
42 mkdir -p "$OPENSSL_3_FIPS_INSTALL_DIR"
43 codebuild/bin/install_openssl_3_0.sh "$(mktemp -d)" "$OPENSSL_3_FIPS_INSTALL_DIR" "$OS_NAME" fips > /dev/null ;
44 fi
45
46 # Download and Install Openssl 1.0.2
47 if [[ "$S2N_LIBCRYPTO" == "openssl-1.0.2" && ! -d "$OPENSSL_1_0_2_INSTALL_DIR" ]]; then
48 mkdir -p "$OPENSSL_1_0_2_INSTALL_DIR"||true
49 codebuild/bin/install_openssl_1_0_2.sh "$(mktemp -d)" "$OPENSSL_1_0_2_INSTALL_DIR" "$OS_NAME" > /dev/null ;
50 fi
51
52 # Download and Install the Openssl FIPS module and Openssl 1.0.2-fips
53 if [[ "$S2N_LIBCRYPTO" == "openssl-1.0.2-fips" ]] && [[ ! -d "$OPENSSL_1_0_2_FIPS_INSTALL_DIR" ]]; then
54 codebuild/bin/install_openssl_1_0_2_fips.sh "$(mktemp -d)" "$OPENSSL_1_0_2_FIPS_INSTALL_DIR" "$OS_NAME" ; fi
55
56 # Download and Install LibreSSL
57 if [[ "$S2N_LIBCRYPTO" == "libressl" && ! -d "$LIBRESSL_INSTALL_DIR" ]]; then
58 mkdir -p "$LIBRESSL_INSTALL_DIR"||true
59 codebuild/bin/install_libressl.sh "$(mktemp -d)" "$LIBRESSL_INSTALL_DIR" > /dev/null ;
60 fi
61
62 # Download and Install BoringSSL
63 if [[ "$S2N_LIBCRYPTO" == "boringssl" && ! -d "$BORINGSSL_INSTALL_DIR" ]]; then
64 codebuild/bin/install_boringssl.sh "$(mktemp -d)" "$BORINGSSL_INSTALL_DIR" > /dev/null ;
65 fi
66
67 # Download and Install AWS-LC
68 if [[ "$S2N_LIBCRYPTO" == "awslc" && ! -d "$AWSLC_INSTALL_DIR" ]]; then
69 codebuild/bin/install_awslc.sh "$(mktemp -d)" "$AWSLC_INSTALL_DIR" > /dev/null ;
70 fi
71
72 if [[ "$S2N_LIBCRYPTO" == "awslc-fips-2022" && ! -d "$AWSLC_FIPS_2022_INSTALL_DIR" ]]; then
73 codebuild/bin/install_awslc.sh "$(mktemp -d)" "$AWSLC_FIPS_2022_INSTALL_DIR" "2022" > /dev/null ;
74 fi
75 if [[ "$S2N_LIBCRYPTO" == "awslc-fips-2024" && ! -d "$AWSLC_FIPS_2024_INSTALL_DIR" ]]; then
76 codebuild/bin/install_awslc_fips_2024.sh "$(mktemp -d)" "$AWSLC_FIPS_2024_INSTALL_DIR" "2024" > /dev/null ;
77 fi
78
79 if [[ "$TESTS" == "integrationv2" || "$TESTS" == "ALL" ]]; then
80 # Install tox
81 if [[ "$DISTRO" == "ubuntu" ]]; then
82 if [[ ! -x `python3.9 -m tox --version` ]]; then
83 python3.9 -m pip install tox
84 fi
85 else
86 if [[ ! -x `which tox` ]]; then
87 case "$DISTRO" in
88 "amazon linux")
89 yum install -y python3-pip
90 python3 -m pip install --user tox ;;
91 "apple")
92 brew install python@3
93 python3 -m pip install --user tox ;;
94 *)
95 echo "Unknown platform $DISTRO trying to install tox on $OS_NAME $ARCH"
96 exit 1
97 ;;
98 esac
99 fi
100 fi
101
102 if [[ ! -x "$GNUTLS37_INSTALL_DIR/bin/gnutls-cli" ]]; then
103 # Download and Install GnuTLS for integration tests
104 mkdir -p "$GNUTLS37_INSTALL_DIR"||true
105 codebuild/bin/install_gnutls37.sh "$(mktemp -d)" "$GNUTLS37_INSTALL_DIR" > /dev/null ;
106 fi
107
108 if [[ "$DISTRO" == "ubuntu" ]]; then
109 # Install SSLyze for all Integration Tests on Ubuntu.
110 # There is a nassl dependency issue preventing this from working on on AL2 ARM (others?).
111 if [[ "$S2N_NO_SSLYZE" != "true" ]]; then
112 codebuild/bin/install_sslyze.sh
113 fi
114
115 if [[ ! -x "$APACHE2_INSTALL_DIR/apache2.conf" ]]; then
116 codebuild/bin/install_apache2.sh codebuild/bin/apache2 "$APACHE2_INSTALL_DIR"
117 fi
118 fi
119 fi
120
121 # Install SAW, Z3, and Yices for formal verification
122 if [[ "$SAW" == "true" || "$TESTS" == "ALL" ]]; then
123 mkdir -p "$SAW_INSTALL_DIR"||true
124 codebuild/bin/install_saw.sh "$(mktemp -d)" "$SAW_INSTALL_DIR" > /dev/null ;
125
126 mkdir -p "$Z3_INSTALL_DIR"||true
127 codebuild/bin/install_z3_yices.sh "$(mktemp -d)" "$Z3_INSTALL_DIR" > /dev/null ;
128 fi
129
130 if [[ ! -x `which cmake` ]]; then
131 case "$DISTRO" in
132 "ubuntu")
133 apt-get -y install cmake
134 ;;
135 "amazon linux")
136 yum install -y cmake3
137 update-alternatives --install /usr/bin/cmake cmake /usr/bin/cmake3 30
138 ;;
139 "apple")
140 brew install cmake
141 ;;
142 *)
143 echo "Unknown platform for cmake."
144 ;;
145 esac
146 fi