Debian Codegraph @

crt/s2n/codebuild/bin/install_openssl_1_0_2_fips.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. 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 pushd "$(pwdscip-shell system . . pwd.)"
18
19 usagescip-shell shell shell-project 0.0.0 usage().() {
20 echoscip-shell system . . echo. "install_openssl_1_0_2_fips.sh build_dir install_dir os_name"
21 exit 1
22 }
23
24 if [scip-shell system . . `[`. "$#" -ne "3" ]; then
25 usagescip-shell shell shell-project 0.0.0 usage().
26 fi
27
28 BUILD_DIR=$1
29 INSTALL_DIR=$2
30 OS_NAME=$3
31
32 if [scip-shell system . . `[`. "$OS_NAME" == "linux" ]; then
33 CONFIGURE="./config -d"
34 elif [scip-shell system . . `[`. "$OS_NAME" == "osx" ]; then
35 echoscip-shell system . . echo. "WARNING: FIPS and MacOS is not officially supported. This build should only be used for local debugging."
36 echoscip-shell system . . echo. "See: http://openssl.6102.n7.nabble.com/Openssl-Fips-build-for-Mac-OSX-64-bit-td44716.html"
37 CONFIGURE="./Configure darwin64-x86_64-cc"
38 else
39 echoscip-shell system . . echo. "Invalid platform! $OS_NAME"
40 usagescip-shell shell shell-project 0.0.0 usage().
41 fi
42
43 # Install the FIPS object module in accordance with OpenSSL FIPS 140-2 Security Policy Annex A.
44 # https://www.openssl.org/docs/fips/SecurityPolicy-2.0.pdf
45 # This installation is not FIPS compliant as we do not own the build system architecture.
46 # It may only be used for testing purposes.
47 #
48 # There is no 'latest' download URL for the FIPS object modules
49 cd "$BUILD_DIR"
50 # Originally from: http://www.openssl.org/source/openssl-fips-2.0.13.tar.gz
51 curlscip-shell system . . curl. --retry 3 https://s3-us-west-2.amazonaws.com/s2n-public-test-dependencies/2017-08-31_openssl-fips-2.0.13.tar.gz --output openssl-fips-2.0.13.tar.gz
52 gunzipscip-shell system . . gunzip. -c openssl-fips-2.0.13.tar.gz | tarscip-shell system . . tar. xf -
53 rmscip-shell system . . rm. openssl-fips-2.0.13.tar.gz
54 cd openssl-fips-2.0.13
55 mkdirscip-shell system . . mkdir. ../OpensslFipsModule
56 FIPSDIR="$(pwdscip-shell system . . pwd.)/../OpensslFipsModule"
57 export FIPSDIR
58 chmodscip-shell system . . chmod. +x ./Configure
59 $CONFIGURE
60 makescip-shell system . . make.
61 makescip-shell system . . make. install
62
63 cd "$BUILD_DIR"
64 curlscip-shell system . . curl. --retry 3 -L https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip --output openssl-OpenSSL_1_0_2-stable.zip
65 unzip openssl-OpenSSL_1_0_2-stable.zip
66 cd openssl-OpenSSL_1_0_2-stable
67
68 FIPS_OPTIONS="fips --with-fipsdir=$FIPSDIR shared"
69
70 $CONFIGURE $FIPS_OPTIONS -g3 -fPIC no-libunbound no-gmp no-jpake no-krb5 no-md2 no-rc5 \
71 no-rfc3779 no-sctp no-ssl-trace no-store no-zlib no-hw no-mdc2 no-seed no-idea \
72 enable-ec_nistp_64_gcc_128 no-camellia no-bf no-ripemd no-dsa no-ssl2 no-capieng -DSSL_FORBID_ENULL \
73 -DOPENSSL_NO_DTLS1 -DOPENSSL_NO_HEARTBEATS --prefix="$INSTALL_DIR"
74
75 makescip-shell system . . make. depend
76 makescip-shell system . . make.
77 makescip-shell system . . make. install_sw
78
79 popd
80
81 exit 0
82