From: Mimi Zohar <zohar@linux.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.ibm.com>, Petr Vorel <pvorel@suse.cz>,
Vitaly Chikunov <vt@altlinux.org>,
Stefan Berger <stefanb@linux.ibm.com>
Subject: [PATCH ima-evm-utils v4 16/17] Build OpenSSL without engine support
Date: Tue, 1 Nov 2022 16:18:02 -0400 [thread overview]
Message-ID: <20221101201803.372652-17-zohar@linux.ibm.com> (raw)
In-Reply-To: <20221101201803.372652-1-zohar@linux.ibm.com>
Fix COMPILE_SSL to build for the proper architecture, link with the
appropriate library, and set up library path for evmctl.
Compile OpenSSL with "no-engine" and "no-dynamic-engine" support.
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
.github/workflows/ci.yml | 4 ++--
.travis.yml | 2 +-
build.sh | 8 ++++++++
src/evmctl.c | 4 +++-
tests/install-openssl3.sh | 9 ++++++++-
5 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5595855512e4..8223b8767351 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -114,7 +114,7 @@ jobs:
INSTALL="${INSTALL%%/*}"
if [ "$VARIANT" ]; then ARCH="$ARCH" ./ci/$INSTALL.$VARIANT.sh; fi
ARCH="$ARCH" CC="$CC" TSS="$TSS" ./ci/$INSTALL.sh
- if [ "$COMPILE_SSL" ]; then COMPILE_SSL="$COMPILE_SSL" ./tests/install-openssl3.sh; fi
+ if [ "$COMPILE_SSL" ]; then COMPILE_SSL="$COMPILE_SSL" VARIANT="$VARIANT" ./tests/install-openssl3.sh; fi
- name: Build swtpm
run: |
@@ -129,4 +129,4 @@ jobs:
run: $CC --version
- name: Compile
- run: CC="$CC" VARIANT="$VARIANT" ./build.sh
+ run: CC="$CC" VARIANT="$VARIANT" COMPILE_SSL="$COMPILE_SSL" ./build.sh
diff --git a/.travis.yml b/.travis.yml
index 09db401928f6..faaa4b5d675b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -95,4 +95,4 @@ script:
- INSTALL="${DISTRO#${REPO}}"
- INSTALL="${INSTALL%%:*}"
- INSTALL="${INSTALL%%/*}"
- - $CONTAINER run $CONTAINER_ARGS -t ima-evm-utils /bin/sh -c "if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./ci/$INSTALL.$VARIANT.sh; fi && ARCH=\"$ARCH\" CC=\"$CC\" TSS=\"$TSS\" ./ci/$INSTALL.sh && if [ "$COMPILE_SSL" ]; then COMPILE_SSL="$COMPILE_SSL" ./tests/install-openssl3.sh; fi && if [ ! \"$VARIANT\" ]; then which tpm_server || which swtpm || if which tssstartup; then ./tests/install-swtpm.sh; fi; fi && CC=\"$CC\" VARIANT=\"$VARIANT\" ./build.sh"
+ - $CONTAINER run $CONTAINER_ARGS -t ima-evm-utils /bin/sh -c "if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./ci/$INSTALL.$VARIANT.sh; fi && ARCH=\"$ARCH\" CC=\"$CC\" TSS=\"$TSS\" ./ci/$INSTALL.sh && if [ \"$COMPILE_SSL\" ]; then COMPILE_SSL=\"$COMPILE_SSL\" VARIANT=\"$VARIANT\" ./tests/install-openssl3.sh; fi && if [ ! \"$VARIANT\" ]; then which tpm_server || which swtpm || if which tssstartup; then ./tests/install-swtpm.sh; fi; fi && CC=\"$CC\" VARIANT=\"$VARIANT\" COMPILE_SSL=\"$COMPILE_SSL\" ./build.sh"
diff --git a/build.sh b/build.sh
index c4d28f1302c6..0c2fdd9e995d 100755
--- a/build.sh
+++ b/build.sh
@@ -32,6 +32,14 @@ log_exit()
cd `dirname $0`
+if [ "$COMPILE_SSL" ]; then
+ echo "COMPILE_SSL: $COMPILE_SSL"
+ export CFLAGS="-I/opt/openssl3/include $CFLAGS"
+ export LD_LIBRARY_PATH="/opt/openssl3/lib64:/opt/openssl3/lib:$HOME/src/ima-evm-utils/src/.libs:$LD_LIBRARY_PATH"
+ export LDFLAGS="-L/opt/openssl3/lib64 -L/opt/openssl3/lib $LDFLAGS"
+ export PATH="/opt/openssl3/bin:$HOME/src/ima-evm-utils/src/.libs:$PATH"
+fi
+
case "$VARIANT" in
i386)
echo "32-bit compilation"
diff --git a/src/evmctl.c b/src/evmctl.c
index 2fc11db77ec3..349215eeb632 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -2977,8 +2977,10 @@ int main(int argc, char *argv[])
#if CONFIG_IMA_EVM_ENGINE
case 139: /* --engine e */
imaevm_params.eng = setup_engine(optarg);
- if (!imaevm_params.eng)
+ if (!imaevm_params.eng) {
+ log_info("setup_engine failed\n");
goto error;
+ }
break;
#endif
case 140: /* --xattr-user */
diff --git a/tests/install-openssl3.sh b/tests/install-openssl3.sh
index 1b634681a760..911c32bcf87c 100755
--- a/tests/install-openssl3.sh
+++ b/tests/install-openssl3.sh
@@ -13,7 +13,14 @@ wget --no-check-certificate https://github.com/openssl/openssl/archive/refs/tags
tar --no-same-owner -xzf ${version}.tar.gz
cd openssl-${version}
-./Configure --prefix=/opt/openssl3 --openssldir=/opt/openssl3/ssl
+if [ "$VARIANT" = "i386" ]; then
+ echo "32-bit compilation"
+ FLAGS="-m32 linux-generic32"
+fi
+
+./Configure $FLAGS no-engine no-dynamic-engine --prefix=/opt/openssl3 --openssldir=/opt/openssl3
+# Uncomment for debugging
+# perl configdata.pm --dump | grep engine
make -j$(nproc)
# only install apps and library
sudo make install_sw
--
2.31.1
next prev parent reply other threads:[~2022-11-01 20:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 20:17 [PATCH ima-evm-utils v4 00/17] address deprecated warnings Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 01/17] Revert "Reset 'errno' after failure to open or access a file" Mimi Zohar
2022-11-01 21:46 ` Stefan Berger
2022-11-01 23:04 ` Mimi Zohar
2022-11-02 0:25 ` Stefan Berger
2022-11-03 13:54 ` Mimi Zohar
2022-11-03 14:32 ` Petr Vorel
2022-11-03 21:35 ` Mimi Zohar
2022-11-03 22:50 ` Vitaly Chikunov
2022-11-13 21:25 ` Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 02/17] log and reset 'errno' after failure to open non-critical files Mimi Zohar
2022-11-02 21:02 ` Stefan Berger
2022-11-03 3:13 ` Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 03/17] Log and reset 'errno' on lsetxattr failure Mimi Zohar
2022-11-02 15:55 ` Stefan Berger
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 04/17] travis: update dist=focal Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 05/17] Update configure.ac to address a couple of obsolete warnings Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 06/17] Deprecate IMA signature version 1 Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 07/17] Replace the low level SHA1 calls when calculating the TPM 1.2 PCRs Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 08/17] Replace the low level HMAC calls when calculating the EVM HMAC Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 09/17] Add missing EVP_MD_CTX_free() call in calc_evm_hash() Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 10/17] Disable use of OpenSSL "engine" support Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 11/17] Fix potential use after free in read_tpm_banks() Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 12/17] Limit the file hash algorithm name length Mimi Zohar
2022-11-01 20:17 ` [PATCH ima-evm-utils v4 13/17] Missing template data size lower bounds checking Mimi Zohar
2022-11-01 20:18 ` [PATCH ima-evm-utils v4 14/17] Base sm2/sm3 test on openssl version installed Mimi Zohar
2022-11-01 21:25 ` Stefan Berger
2022-11-01 20:18 ` [PATCH ima-evm-utils v4 15/17] Compile a newer version of OpenSSL Mimi Zohar
2022-11-01 20:18 ` Mimi Zohar [this message]
2022-11-01 20:18 ` [PATCH ima-evm-utils v4 17/17] Fix d2i_x509_fp failure Mimi Zohar
2022-11-02 0:44 ` Stefan Berger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221101201803.372652-17-zohar@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=linux-integrity@vger.kernel.org \
--cc=pvorel@suse.cz \
--cc=stefanb@linux.ibm.com \
--cc=vt@altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).