1
1
#! /bin/bash
2
-
3
2
#
4
- # Copyright (C) 2011-2020 Intel Corporation. All rights reserved.
3
+ # Copyright (C) 2011-2024 Intel Corporation. All rights reserved.
5
4
#
6
5
# Redistribution and use in source and binary forms, with or without
7
6
# modification, are permitted provided that the following conditions
37
36
SGXSSL_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
38
37
echo $SGXSSL_ROOT
39
38
40
- OPENSSL_VERSION=` ls $SGXSSL_ROOT /../openssl_source/* 3.0 .* .tar.gz | head -1 | grep -o ' [^/]*$' | sed -s -- ' s/\.tar\.gz//' `
39
+ OPENSSL_VERSION=` ls $SGXSSL_ROOT /../openssl_source/* 3.1 .* .tar.gz | head -1 | grep -o ' [^/]*$' | sed -s -- ' s/\.tar\.gz//' `
41
40
if [ " $OPENSSL_VERSION " == " " ]
42
41
then
43
42
echo " In order to run this script, OpenSSL tar.gz package must be located in openssl_source/ directory."
@@ -53,7 +52,7 @@ mkdir -p $SGXSSL_ROOT/package/lib64/
53
52
# build openssl modules, clean previous openssl dir if it exist
54
53
cd $SGXSSL_ROOT /../openssl_source || exit 1
55
54
rm -rf $OPENSSL_VERSION
56
- tar xvf $OPENSSL_VERSION .tar.gz || exit 1
55
+ tar xvf $OPENSSL_VERSION .tar.gz > /dev/null || exit 1
57
56
58
57
# Remove AESBS to support only AESNI and VPAES
59
58
sed -i ' /BSAES_ASM/d' $OPENSSL_VERSION /Configure
@@ -80,6 +79,13 @@ if [[ "$*" == *"only3x"* ]] ; then
80
79
ADDITIONAL_CONF+=" --api=3.0 no-deprecated "
81
80
fi
82
81
82
+ if [[ " $* " == * " fips" * ]] ; then
83
+ ADDITIONAL_CONF+=" -DSGXSSL_FIPS "
84
+ cp bss_file.c $OPENSSL_VERSION /crypto/bio/ || exit 1
85
+ cp conf_mod.c $OPENSSL_VERSION /crypto/conf/ || exit 1
86
+ cp o_fopen.c $OPENSSL_VERSION /crypto/ || exit 1
87
+ fi
88
+
83
89
# Mitigation flags
84
90
MITIGATION_OPT=" "
85
91
MITIGATION_FLAGS=" "
@@ -139,7 +145,7 @@ cp sgx_config.conf $OPENSSL_VERSION/ || exit 1
139
145
cp x86_64-xlate.pl $OPENSSL_VERSION /crypto/perlasm/ || exit 1
140
146
141
147
cd $SGXSSL_ROOT /../openssl_source/$OPENSSL_VERSION || exit 1
142
- perl Configure --config=sgx_config.conf sgx-linux-x86_64 --with-rand-seed=none $ADDITIONAL_CONF $SPACE_OPT $MITIGATION_FLAGS no-idea no-mdc2 no-rc5 no-rc4 no-bf no-ec2m no-camellia no-cast no-srp no-async no-padlockeng no-dso no-shared no-ssl3 no-md2 no-md4 no-ui-console no-stdio no-afalgeng -D_FORTIFY_SOURCE=2 -DGETPID_IS_MEANINGLESS -include$SGXSSL_ROOT /../openssl_source/bypass_to_sgxssl.h || exit 1
148
+ perl Configure --config=sgx_config.conf sgx-linux-x86_64 --with-rand-seed=none $ADDITIONAL_CONF $SPACE_OPT $MITIGATION_FLAGS no-idea no-mdc2 no-rc5 no-rc4 no-bf no-ec2m no-camellia no-cast no-srp no-async no-padlockeng no-dso no-shared no-ssl3 no-md2 no-md4 no-ui-console no-stdio no-afalgeng -D_FORTIFY_SOURCE=2 -DGETPID_IS_MEANINGLESS -DOPENSSL_NO_POSIX_IO - include$SGXSSL_ROOT /../openssl_source/bypass_to_sgxssl.h || exit 1
143
149
144
150
sed -i ' s/ENGINE_set_default_RAND/dummy_ENGINE_set_default_RAND/' crypto/engine/tb_rand.c || exit 1
145
151
sed -i ' s/return RUN_ONCE(&locale_base, ossl_init_locale_base);/return 1;/' crypto/ctype.c || exit 1
@@ -166,4 +172,6 @@ cp include/openssl/* $SGXSSL_ROOT/package/include/openssl/ || exit 1
166
172
grep OPENSSL_VERSION_STR include/openssl/opensslv.h > $SGXSSL_ROOT /sgx/osslverstr.h || exit 1
167
173
cp -r include/crypto $SGXSSL_ROOT /sgx/test_app/enclave/ || exit 1
168
174
cp -r include/internal $SGXSSL_ROOT /sgx/test_app/enclave/ || exit 1
175
+ cp -r include/crypto $SGXSSL_ROOT /sgx/fips_test/trusted/ || exit 1
176
+ cp -r include/internal $SGXSSL_ROOT /sgx/fips_test/trusted/ || exit 1
169
177
exit 0
0 commit comments