Fixed the WolfSSL Windows build of the reference implementation broken by the Implementation.h refactoring.
diff --git a/TPMCmd/tpm/Tpm.vcxproj b/TPMCmd/tpm/Tpm.vcxproj
index 35194fc..d9681ad 100644
--- a/TPMCmd/tpm/Tpm.vcxproj
+++ b/TPMCmd/tpm/Tpm.vcxproj
@@ -418,7 +418,7 @@
     <ClCompile>

       <Optimization>Disabled</Optimization>

       <AdditionalIncludeDirectories>$(ProjectDir)include\wolf;$(SolutionDir)..\external\wolfssl;$(SolutionDir)\wolfcrypt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

-      <PreprocessorDefinitions>USE_WOLFCRYPT;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <PreprocessorDefinitions>HASH_LIB=Wolf;SYM_LIB=Wolf;MATH_LIB=Wolf;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

       <MinimalRebuild>false</MinimalRebuild>

       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>

       <PrecompiledHeader>NotUsing</PrecompiledHeader>

@@ -427,7 +427,7 @@
       <CallingConvention>Cdecl</CallingConvention>

       <CompileAs>CompileAsC</CompileAs>

       <StructMemberAlignment>Default</StructMemberAlignment>

-      <DisableSpecificWarnings>4820;4255</DisableSpecificWarnings>

+      <DisableSpecificWarnings>4668;4820;4255</DisableSpecificWarnings>

       <BrowseInformation>true</BrowseInformation>

       <InlineFunctionExpansion>Default</InlineFunctionExpansion>

       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

@@ -682,7 +682,7 @@
     <ClCompile>

       <Optimization>Disabled</Optimization>

       <AdditionalIncludeDirectories>$(ProjectDir)include\wolf;$(SolutionDir)..\external\wolfssl;$(SolutionDir)\wolfcrypt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

-      <PreprocessorDefinitions>USE_WOLFCRYPT;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <PreprocessorDefinitions>HASH_LIB=Wolf;SYM_LIB=Wolf;MATH_LIB=Wolf;WOLFSSL_USER_SETTINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

       <MinimalRebuild>true</MinimalRebuild>

       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>

@@ -839,13 +839,14 @@
       <Optimization>MaxSpeed</Optimization>

       <AdditionalIncludeDirectories>$(ProjectDir)include\wolf;$(SolutionDir)..\external\wolfssl;$(SolutionDir)\wolfcrypt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

       <IntrinsicFunctions>true</IntrinsicFunctions>

-      <PreprocessorDefinitions>USE_WOLFCRYPT;CRYPTO_ALIGN_4;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <PreprocessorDefinitions>HASH_LIB=Wolf;SYM_LIB=Wolf;MATH_LIB=Wolf;WOLFSSL_USER_SETTINGS;CRYPTO_ALIGN_4;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

       <FunctionLevelLinking>true</FunctionLevelLinking>

       <PrecompiledHeader>NotUsing</PrecompiledHeader>

       <WarningLevel>Level3</WarningLevel>

       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

       <CompileAs>CompileAsC</CompileAs>

+      <DisableSpecificWarnings>4668</DisableSpecificWarnings>

     </ClCompile>

     <Link>

       <AdditionalDependencies>wolfssl.lib;platform.lib;%(AdditionalDependencies)</AdditionalDependencies>

@@ -901,7 +902,7 @@
       <Optimization>MaxSpeed</Optimization>

       <AdditionalIncludeDirectories>$(ProjectDir)include\wolf;$(SolutionDir)..\external\wolfssl;$(SolutionDir)\wolfcrypt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

       <IntrinsicFunctions>true</IntrinsicFunctions>

-      <PreprocessorDefinitions>USE_WOLFCRYPT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <PreprocessorDefinitions>HASH_LIB=Wolf;SYM_LIB=Wolf;MATH_LIB=Wolf;WOLFSSL_USER_SETTINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

       <FunctionLevelLinking>true</FunctionLevelLinking>

       <PrecompiledHeader>

@@ -1386,9 +1387,9 @@
     <ClInclude Include="include\wolf\TpmToWolfHash.h" />

     <ClInclude Include="include\wolf\TpmToWolfMath.h" />

     <ClInclude Include="include\wolf\TpmToWolfSym.h" />

+    <ClInclude Include="include\Wolf\user_settings.h" />

     <ClInclude Include="include\X509.h" />

     <ClInclude Include="include\X509_RSA.h" />

-    <ClInclude Include="$(SolutionDir)\wolfcrypt\include\user_settings.h" />

   </ItemGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

   <ImportGroup Label="ExtensionTargets">

diff --git a/TPMCmd/tpm/Tpm.vcxproj.filters b/TPMCmd/tpm/Tpm.vcxproj.filters
index 3b68509..f9ffe0e 100644
--- a/TPMCmd/tpm/Tpm.vcxproj.filters
+++ b/TPMCmd/tpm/Tpm.vcxproj.filters
@@ -1317,9 +1317,6 @@
     <ClInclude Include="include\wolf\TpmToWolfSym.h">

       <Filter>Headers\Crypt\wolf</Filter>

     </ClInclude>

-    <ClInclude Include="$(SolutionDir)\wolfcrypt\include\user_settings.h">

-      <Filter>Headers\Crypt\wolf</Filter>

-    </ClInclude>

     <ClInclude Include="include\prototypes\TpmToWolfDesSupport_fp.h">

       <Filter>Headers\prototypes</Filter>

     </ClInclude>

@@ -1335,6 +1332,9 @@
     <ClInclude Include="include\TpmAlgorithmDefines.h">

       <Filter>Headers</Filter>

     </ClInclude>

+    <ClInclude Include="include\Wolf\user_settings.h">

+      <Filter>Headers\Crypt\wolf</Filter>

+    </ClInclude>

   </ItemGroup>

   <ItemGroup>

     <Filter Include="Source Files">

diff --git a/TPMCmd/tpm/include/Wolf/TpmToWolfHash.h b/TPMCmd/tpm/include/Wolf/TpmToWolfHash.h
index eb28054..faedfc3 100644
--- a/TPMCmd/tpm/include/Wolf/TpmToWolfHash.h
+++ b/TPMCmd/tpm/include/Wolf/TpmToWolfHash.h
@@ -46,6 +46,10 @@
 #define WOLFSSL_USER_SETTINGS

 #endif

 

+#if ALG_SHA384 || ALG_SHA512

+#define WOLFSSL_SHA512

+#endif

+

 #include <wolfssl/wolfcrypt/sha.h>

 #include <wolfssl/wolfcrypt/sha256.h>

 #include <wolfssl/wolfcrypt/sha512.h>

diff --git a/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h b/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h
index 5fdfeb3..c8e4401 100644
--- a/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h
+++ b/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h
@@ -45,6 +45,10 @@
 

 #define MATH_LIB_WOLF

 

+#if ALG_ECC

+#define HAVE_ECC

+#endif

+

 #include <wolfssl/wolfcrypt/tfm.h>

 #include <wolfssl/wolfcrypt/ecc.h>

 

diff --git a/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h b/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h
index 2f6df81..92b6592 100644
--- a/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h
+++ b/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h
@@ -49,11 +49,11 @@
 //** Links to the wolfCrypt AES code

 //***************************************************************

 

-#ifdef TPM_ALG_SM4

+#if ALG_SM4

 #error "SM4 is not available"

 #endif

 

-#ifdef  TPM_ALG_CAMELLIA

+#if  ALG_CAMELLIA

 #error "Camellia is not available"

 #endif

 

@@ -105,7 +105,7 @@
 

 typedef union tpmCryptKeySchedule_t tpmCryptKeySchedule_t;

 

-#ifdef TPM_ALG_TDES

+#if ALG_TDES

 #include "TpmToWolfDesSupport_fp.h"

 #endif

 

diff --git a/TPMCmd/tpm/include/Wolf/user_settings.h b/TPMCmd/tpm/include/Wolf/user_settings.h
index 622437c..3c0f6d0 100644
--- a/TPMCmd/tpm/include/Wolf/user_settings.h
+++ b/TPMCmd/tpm/include/Wolf/user_settings.h
@@ -40,8 +40,6 @@
 #ifndef WOLF_CRYPT_USER_SETTINGS_H
 #define WOLF_CRYPT_USER_SETTINGS_H
 
-#include <Implementation.h>
-
 /* Remove the automatic setting of the default I/O functions EmbedSend()
     and EmbedReceive(). */
 #define WOLFSSL_USER_IO
@@ -57,21 +55,21 @@
 #define WOLFSSL_AES_DIRECT
 
 /* Enable/Disable algorithm support based on TPM implementation header */
-#ifdef TPM_ALG_SHA256
+#ifdef ALG_SHA256
     #define WOLFSSL_SHA256
 #endif
-#if defined(TPM_ALG_SHA384) || defined(TPM_ALG_SHA512)
+#if ALG_SHA384 || ALG_SHA512 || defined(WOLFSSL_LIB)
     #define WOLFSSL_SHA384
     #define WOLFSSL_SHA512
 #endif
-#ifdef TPM_ALG_TDES
+#if ALG_TDES || defined(WOLFSSL_LIB)
     #define WOLFSSL_DES_ECB
 #endif
-#ifdef TPM_ALG_RSA
+#if ALG_RSA || defined(WOLFSSL_LIB)
     /* Turn on RSA key generation functionality */
     #define WOLFSSL_KEY_GEN
 #endif
-#ifdef TPM_ALG_ECC
+#if ALG_ECC || defined(WOLFSSL_LIB)
     #define HAVE_ECC
 
     /* Expose additional ECC primitives */
@@ -85,6 +83,14 @@
     #define NO_ECC_SIGN
     #define NO_ECC_VERIFY
     #define NO_ECC_SECP
+
+    #undef ECC_BN_P256
+    #undef ECC_SM2_P256
+    #undef ECC_BN_P638
+    #define ECC_BN_P256     NO
+    #define ECC_SM2_P256    NO
+    #define ECC_BN_P638     NO
+
 #endif
 
 /* Disable explicit RSA. The TPM support for RSA is dependent only on TFM */
diff --git a/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h b/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h
index 9aaa46c..ee0887a 100644
--- a/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h
+++ b/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h
@@ -41,7 +41,7 @@
 #ifndef    _TPMTOWOLFSUPPORT_FP_H_

 #define    _TPMTOWOLFSUPPORT_FP_H_

 

-#if MATH_LIB == WOLF

+#ifdef MATH_LIB_WOLF

 //**Functions

 

 //*** SupportLibInit()

diff --git a/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c b/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c
index e60c703..395f5d3 100644
--- a/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c
+++ b/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c
@@ -95,7 +95,7 @@
         for (i = 0; i < initializer->size; i++)

             toInit->dp[i] = initializer->d[i];

 

-        toInit->used = initializer->size;

+        toInit->used = (int)initializer->size;

         toInit->sign = 0;

     }

 }

@@ -242,7 +242,7 @@
     return OK;

 }

 

-#ifdef TPM_ALG_RSA

+#if ALG_RSA

 //*** BnGcd()

 // Get the greatest common divisor of two numbers

 LIB_EXPORT BOOL

@@ -320,7 +320,7 @@
 }

 #endif // TPM_ALG_RSA

 

-#ifdef TPM_ALG_ECC

+#if ALG_ECC

 

 //*** PointFromWolf()

 // Function to copy the point result from a wolf ecc_point to a bigNum