Upgrade ms-tpm-20-ref to 37055a67311632e9324af11eadb4b25cfbff77e9
Exempt-From-Owner-Approval: upgrade with no code change
Change-Id: I0e32ccda2b41fba5451960a91c2fed4f17c84e64
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..d404785
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,58 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+ name: "ms-tpm-20-ref-defaults",
+ local_include_dirs: [
+ "TPMCmd/Platform/include",
+ "TPMCmd/Platform/include/prototypes",
+ "TPMCmd/Simulator/include",
+ "TPMCmd/Simulator/include/prototypes",
+ "TPMCmd/tpm/include",
+ "TPMCmd/tpm/include/Ossl",
+ "TPMCmd/tpm/include/prototypes",
+ ],
+ device_supported: false,
+ host_supported: true,
+ shared_libs: [
+ "libcrypto",
+ ],
+ cflags: [
+ "-DMAX_SYM_DATA=256",
+ "-DDEBUG=YES",
+ "-DALG_CAMELLIA=ALG_NO",
+ "-Wno-logical-op-parentheses",
+ "-Wno-empty-body",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-parameter",
+ "-Wno-typedef-redefinition",
+ ],
+}
+
+cc_binary_host {
+ name: "ms-tpm-20-ref",
+ srcs: [
+ "TPMCmd/Platform/src/*.c",
+ "TPMCmd/Simulator/src/*.c",
+ "TPMCmd/tpm/src/command/**/*.c",
+ "TPMCmd/tpm/src/crypt/*.c",
+ "TPMCmd/tpm/src/crypt/ossl/*.c",
+ "TPMCmd/tpm/src/events/*.c",
+ "TPMCmd/tpm/src/main/*.c",
+ "TPMCmd/tpm/src/subsystem/*.c",
+ "TPMCmd/tpm/src/support/*.c",
+ "TPMCmd/tpm/src/X509/*.c",
+ ],
+ defaults: [ "ms-tpm-20-ref-defaults" ],
+}
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..af4bc98
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,15 @@
+name: "MS TPM 2.0 Reference Implementation"
+description: "The official TCG reference implementation of the TPM 2.0 Specification."
+third_party {
+ url {
+ type: GIT
+ value: "https://github.com/microsoft/ms-tpm-20-ref.git"
+ }
+ version: "37055a67311632e9324af11eadb4b25cfbff77e9"
+ license_type: NOTICE
+ last_upgrade_date {
+ year: 2020
+ month: 4
+ day: 14
+ }
+}
diff --git a/MODULE_LICENSE_BSD b/MODULE_LICENSE_BSD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..a65e9bf
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h b/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h
index aa376c7..67cfafd 100644
--- a/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h
+++ b/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h
@@ -49,26 +49,6 @@
#define SYMMETRIC_ALIGNMENT RADIX_BYTES
-#if OPENSSL_VERSION_NUMBER >= 0x10200000L
- // 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
- // from crypto/bn/bn_lcl.h
- struct bignum_st {
- BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit
- * chunks. */
- int top; /* Index of last used d +1. */
- /* The next are internal book keeping for bn_expand. */
- int dmax; /* Size of the d array. */
- int neg; /* one if the number is negative */
- int flags;
- };
-#else
-# define EC_POINT_get_affine_coordinates EC_POINT_get_affine_coordinates_GFp
-# define EC_POINT_set_affine_coordinates EC_POINT_set_affine_coordinates_GFp
-#endif // OPENSSL_VERSION_NUMBER
-
#include <openssl/bn.h>
//** Macros and Defines
diff --git a/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c b/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c
index 484bec4..5f8bd34 100644
--- a/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c
+++ b/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c
@@ -82,10 +82,10 @@
{
int i;
//
- VERIFY((unsigned)osslBn->top <= BnGetAllocated(bn));
- for(i = 0; i < osslBn->top; i++)
+ VERIFY((unsigned)osslBn->width <= BnGetAllocated(bn));
+ for(i = 0; i < osslBn->width; i++)
bn->d[i] = osslBn->d[i];
- BnSetTop(bn, osslBn->top);
+ BnSetTop(bn, osslBn->width);
}
return TRUE;
Error:
@@ -108,7 +108,7 @@
return NULL;
toInit->d = (BN_ULONG *)&initializer->d[0];
toInit->dmax = (int)initializer->allocated;
- toInit->top = (int)initializer->size;
+ toInit->width = (int)initializer->size;
toInit->neg = 0;
toInit->flags = 0;
return toInit;
@@ -202,7 +202,7 @@
// Convert the test data to an OpenSSL BIGNUM
BN_bin2bn(test, sizeof(test), osslTemp);
// Make sure the values are consistent
- VERIFY(osslTemp->top == (int)tpmTemp->size);
+ VERIFY(osslTemp->width == (int)tpmTemp->size);
for(i = 0; i < tpmTemp->size; i++)
VERIFY(osslTemp->d[i] == tpmTemp->d[i]);
OSSL_LEAVE();
@@ -582,7 +582,6 @@
)
{
EC_POINT *pR = EC_POINT_new(E->G);
- EC_POINT *pS = EcPointInitialized(S, E);
BIG_INITIALIZED(bnD, d);
EC_POINT *pQ = EcPointInitialized(Q, E);
BIG_INITIALIZED(bnU, u);
@@ -591,17 +590,10 @@
EC_POINT_mul(E->G, pR, bnD, pQ, bnU, E->CTX);
else
{
- const EC_POINT *points[2];
- const BIGNUM *scalars[2];
- points[0] = pS;
- points[1] = pQ;
- scalars[0] = bnD;
- scalars[1] = bnU;
- EC_POINTs_mul(E->G, pR, NULL, 2, points, scalars, E->CTX);
+ return FALSE;
}
PointFromOssl(R, pR, E);
EC_POINT_free(pR);
- EC_POINT_free(pS);
EC_POINT_free(pQ);
return !BnEqualZero(R->z);
}
@@ -635,4 +627,4 @@
#endif // ALG_ECC
-#endif // MATHLIB OSSL
\ No newline at end of file
+#endif // MATHLIB OSSL