tpm: Use compiler environment to determine proper RADIX_BITS.
Expecting users to change code in order to build for 64bit environments
isn't very user friendly. In the case of the RADIX_BITS we can make this
easier on users (and automated builds) by using the compiler environment
to do the detection for us. Currently the implementation is limited to
the __x86_64__ / __i386__ and _WIN64 / _WIN32 macros from linux /
windows compilers respectively.
An alternative implementation may have used the OpenSSL bn_ops values to
determine 32 vs 64bit. This ends up being awkward since Implementation.h
is included by other modules and they then end up depending on the
openssl headers.
Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
diff --git a/TPMCmd/tpm/include/Implementation.h b/TPMCmd/tpm/include/Implementation.h
index 7bab566..72511ce 100644
--- a/TPMCmd/tpm/include/Implementation.h
+++ b/TPMCmd/tpm/include/Implementation.h
@@ -152,7 +152,13 @@
// Table 0:7 - Defines for Implementation Values
#define FIELD_UPGRADE_IMPLEMENTED NO
+#if defined(__x86_64__) || defined(_WIN64)
+#define RADIX_BITS 64
+#elif defined(__i386__) || defined(_WIN32)
#define RADIX_BITS 32
+#else
+#error "Unable to determine RADIX_BITS from compiler environment."
+#endif
#define HASH_ALIGNMENT 4
#define SYMMETRIC_ALIGNMENT 4
#ifdef USE_WOLFCRYPT