From c359f65fdb8b40c8a00cc8a84577b49c94d8ac04 Mon Sep 17 00:00:00 2001 From: "Sun, Ceping" Date: Wed, 12 Jul 2023 10:47:17 +0530 Subject: [PATCH] Add the patch to support openssl3.1.1 in ms-tpm-20-ref Refer to the PR:https://github.com/microsoft/ms-tpm-20-ref/pull/93 If the PR is merged, this commit will be dropped. Signed-off-by: Ceping Sun --- .../rust-tpm-20-ref/patches/openssl3.1.1.diff | 34 +++++++++++++++++++ deps/rust-tpm-20-ref/sh_script/pre-build.sh | 1 + 2 files changed, 35 insertions(+) create mode 100644 deps/rust-tpm-20-ref/patches/openssl3.1.1.diff diff --git a/deps/rust-tpm-20-ref/patches/openssl3.1.1.diff b/deps/rust-tpm-20-ref/patches/openssl3.1.1.diff new file mode 100644 index 0000000..26ee4ce --- /dev/null +++ b/deps/rust-tpm-20-ref/patches/openssl3.1.1.diff @@ -0,0 +1,34 @@ +diff --git a/TPMCmd/configure.ac b/TPMCmd/configure.ac +index 58a74b4..4ff3253 100644 +--- a/TPMCmd/configure.ac ++++ b/TPMCmd/configure.ac +@@ -51,7 +51,10 @@ AC_ARG_ENABLE(usedeviceid, + AS_HELP_STRING([--enable-usedeviceid], + [tpm simulator get seeds derived from hardware parameters. Seeds are not derived from secure hardware source.])) + +-PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto]) ++PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto >= 3.0], ++ [AC_DEFINE([OPENSSL_API_COMPAT], [10101])], ++ [PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])]) ++ + AS_IF([test "x$enable_usedeviceid" = "xyes"], [ + PKG_CHECK_MODULES([LIBUDEV], [libudev]) + [ADDITIONAL_LIBS="-ludev"] +diff --git a/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h b/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h +index 9836a3d..0cf9fea 100644 +--- a/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h ++++ b/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h +@@ -49,11 +49,11 @@ + + #define SYMMETRIC_ALIGNMENT RADIX_BYTES + +-#if OPENSSL_VERSION_NUMBER >= 0x10200000L ++#if OPENSSL_VERSION_NUMBER >= 0x30200000L + // Check the bignum_st definition in crypto/bn/bn_lcl.h and either update the + // version check or provide the new definition for this version. + # error Untested OpenSSL version +-#elif OPENSSL_VERSION_NUMBER >= 0x10100000L ++#elif OPENSSL_VERSION_NUMBER >= 0x30000000L + // from crypto/bn/bn_lcl.h + struct bignum_st { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit diff --git a/deps/rust-tpm-20-ref/sh_script/pre-build.sh b/deps/rust-tpm-20-ref/sh_script/pre-build.sh index 0320f55..52b74f4 100755 --- a/deps/rust-tpm-20-ref/sh_script/pre-build.sh +++ b/deps/rust-tpm-20-ref/sh_script/pre-build.sh @@ -6,6 +6,7 @@ patch_mstpm20ref() { git reset --hard d638536 git clean -f -d patch -p 1 -i ../patches/nv.diff + patch -p 1 -i ../patches/openssl3.1.1.diff popd }