Skip to content

Commit

Permalink
tpm: Use compiler environment to determine proper RADIX_BITS.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
flihp committed Dec 10, 2018
1 parent 65b6535 commit 2140b75
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions TPMCmd/tpm/include/Implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2140b75

Please sign in to comment.