1#!/bin/bash 2# Copyright (C) 2022 Huawei Technologies Co., Ltd. 3# Licensed under the Mulan PSL v2. 4# You can use this software according to the terms and conditions of the Mulan PSL v2. 5# You may obtain a copy of Mulan PSL v2 at: 6# http://license.coscl.org.cn/MulanPSL2 7# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9# PURPOSE. 10# See the Mulan PSL v2 for more details. 11set -e 12 13third_party_ossl_path="$1/openssl" 14copy_path="$2/lib/teelib/libopenssl/" 15cp -r "${third_party_ossl_path}" "${copy_path}" 16rm "${copy_path}/openssl/bundle.json" 17 18cd "${copy_path}/openssl" 19 20# config and generate dso_conf.h 21echo "before ./config " 22chmod +x ./config 23./config 24make include/crypto/dso_conf.h 25cp "$2"/lib/teelib/libopenssl/include/bn_conf.h ./include/crypto/ 26 27if [ "$CONFIG_CRYPTO_SOFT_ENGINE" == "openssl3" ]; then 28 make include/openssl/asn1.h 29 make include/openssl/asn1t.h 30 make include/openssl/bio.h 31 make include/openssl/cmp.h 32 make include/openssl/cms.h 33 make include/openssl/conf.h 34 make include/openssl/crmf.h 35 make include/openssl/crypto.h 36 make include/openssl/err.h 37 make include/openssl/lhash.h 38 make include/openssl/ocsp.h 39 make include/openssl/opensslv.h 40 make include/openssl/pkcs7.h 41 make include/openssl/pkcs12.h 42 make include/openssl/safestack.h 43 make include/openssl/srp.h 44 make include/openssl/ui.h 45 make include/openssl/x509.h 46 make include/openssl/x509_vfy.h 47 make include/openssl/x509v3.h 48 make providers/common/include/prov/der_digests.h 49 make providers/common/include/prov/der_ec.h 50 make providers/common/include/prov/der_rsa.h 51 make providers/common/include/prov/der_sm2.h 52 make providers/common/include/prov/der_wrap.h 53 make providers/common/include/prov/der_ecx.h 54 make providers/common/der/der_rsa_gen.c 55 make providers/common/der/der_wrap_gen.c 56 make providers/common/der/der_ec_gen.c 57 make providers/common/der/der_ecx_gen.c 58 cd include/openssl && patch -p0 < ../../../include/preprocess-openssl3.patch 59else 60 cd include/openssl && patch -p0 < ../../../include/preprocess-openssl.patch 61fi 62 63