1# Change Log 2All notable changes to this project will be documented in this file. 3 4The format is based on [Keep a Changelog](http://keepachangelog.com/) 5 6## [2.4.0] - 2020-03-11 7### Added 8- Added a new Feature API (FAPI) implementation 9- Added Esys_TRSess_GetAuthRequired() ESAPI function 10- Added Esys_TR_GetTpmHandle() SAPI function 11- Added Esys_GetSysContext() SAPI function 12- Added the with-sanitizer configure option 13- Added CI for FreeBSD 14 15### Changed 16- Changed MSSIM TCTI to be async capable 17- Removed TCTI loaders from ESYS dependencies in pkg-config 18- Changed getPollHandles to allow num_handles query 19- Improved CI builds 20- Converted builds to docker builds 21- Number of fixes and improvements in the test code 22- Changed tcti-device in non-async mode to allways block 23 24### Fixed 25- Fixed hmac calculation for tpm2_clear command in ESAPI 26- Fixed mixing salted and unsalted sessions in the same ESAPI context 27- Removed use of VLAs from TPML marshal code 28- Fixed setting C++ compiler for non-fuzzing builds at configure 29- Fixed setting the name of session objects 30- Fixed page alignment errors in Sys_Get/SetAuths functions 31- Fixed potential buffer overflow in tcti_mssim_receive 32- Fixed invalid memory alloc failure in Tss2_TctiLdr_Initialize 33- Fixed list of exported symbols map for libtss2-mu 34- Fixed resource name calculation in Esys_CreateLoaded 35- Fixed keysize of ECC curve TPM2_ECC_NISTP224 36- Fixed segmentation fault in tctildr if name_conf was too big 37- Fixed memory leak in tctildr-tcti tests 38- Fixed HMAC generation for policy sessions 39- Added check for object node before calling compute_session_value function 40- Fixed auth calculation in Esys_StartAuthSession called with optional parameters 41- Fixed compute_encrypted_salt error handling in Esys_StartAuthSession 42- Fixed exported symbols map for libtss2-mu 43 44### Removed 45- Remove duplicate ESYS entries from map file 46- Removed the private implementation of strndup from tctildr 47 48## [2.3.0] - 2019-08-13 49### Added 50- tss2-tctildr: A new library that helps with tcti initialization 51 Recommend to use this in place of custom tcti loading code now ! 52- tss2-rc: A new library that provides textual representations for return codes 53- Added release and maintainance info (~3 per year and latest 2 are supported) 54- Support for building on VxWorks. 55- Option to disable NIST-deprecated crypto (--disable-weak-crypto) 56- Support Esys_TR_FromTPMPublic on sessions (for use in Esys_FlushContext) 57- Better Windows/VS Support 58- Fuzz-Testing and Valgrind-Testing 59- map-files with correct symbol lists for tss2-sys and tss2-esys 60 This may lead to unresolved symbols in linked applications 61 62### Changed 63- Several further minor fixes and cleanups 64- Support to call Tss2_Sys_Execute repeatedly on certain errors 65- Reduced RAM consumption in Esys due to Tss2_Sys_Execute change 66- Automated session attribution clearing for esys (decrypt and encrypt) per cmd 67- Switched to git.mk, many ax_ makros and away from gnulib 68- Switched to config.h and autoheaders 69 70### Removed 71- Removed libtss2-mu from "Requires" field of libtss2-esys.pc 72 Needs to be added explicitely now 73 74### Fixed 75- All fixes from 2.2.1, 2.2.2 and 2.2.3 76- SPDX License Identifiers 77- Null-pointer problems in tcti-tbs 78- Default locality for tcti-mssim set to LOC_0 79- coverity and valgrind leaks detected in test programs (not library code) 80 81## [2.2.3] - 2019-05-28 82### Fixed 83 - Fix computation of session name 84 - Fixed PolicyPassword handling of session Attributes 85 - Fixed windows build from dist ball 86 - Fixed default tcti configure option 87 - Fixed nonce size calculation in ESYS sessions 88 89## [2.2.2] - 2019-03-28 90### Fixed 91 - Fixed wrong encryption flag in EncryptDecrypt 92 - Fixing openssl engine invocation 93 94## [2.2.1] - 2019-02-28 95### Fixed 96 - Forced RAND_bytes method to software implementation to avoid session spoofing 97 - Fixed OpenSSL symbolic naming conflict 98 - Fixed leaks of local point variables and BN_ctx 99 - Fixed memory leaks related to using regular free on gcrypt allocated objects 100 - Fixed leak of rsa->n in iesys_cryptossl_pk_encrypt 101 - Fixed memory leaks in iesys_cryptossl_pk_encrypt 102 - Fixed possible NULL dereference of big number 103 104## [2.2.0] - 2019-02-04 105### Fixed 106- Fixed leak of hkey on success in iesys_cryptossl_hmac_start 107- Fixed NULL ptr issues in Esys_HMAC_Start, Esys_HierarchyChangeAuth and Esys_NV_ChangeAuth 108- Fixed NULL ptr issue in sequenceHandleNode 109- Fixed NULL ptr auth handling in Esys_TR_SetAuth 110- Fixed NULL auth handling in iesys_compute_session_value 111- Fixed marshaling of TPM2Bs with sub types. 112- Fixed NULL ptr session handling in Esys_TRSess_SetAttributes 113- Fixed the way size of the hmac value of a session without authorization 114- Added missing MU functions for TPM2_NT type 115- Added missing MU functions for TPMA_ID_OBJECT type 116- Added missing type TPM2_NT into tss2_tpm2_types.h 117- Fixed wrong typename _ID_OBJECT in tss2_tpm2_types.h 118- Fixed build breakage when --with-maxloglevel is not 'trace' 119- Fixed build breakage in generated configure script when CFLAGS is set 120- Fixed configure scritp ERROR_IF_NO_PROG macro 121- Changed TPM2B type unmarshal to use sizeof of the dest buffer instead of dest 122- Fixed unmarshaling of the TPM2B type with invalid size 123- Removed dead code defect detected by coverity from Esys_TRSess_GetNonceTPM 124 125### Added 126- Added support for QNX build 127- Added support for partial reads in device TCTI 128 129## [2.1.1] - 2019-02-04 130### Fixed 131- Fixed leak of hkey on success in iesys_cryptossl_hmac_start 132- Fixed NULL ptr issues in Esys_HMAC_Start, Esys_HierarchyChangeAuth and Esys_NV_ChangeAuth 133- Fixed NULL ptr issue in sequenceHandleNode 134- Fixed NULL ptr auth handling in Esys_TR_SetAuth 135- Fixed NULL auth handling in iesys_compute_session_value 136- Fixed marshaling of TPM2Bs with sub types. 137- Fixed NULL ptr session handling in Esys_TRSess_SetAttributes 138- Fixed the way size of the hmac value of a session without authorization 139- Added missing MU functions for TPM2_NT type 140- Added missing MU functions for TPMA_ID_OBJECT type 141- Added missing type TPM2_NT into tss2_tpm2_types.h 142- Fixed wrong typename _ID_OBJECT in tss2_tpm2_types.h 143- Fixed build breakage when --with-maxloglevel is not 'trace' 144- Fixed build breakage in generated configure script when CFLAGS is set 145- Fixed configure scritp ERROR_IF_NO_PROG macro 146- Changed TPM2B type unmarshal to use sizeof of the dest buffer instead of dest 147- Fixed unmarshaling of the TPM2B type with invalid size 148- Removed dead code defect detected by coverity from Esys_TRSess_GetNonceTPM 149 150## [2.1.0] 151### Fixed 152- Fixed handling of the default TCTI 153- Changed logging to be ISO-C99 compatible 154- Fixed leak of dlopen handle 155- Fixed logging of a response header tag in Tss2_Sys_Execute 156- Fixed marshaling of TPM2B parameters in SAPI commands 157- Fixed unnecessary warning in Esys_Startup 158- Fixed warnings in doxygen documentation 159 160### Added 161- Added Esys_Free wrapper function for systems using different C runtime libraries 162- Added Windows TBS TCTI 163- Added non-blocking mode of operation in tcti-device 164- Added tests for Esys_HMAC and Esys_Hash 165- Enabled integration tests on physical TPM device 166- Added openssl libcrypto backend 167- Added Doxygen documentation to integration tests 168 169### Changed 170- Refactored SetDecryptParam 171- Enabled OpenSSL crypto backend by default 172 173## [2.0.2] - 2019-02-04 174### Fixed 175- Fixed NULL ptr issues in Esys_HMAC_Start, Esys_HierarchyChangeAuth and Esys_NV_ChangeAuth 176- Fixed NULL ptr issue in sequenceHandleNode 177- Fixed NULL ptr auth handling in Esys_TR_SetAuth 178- Fixed NULL auth handling in iesys_compute_session_value 179- Fixed marshaling of TPM2Bs with sub types. 180- Fixed NULL ptr session handling in Esys_TRSess_SetAttributes 181- Fixed the way size of the hmac value of a session without authorization 182- Added missing MU functions for TPM2_NT type 183- Added missing MU functions for TPMA_ID_OBJECT type 184- Added missing type TPM2_NT into tss2_tpm2_types.h 185- Fixed wrong typename _ID_OBJECT in tss2_tpm2_types.h 186- Fixed build breakage when --with-maxloglevel is not 'trace' 187- Fixed build breakage in generated configure script when CFLAGS is set 188- Fixed configure scritp ERROR_IF_NO_PROG macro 189- Changed TPM2B type unmarshal to use sizeof of the dest buffer instead of dest 190- Fixed unmarshaling of the TPM2B type with invalid size 191- Removed dead code defect detected by coverity from Esys_TRSess_GetNonceTPM 192 193## [2.0.1] - 2018-08-10 194### Fixed 195- Fixed problems with doxygan failing make distcheck 196- Fixed conversion of gcrypt mpi numbers to binary data 197- Fixed an error in parsing socket address in MSSIM TCTI 198- Fixed compilation error with --disable-tcti-mssim 199- Added initialization function for gcrypt to suppress warning 200- Fixed invalid type base type while marshaling TPMI_ECC_CURVE in Tss2_Sys_ECC_Parameters 201- Fixed invalid RSA encryption with exponent equal to 0 202- Fixed checking of return codes in ESAPI commands 203- Added checks for programs required by the test harness @ configure time 204- Fixed warning on TPM2_RC_INITIALIZE rc after a Startup in Esys_Startup 205- Checked for 1.2 TPM type response 206- Changed constants values in esys header file to unsigned 207 208## [2.0.0] - 2018-06-20 209### Added 210- Implementation of the Marshal/Unmarshal library (libtss2-mu) 211- Implementation of the Enhanced System API (libtss2-esys aka ESAPI) 212- New implemetation of the TPM Command Transmission Interface (TCTI) for: 213 - communication with Linux TPM2 device driver: libtss2-tcti-device 214 - communication with Microsoft software simulator: libtss2-tcti-mssim 215- New directory layout (API break) 216- Updated documentation with new doxygen and updated man pages 217- Support for Windows build with Visual Studio and clang, currently limited 218to libtss2-mu and libtss2-sys 219- Implementation of the new Attached Component (AC) commands 220- Implementation of the new TPM2_PolicyAuthorizeNV command 221- Implementation of the new TPM2_CreateLoaded command 222- Implementation of the new TPM2_PolicyTemplate command 223- Addition of _Complete functions to all TPM commands 224- New logging framework 225- Added const qualifiers to API input pointers (API break) 226- Cleaned up headers and remove implementation.h and tpm2.h (API break) 227### Changed 228- Converted all cpp files to c, removed dependency on C++ compiler. 229- Cleaned out a number of marshaling functions from the SAPI code. 230- Update Linux / Unix OS detection to use non-obsolete macros. 231- Changed TCTI macros to CamelCase (API break) 232- Changed TPMA_types to unsigned int with defines instead of bitfield structs (API/ABI break) 233- Changed Get/SetCmd/RspAuths to new parameter types (API/ABI break) 234- Fixed order of parameters in AC commands: Input command authorizations 235now come after the input handles, but still before the command parameters. 236### Removed 237- Removed all sysapi/sysapi_utils/*arshal_TPM*.c files 238### Fixed 239- Updated invalid number of handles in TPM2_PolicyNvWritten and TPM2_TestParms 240- Updated PlatformCommand function from libtss2-tcti-mssim to no longer send 241CANCEL_OFF before every command. 242- Expanded TPM2B macros and removed TPM2B_TYPE1 and TPM2B_TYPE2 macros 243- Fixed wrong return type for Tss2_Sys_Finalize (API break). 244 245## [1.4.0] - 2018-03-02 246### Added 247- Attached Component commands from the last public review spec. 248### Fixed 249- Essential files missing from release tarballs are now included. 250- Version string generation has been moved from configure.ac to the 251bootstrap script. It is now stored in a file named `VERSION` that is 252shipped in the release tarball. 253- We've stopped shipping the built man page for InitSocketTcti.3 and now 254ship the source. 255 256## [1.3.0] - 2017-12-07 257### Added 258- Implementation of the EncryptDecrypt2 command. 259- Coding standard documentation. 260- Support for latest TPM2 simulator v974 (only changes in test harness). 261- Check cmocka version for compatibility with 1.0 API. 262### Fixed 263- Definition of HMAC_SESSION_LAST and POLICY_SESSION_LAST. 264- Drop cast from TPM_ALG_XXX definitions 265- Use mock functions with built-in cast to avoid compiler warnings from 266manual cast. 267- Free memory correctly on error condition return paths in InitSysContext 268& SockServer. 269 270## [1.2.0] - 2017-08-25 271### Added 272- Support for PTT-specific capabilities. 273- Manuals with overviews for SAPI and TCTI layers & TCTI init functions. 274- Further decomposition of the tpmclient program into an integration test 275harness based on the automake infrastructure. 276### Changed 277- File list generated by bootstrap script is now sorted to play nice with 278reproducible builds. 279- Test harness now supports parallel execution of integration tests. 280- libtcti-socket interrupted syscalls now resume. 281- Additional hardening of compiler / linker flags. 282- All options supported by `tpmclient` executable now removed. 283- Unimplemented TCTI functions now return NOT_IMPLEMENTED RC. 284### Fixed 285- NULL dereference bugs in TCTI modules. 286- Cleanup & structure initialization to keep coverity scans happy. 287- Fixed memory leak in integration test harness. 288 289## [1.1.0] - 2017-05-10 290### Changed 291- tpmclient, disabled all tests that rely on the old resourcemgr. 292### Fixed 293- Fixed definition of PCR_LAST AND TRANSIENT_LAST macros. 294### Removed 295- tpmtest 296- resourcemgr, replacement is in new repo: https://github.com/01org/tpm2-abrmd 297 298## [1.0] - 2016-11-01 299### Added 300- Travis-CI integration with GitHub 301- Unit tests for primitive (un)?marshal functions. 302- Example systemd unit for resourcemgr. 303- Allow for unit tests to be enabled selectively. 304- added pkg-config files for libraries 305### Changed 306- move simulator initialization code to socket TCTI init function. 307- socket TCTI finalize no longer frees context 308- rename libtss2 to libsapi 309- rename libtcti_device to libtcti-device 310- rename libtcti_socket to libtcti-socket 311- move $(includedir)/tss to $(includedir)/sapi 312- Move default compiler flags to config.site file. 313### Fixed 314- Fix run away resourcemgr threads by closing client sockets when resourcemgr 315recv() call returns 0. 316- Set MSG_NOSIGNAL for client connections to avoid SIGPIPE killing 317resourcemgr. 318- Fixes to handling of persistent objects by resourcemgr. 319### Removed 320- Semicolon from TPMA_* macros definitions. 321- Windows build files. 322- SAPI_CLIENT macro tests. 323### Security 324- Fix buffer overflow in resourcemgr. 325 326## [0.98] - 2015-07-28 327### Added 328- Added ability for resource manager to communicate with a real TPM via 329/dev/tpm0 (Linux only). Added command line switch to select simulator if not 330communicating with a real TPM. 331### Changed 332- Rearranged directory structure in a more logical fashion. 333- Changed name of Linux makefiles from “makefile.linux” to makefile. This was 334done in preparation for autotools porting (future enhancement). 335- Changed tpm library’s windows makefile from “makefile” to “windows.mak”. 336- Changed all makefiles and Visual Studio solution and project files to work 337with new directory structure. 338- Split out debug and TPM platform command code in tpmsockets.cpp into 339separate files. This code didn’t belong in this file. 340 341## [0.97] - 2015-??-?? 342### Added 343- Added code to save context in RM table when an object is context loaded. 344- Added code to get hierarchy from context when object is context loaded. 345- Added targeted test to tpmclient.cpp to make sure that hierarchy is saved 346- Added code to print level-specific messages when errors occur. 347- Added test for EvictControl.Fixed TestEncryptDecryptSession to work with 3481.22 simulator. 349- Added code to check that TPM2B output parameters' size fields are set to 0 350for following structures: TPM2B_ECC_POINT, TPM2B_PUBLIC, TPM2B_NV_PUBLIC, and 351TPM2B_CREATION_DATA. 352### Changed 353- Fixed resource manager issues with leaving objects and session contexts in 354TPM memory. This was causing a 902 error on 2nd pass of PolicyTests. And it 355could have caused issues when error conditions occurred, because in those 356cases, the contexts weren't being evicted. 357- Changed TAB/RM into a separate executable (daemon). 358- Fixed bug: if LoadContext fails when loading objects it should exit 359ResourceMgrSendTpmCommand immediately. Instead it was loading other objects 360and proceeding through the rest of ResourceMgrSendTpmCommand function. 361correctly for ContextLoad command. 362- Fixed issues with TCTI: opaque data shouldn't be defined in tss2_tcti.h 363file. 364- Fixed makefile issue: under Windows, it was using mkdir command instead of 365md. 366- Fixed issue with definition of TSS2_TCTI_POLL_HANDLE in tss2_tcti.h file. 367- Fixed bug: wasn't handling case for TPM errors correctly in CheckPassed. 368- Changed CheckOverflow to return SAPI error level for errors. Other levels of 369TSS that call this function will alter the error level field. 370- Fixed resource manager to properly handle EvictControl commands. Before, if 371a persistent object was needed, the RM would give a 0xc0002 error. 372- Fixed printf's in resource manager so that they only print the right # of 373characters. 374- Fixed TestShutdown to work with 1.22 simulator. 375 376## [0.96] - 2015-04-16 377### Added 378- Added buffer overrun checks to all SAPI code. 379- Added buffer overrun checks to resource manager code. 380- Added code to Part 3 functions to properly handle null pointers for output 381parameters. 382### Changed 383- Auto-generated most of the SAPI code from the TPM 2.0 specification. 384 385## [0.95.1] - 2015-01-26 386### Added 387- Added code to dynamically work around simulator 1.19 bugs: 388- Added code to RM and simDriver to support timeout on receive calls. 389- Added code to properly handle TPM errors in ExecuteFinish. Previously it was 390ignoring these errors, which meant that the rest of the _Complete call would 391try to unmarshal non-existent response data. Added test case for this. 392- Added support for cancel commands and tests for this. 393- Added help text for command line options. 394- Added code to reset dictionary attacks to start of tpmclient tests: this 395works around an issue where the simulator doesn't seem to completely clear the 396dictionary attack counter. 397- Added support for TCTI setLocality to resource manager and sim driver and 398made test app use this. 399- Added RM tests. 400- Added code to RM to evict contexts for objects, sequences, and sessions 401whose handles are returned by commands. 402- Added code to properly support ContextSave. 403- Added proper error code levels to all RM errors. 404- Added code to LoadContext function to output TPM formatted error codes. 405- For Create and Load commands, added proper handling of errors if parent 406handle not found. 407- Added tests for bad session handle, both in handle area and in authorization 408area. 409- Added command line option to run the StartAuthSession tests by themselves. 410- Added support for command line control of debug message levels. 411- Added new error level for resource manager for errors received from TPM from 412commands sent by RM. 413- Added error return for insufficiently sized response to ExecuteFinish 414function. 415- Added gap support to resource manager. 416- Added support to resource manager for kicking out oldest session if max 417sessions have been started and a new one is being created. 418- Added getCap calls to RM init function for getting max sessions and gap 419limit. 420- Added code to teardown the RM. 421- Added test for session gapping. 422- Added code to proactively detect MAX_ACTIVE_SESSIONS. 423- Added SAPI library subproject to test app project. This allows a one-touch 424build in Visual Studio. 425- Added changes to return error codes from TAB/RM and layers underneath in a 426response byte stream. 427### Changed 428- Fixed bug in CreatePrimary and Create: for one-call and decrypt session 429case, they were copying first parameter from incorrect pointer. 430- For CopyCreationDataOut, CopyECCPointOut, CopyNvPublicOut, CopyPublicOut 431added placeholder for return code if size != 0 when called. To be filled in 432when TSS WG decides on error code. 433- Fixed bugs in CopySensitiveCreateIn and CopySensitiveIn: they shouldn't look 434at the size. 435- Fixed bugs in CopyECCPointIn, CopyNvPublicIn, CopyPublicIn, CopySensitiveIn, 436and CopySensitiveCreateIn: not handling NULL outpul parameters correctly. 437- Changes all instances of calls to ExecuteFinish to a timeout that works for 438all cases including communicating with the simulator over the network. 439- Fixed call to LoadExternal in TestUnseal--needed to pass in a NULL pointer 440for the inSensitive parameter. 441- Fixed bug in CreatePrimary: not passing correct pointer for inSensitive. 442- Fixed timeouts for all ExecuteFinish calls in test application. 443- Fixed bugs in RM: cases where I wasn't handling errors and then parsing data 444that hadn't been received. Caused seg faults under Linux. 445- Fixed timeout for async Startup test. 446- Fixed SocketReceiveTpmResponse for blocking case. 447- Fixed bug in ExecuteFinish: BAD_SEQUENCE error generated early in function 448was getting overwritten by INSUFFICIENT_RESPONSE error. 449- Fixed bug in ExecuteFinish: it was always setting timeout to 0 instead of 450TSS2_TCTI_TIMEOUT_BLOCK. 451- Fixed bug in resource manager: error level for non-TPM errors was getting 452overwritten with resource manager error level. 453- Replace Implementation.h with implementation.h. 454- Changed name of TPMB.h tpmb.h 455- GetCapability with bad property returns different error code. 456- Shutdown with bad value for shutdownValue causes TPM to go into failure 457mode. 458- Fixed overlap in error codes: TSS2_BASE_RC_NOT_SUPPORTED and 459TSS2_BASE_RC_BAD_TCTI_STRUCTURE had same value. 460- Cleaned up all app level error codes. 461- Fixed bug with ordering of -startAuthSessionTest command line parameter: if 462it was not the last option, tpmclient would fail. 463- Fixed bugs related to ContextLoad. 464- Fixed bug in EvictContext: it was updating lastSessionSequenceNum even if 465the ContextSave command failed. 466- Fixed handling of RM errors that occur during command send. 467- Fixed bug in simDriver init function. A second TCTI context being 468initialized was re-initing the whole driver. 469- Updated to latest 1.19 header files. 470- Fixed bugs in resource manager: 471- FindOldestSession wasn't working correctly—it was just finding the first 472one. 473- HandleGap needed to un-gap all the session contexts from the older interval. 474It wasn't doing that. 475- Fixed bug in handling of command line options—specifying none would cause 476program to error out. 477- Fixed issues in cleanup of TestStartAuthSession test. It was leaving some 478sessions alive. 479- Updated copyright notices on all files. 480- Changed test app to use linked list of session structures instead of fixed 481array. This fixed a host of issues. 482- Fixed bugs in Certify, CertifyCreation, Commit, Create, CreatePrimary, and 483GetCapability: if null used for return parameters, the function would fail. 484- Fixed bug in SimpleHmacOrPolicyTest where it was re-creating the global 485sysContext causing failures in later tests because the context was too small. 486- Fixed a bug in ExecuteFinish. If response is too small, code was just using 487the command buffer as the response buffer instead of returning an error. 488- Fixed some places in test app where I wasn't deleting entries from the 489sessions table. 490- Fixed build warnings related to size mismatch of connectionId. 491- Changed TeardownSysContext to zero out freed context pointer. 492- This helps prevent double free errors. 493- Fixed bug in EncryptDecryptXOR: wasn't setting the size of the outputData 494buffer. 495### Removed 496- Removed 'extern "C"' statement from resourcemgr.c file. Not needed and 497causes problems with some compilers. 498- Removed unneeded includes from resource manager source. 499 500## [0.95] - 2014-10-17 501### Added 502- Added support for Shutdown/Startup and effects on saved contexts. 503- Added support for stClear bit objects. On a TPM Restart, objects with this 504bit set will be removed from the TAB/RM entry list. 505- Added TCTI teardown function. 506- Added TAB functionality. 507- Added TCTI layer below RM to talk to driver. This allows making calls into 508the SAPI library from the RM without recursing into the RM again. With the 509separate TCTI context, the RM can route SAPI calls to talk directly to the 510driver. This fixed the virtual/real handle mess that was occurring with 511recursively entering the RM. 512- Added function pointers to TAB/RM for functions that might need to be 513different based on the environment that TAB/RM is running in: malloc, free, 514printf. 515- Added and corrected error codes to match latest SAPI spec. 516- Added MAX_NV_BUFFER_SIZE and used for max size of MAX_NV_BUFFER_2B. 517- Added code to TestHash to calculate and validate a hash. 518- Added code to TestHash to force a flush of an active sequence and then use 519it to finish the hash calculation. 520- Added code to SimpleHMACTest to read the NV index back. 521- Added SimpleHMACOrPolicyTest function which helps illustrate the difference 522between HMAC and policy sessions. 523### Changed 524- Fixed intermittent access violation bug with GetSetDecryptParamTests 525function. I was reading off the end of the nvWrite buffer. 526- Fixed bug in Tss2_Sys_GetContextSize function: it was getting the requested 527size only, not the requested size plus the context blob's size. Problem was an 528associativity issue with ternary conditional ?: operator. 529- Re-architected TAB/RM: 530- Changed RM from reactive mode to proactive mode. Now instead of reacting to 531error codes from the TPM that indicate no enough slots, it guarantees that the 532TPM is always ready for each command (all slots freed after execution of each 533command). 534- Replaced the fixed length arrays of RM structures with linked list 535structures and appropriate functions. 536- Fixed some cases of using pointers before checking that they're not NULL. 537- Fixed bugs in marshaling/unmarshaling routines and added some missing 538unmarshaling functions. 539- Fixed hash sequence test. 540- Fixed bugs in CopyCapabilityDataOut function for algorithms. 541- Fixed bug with ExecuteAsync: passed in BE size to transmit call. Needs to be 542host-endian. 543- Changed on bit fields in TPM2 data structures to unsigned int. Previously 544the compiler was generating incorrect code because these were int bit fields. 545- Cleaned up TestHash function. 546### Removed 547- Removed most instances of sysContext in tpmclient.cpp. Now most tests use 548the global one. 549- Removed pack pragma from header files for external interfaces. 550 551## [0.93] - 2014-08-01 552### Added 553- Added IsSession routine and fixed all instances in resource manager where a 554handle is checked for being a session handle (some were incorrect). 555- Added RollNonces function and used for all tests for HMAC and policy 556sessions. 557- Added TCTI malformed response error code. 558- Added simple HMAC test. 559- Added test for session parameter encryption and decryption. 560- Added more descriptive error codes to StartAuthSession function. 561- Added TpmHashSequence function. Used this build password/PCR policy. 562- Added more policy tests: password/PCR, authValue, password 563- Added code to flush context of session handles I'm not using. 564- Added GetTestResult functions (had missed these previously) 565- Added tests for asynchronous and synchronous non-one call to Startup tests. 566- Added GetTestResult tests. 567- Added test to create a bunch of sessions. This test found some resource 568manager issues. 569### Changed 570- Fixed bad parameters on call to GetEncryptParam. This only failed on Linux 571systems. 572- Fixed minor build errors under Linux. 573- Eliminated unneeded code in TestPolicy. 574- Changed how nonce's are setup after StartAuthSession. Before they were being 575inherently rolled in preparation for first command. Now the RollNonces routine 576will need to be called before the first command. This makes handling of the 577nonces consistent for all code that needs to roll them. 578- Fixed bug in StartAuthSession: wasn't marshaling symmetric parameter 579properly if algorithm was TPM_ALG_XOR. 580- Fixed bug in SetDecryptParam: when inserting a decrypt param, the code 581wasn't updating the command size field. 582- Fixed bug in ExecuteFinish: wasn't returning TPM error code if no other 583errors had occurred. 584- Fixed bug in KDFa function: if key size was zero, this was just returning 585success, but not generating a key. That behavior is specific to session key 586generation not to the underlying KDFa function. Upleveled that code into 587StartAuthSession function so that it only occurs in the session key generation 588case. 589- Changed NV attributes for all NV indices to add orderly attribute. This 590helps, but doesn't entirely relieve, NV wearout issues with the tests. 591- Changed NV attributes for all NV indices to add orderly attribute. This 592helps, but doesn't entirely relieve, NV wearout issues with the tests. 593- Fixed a bunch of resource manager issues. Many of these were exposed by the 594new policy tests. 595- Updated resource manager to properly handle sessions. Before we were not 596swapping them in as needed. 597- Updated readme.docx file. Now tests can run with V1.15 version of MS 598simulator. 599- Made test app work with MS simulator version 1.15. Had to add command to 600turn on NV. Before this change, when running against MS simulator, 601TPM2_Startup would fail with 0x923 error: "ERROR: WARNING, 602TPM_RC_NV_UNAVAILABLE: the command may require writing of NV and NV is not 603current accessible." 604- Changed NO_RESPONSE_RECEIVED error code to IO_ERROR. 605- Cleaned up defines for MS simulator commands. 606### Removed? 607- Removed an unused input parameter from ComputeCommandHmacs and 608CheckResponseHmacs. 609- Removed an unused input parameter from ComputeCommandHmacs and 610CheckResponseHmacs. 611- Removed DRIVER_NOT_FOUND and DRIVERINFO_NOT_FOUND error codes. 612 613## [0.92] - 2014-06-17 614### Changed 615- Fixed bugs in sockets send and receive code. Needed to account for actual 616bytes sent/received instead of assuming them. This was causing intermittent 617errors when looping continuously on the tests and running the tests remotely 618(on a different host system than the simulator was running on). 619- Fixed SAPI and test app builds to not fail if directories are already 620present. Suppressed error messages related to mkdir. 621- Turned on compiler warnings and fixed all issues when building under Ubuntu 622Linux. 623- Fixed error in readme.docx file. I was specifying the wrong version of the 624simulator. 625- Fixed error handling if sockets interface fails to connect. 626- Fixed build error: now I make directories that are needed. 627 628## [0.91] - 2014-06-04 629### Added 630- Added code optimized builds to System API library code 631- Added warning flags to compiler command lines. 632### Changed 633- Fixed all compiler warnings when built under Windows and Linux. 634 635## [0.90] - 2014-05-28 636### Added 637- Added support for encrypt/decrypt sessions with one-call functions. 638- Added cleaned up and reorganized header files that comply with latest SAPI 639specification. 640- Added changes for supporting get/set encrypt/decrypt functions. 641- Added latest header file that corresponds to version 1.03 of TPM 2.0 642specification. 643- Added debug display of command string for each command being run. 644- Added command line flag to slow down test display for demo purposes. 645- Added option to loop the tests continuously. 646### Changed 647- Ported existing functionality to latest SAPI spec. 648- Cleaned up and added comments to PasswordTest. 649- Fixed problem of hang when looping through tests. Sessions table was running 650out of entries because we weren't removing sessions that were closed. 651- Fixed issue with resource manager. All virtual handles had the high nibble 652set to 0xff. Now the high nibble is left intact so that applications can 653determine the type of the handle. 654### Notes 6551. Testing is not comprehensive. See test code to see what’s tested. Please 656report any bugs found so that fixes can be rolled out. 6572. Range checks within SAPI code not yet implemented. 6583. Still need to add support for separate debug and production builds. 659Production build will be optimized for code size. 660 661## [0.82] - 2013-12-16 662### Added 663- Added support for building and running system API code and tests under 664Linux. 665- Added command line options for host name and port to test application. 666### Notes 667HMAC and cpHash calculations are only supported for NV Read and NV Write 668commands currently. The system API changes to support this have been 669prototyped for these commands and are awaitingTSS approval before being ported 670to all the other commands. 671 672## [0.81] - 2013-12-02 673### Added 674- Added support for TPM2_PolicyNvWritten command. 675### Changed 676- Altered tests to work with 1.01 simulator. 677- Fixed errors in readme.docx. 678### Notes 679HMAC and cpHash calculations are only supported for NV Read and NV Write 680commands currently. The system API changes to support this have been 681prototyped for these commands and are awaitingTSS approval before being ported 682to all the other commands. 683 684## [0.80] - 2013-11-19 685### Added 686- Added code to create a new session for reading/writing the NV index after 687it’s first written. This tests the other case for bound sessions. 688- Added routine to start policy sessions. 689- Added policy test code--not used currently. 690### Changed 691- Fixed bugs in resource manager. 692- Fixed bugs with salted session tests. 693- Ported tests to work with 0.99 sim's version of support for bound sessions. 694- Fixed bugs in test code, with how key is generated for encrypting the salt 695for salted session tests. 696- Fixed a rather serious bug in HmacSessionTest: CopyNvPublicIn is called to 697copy a structure, but is had the side effect of modifying the first parameter. 698This function really wasn't designed to be used the way it is. Worked around 699the problem by resetting the pointer after calling CopyNvPublicIn. This 700problem showed up as a stack corruption issue that occurred during the 4th 701test. Basically the pointer moved enough after the first 3 tests to start 702corrupting other variables on the stack. 703- Automated runtime setup of key for salted tests. 704- Developed changes for NVRead/Write commands to use new 2-stage method for 705handling HMAC calculations. 706- Changed CopyPcrSelectionIn function so that it can be used by applications 707to generate policy hashes. 708- Fixed build error: changes in header files weren't causing TPM 2.0 library 709functions to be rebuilt. 710- Created CalcPHash helper function. 711- Changed HMAC session code to new architecture that doesn't use any helper 712function pointers. 713- Changed return code type form UINT32 to TPM_RC in tss_sysapi.h. 714- Changed "authHandle" to "sessionHandle" in sample code. 715- Debugged and fixed StartAuthSession2 function in test code. 716- Debugged and fixed first policy test. 717- Used new NvDefine function to help abstract some of the details of creating 718NV indices. 719- Used non-MS header file to build system API. 720- Cleaned up and reorganized files and directories. 721### Notes 722HMAC and cpHash calculations are only supported for NV Read and NV Write 723commands currently. The system API changes to support this have been 724prototyped for these commands and are awaitingTSS approval before being ported 725to all the other commands. 726 727## [0.67] - 2013-08-07 728### Added 729- Plumbed in a resource mgr (doesn't actually do anything other than pass 730through at this time). 731- Added BOUND and SALTED HMAC session tests. BOUND test works, but SALTED 732doesn't yet work. 733- Added code to delete an entity from the entity table. 734- Added code to work around an NV index anomaly with TPM simulator 0.98 and 735previous versions: after the first NV index write, the name changes. This 736causes the TPM's HMAC calculation to treat the index as if it's never the 737BOUND entity, even if it is. This is expected (but weird) behavior which will 738be fixed in 0.99 simulator. 739- Created two helper functions pointers for system API and used them for HMAC 740sessions. 741- Added support for HMAC session for NV read/write APIs.Added HMAC tests for 742unbounded/unsalted sessions.Fixed context save/restore functions.Created 743CopyNvPublicIn function and altered Tpm2_DefineSpace function to use it. 744- Created TpmHash function 745- Created TpmHandleToName function 746- Added HMAC tests for unbounded/unsalted sessions. 747- Created CopyNvPublicIn function and altered Tpm2_DefineSpace function to use 748it. 749- Created TpmHash function 750- Created TpmHandleToName function 751- Documented helper function pointers in the system API header file. 752- Added tests for TpmHandleToName function. 753- Added functionality needed for KDFa functions ConcatSizedByteBuffer, 754CopySizedByteBuffer 755- Added KDFa function in preparation for HMAC session test. Not tested yet. 756- Added LoadExternalHMACKey function. This function is called by TPM HMAC 757function. 758### Changed 759- Updated headers with Intel license text. 760- Split sockets driver into separate code module. 761- SALTED session test fixes: 762 * Fixed CopyRSAEncryptIon function--wasn't handling some cases correctly. 763 * Backed out change to make parameterSize passed to ComputeSessionHmacPtr 764function a UINT16. Needs to be UINT32. 765 * For ComputeSessionHmacPtr, changed parameterSize to UINT16 to fix build 766warning. 767- Fixed bugs in KDFa(). 768- Altered all APIs to use pointers to TPM input/output buffers. 769- Fixed context save/restore functions. 770- Fixed formatting of prints of sized byte buffers in test app. 771- Fixed bug in TpmHmac function: needed to set size of result to 0 in case an 772error occurs. 773- Fixed bugs in CopySensitiveIn function: uninitialized size field, bad 774pointers, and incorrect increment of otherData at end of function. 775- Altered TpmHMAC function to call LoadExternalHMAC key function. This 776allows a better HMAC function pointer, one that complies with normal HMAC 777calling convention. Before it was TPM-specific. 778- Bumped up TPMBUF_LEN to 32k in tpmclient.cpp. This fixed overwriting 779problems during context save/restore function. 780- Fixed bugs in ContextLoad function: otherData wasn't initialized before it 781was used. 782- Fixed bug in Tpm20LoadExternal command: it wasn't properly marshaling the 783inPrivate data. 784### Removed 785- Removed tis.h file. Not needed. 786- Eliminated salted session test (because it doesn't work yet), and changed 787out.good file to match. 788- Reorganized directories and moved files to make more logical sense. 789### Notes 790HMAC helper function callouts are only being done for NV Read and NV 791Write commands currently. The system API changes to support this are still 792being prototyped. After they are finalized, these changes will be extended to 793all functions that use sessions. 794 795## [0.66] - 2013-??-?? 796### Added 797- Added CertifyCreation function 798- Added EcEphemeral function 799- Added test for tspi_sys_TPM2_HashStart 800### Changed 801- Cleaned up for general TCG release 802 803## [0.65] - 2013-04-10 804### Added 805- All TPM 2.0 functions now supported. 806- Limited testing done on following functions: 807- tspi_sys_TPM2_Startup 808- tspi_sys_Tpm2_SelfTest 809- tspi_sys_TPM2_GetCapability 810- tspi_sys_TPM2_Clear-tested 811- tspi_sys_TPM2_StartAuthSession 812- tspi_sys_TPM2_ClearControl 813- tspi_sys_TPM2_ChangeEPS 814- tspi_sys_TPM2_HierarchyChangeAuth 815- tspi_sys_TPM2_Extend 816- tspi_sys_TPM2_HashSequenceStart 817- tspi_sys_TPM2_SequenceUpdate 818- tspi_sys_TPM2_SequenceComplete 819- tspi_sys_TPM2_EventSequenceComplete 820- tspi_sys_TPM2_GetRandom 821- tspi_sys_TPM2_SaveState 822- tspi_sys_TPM2_PcrRead 823- tspi_sys_TPM2_NVRead 824- tspi_sys_TPM2_NVWrite 825- tspi_sys_TPM2_Unseal 826- tspi_sys_TPM2_PcrAllocate 827- tspi_sys_TPM2_DictionaryAttackLockReset 828- tspi_sys_TPM2_NV_Writelock 829- tspi_sys_TPM2_PolicyCommandCode 830- tspi_sys_TPM2_PolicyGetDigest 831- tspi_sys_TPM2_PolicyOr 832- tspi_sys_TPM2_PolicyRestart 833- tspi_sys_TPM2_LoadExternal 834- tspi_sys_TPM2_HierarchyControl 835- tspi_sys_TPM2_NV_UndefineSpace 836- tspi_sys_TPM2_Create 837- tspi_sys_TPM2_Load 838- tspi_sys_TPM2_Quote 839- tspi_sys_TPM2_NV_ReadPublic 840- tspi_sys_TPM2_ChangePPS 841- tspi_sys_TPM2_NV_DefineSpace 842- tspi_sys_TPM2_PolicyLocality 843- tspi_sys_TPM2_PolicyPCR 844- tspi_sys_TPM2_CreatePrimary 845- tspi_sys_TPM2_Shutdown 846- tspi_sys_TPM2_PCR_Event 847- tspi_sys_TPM2_PolicyNV 848- tspi_sys_TPM2_NV_ReadLock 849- tspi_sys_TPM2_NV_UndefineSpaceSpecial 850No testing done on all other 61 functions 851 852## [0.60] - 2013-03-29 853### Added 854- Added changes to make it comply with TSS 2.0 system library API 855### Removed 856- Cleaned up and removed unneeded files. 857