Skip to content

Commit

Permalink
Add the patch to support openssl3.1.1 in ms-tpm-20-ref
Browse files Browse the repository at this point in the history
Refer to the PR:microsoft/ms-tpm-20-ref#93
If the PR is merged, this commit will be dropped.

Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
  • Loading branch information
sunceping committed Jul 18, 2023
1 parent d87e741 commit 63c55ec
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions deps/rust-tpm-20-ref/patches/openssl3.1.1.diff
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions deps/rust-tpm-20-ref/sh_script/pre-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 63c55ec

Please sign in to comment.