Showing preview only (1,248K chars total). Download the full file or copy to clipboard to get everything.
Repository: PeterHuewe/tpm-emulator
Branch: master
Commit: 334a54e874d4
Files: 104
Total size: 1.2 MB
Directory structure:
gitextract_w5yjmm2s/
├── .gitignore
├── .travis.yml
├── AUTHORS
├── CMakeLists.txt
├── ChangeLog
├── LICENSE
├── README
├── build.bat
├── build.sh
├── config.h.in
├── crypto/
│ ├── CMakeLists.txt
│ ├── bn.h
│ ├── bn_gmp.c
│ ├── bn_openssl.c
│ ├── hmac.c
│ ├── hmac.h
│ ├── rc4.c
│ ├── rc4.h
│ ├── rsa.c
│ ├── rsa.h
│ ├── sha1.c
│ └── sha1.h
├── mtm/
│ ├── CMakeLists.txt
│ ├── mtm_capability.c
│ ├── mtm_cmd_handler.c
│ ├── mtm_commands.h
│ ├── mtm_counter.c
│ ├── mtm_data.c
│ ├── mtm_data.h
│ ├── mtm_eviction.c
│ ├── mtm_handles.c
│ ├── mtm_handles.h
│ ├── mtm_integrity.c
│ ├── mtm_marshalling.c
│ ├── mtm_marshalling.h
│ ├── mtm_structures.h
│ └── mtm_verification.c
├── tddl/
│ ├── CMakeLists.txt
│ ├── tddl-tpm-emulator.h
│ ├── tddl.c
│ ├── tddl_unix.h
│ ├── tddl_windows.h
│ └── test_tddl.c
├── tpm/
│ ├── CMakeLists.txt
│ ├── tpm_audit.c
│ ├── tpm_authorization.c
│ ├── tpm_capability.c
│ ├── tpm_cmd_handler.c
│ ├── tpm_commands.h
│ ├── tpm_context.c
│ ├── tpm_counter.c
│ ├── tpm_credentials.c
│ ├── tpm_crypto.c
│ ├── tpm_daa.c
│ ├── tpm_data.c
│ ├── tpm_data.h
│ ├── tpm_delegation.c
│ ├── tpm_deprecated.c
│ ├── tpm_emulator.h
│ ├── tpm_emulator_extern.c
│ ├── tpm_emulator_extern.h
│ ├── tpm_error.c
│ ├── tpm_eviction.c
│ ├── tpm_handles.c
│ ├── tpm_handles.h
│ ├── tpm_identity.c
│ ├── tpm_integrity.c
│ ├── tpm_maintenance.c
│ ├── tpm_management.c
│ ├── tpm_marshalling.c
│ ├── tpm_marshalling.h
│ ├── tpm_migration.c
│ ├── tpm_nv_storage.c
│ ├── tpm_owner.c
│ ├── tpm_startup.c
│ ├── tpm_storage.c
│ ├── tpm_structures.h
│ ├── tpm_testing.c
│ ├── tpm_ticks.c
│ └── tpm_transport.c
├── tpmd/
│ ├── CMakeLists.txt
│ ├── unix/
│ │ ├── CMakeLists.txt
│ │ └── tpmd.c
│ └── windows/
│ ├── CMakeLists.txt
│ ├── control_tpmd.bat
│ └── tpmd.c
└── tpmd_dev/
├── CMakeLists.txt
├── darwin/
│ ├── English.lproj/
│ │ └── InfoPlist.strings
│ ├── Info.plist
│ ├── Makefile
│ ├── tpm_bridge.c
│ └── tpm_bridge.xcodeproj/
│ ├── TemplateIcon.tiff
│ ├── project.pbxproj
│ ├── project.xcworkspace/
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata/
│ │ └── admin.xcuserdatad/
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata/
│ └── admin.xcuserdatad/
│ └── xcschemes/
│ ├── tpm_bridge.xcscheme
│ └── xcschememanagement.plist
├── linux/
│ ├── Makefile
│ ├── tpmd_dev.c
│ └── tpmd_dev.rules.in
└── openbsd/
├── Makefile
├── tpmd_dev.c
└── tpmd_dev.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
build/
================================================
FILE: .travis.yml
================================================
env:
global:
secure: "J29/ntLw9L6cZwmzz/cuYKs7lZ30zGcAW+3BRys56BcBNGy/h1i/ScKuVNTVeGngYfnpVsifDheZNOv7u+WI6cjOiA3mQaf+vtYy/VPp49GVIKhrt1H8RK0+ZalkOy3V3FAIecH3BxbwAeGhmDmEbSr/Prhy3ijIVF/67j/Qx+GUNkY6AFWO78NUvsrx88RIbGJ6lMVz6RDdtmzwNnIS1cXRkxmeK8tfr1brf2jQoqSzUswmfLAYy/n0RoZww7VzcL5O/9nATon6b36hG8XAU04AINqko19/ZxQWUuX2kHwGe3UTRcHvzJSB+z2I/vumvnfLSoQI9Q4DO/uvd62ap+V/4Rbi2tEvNb/kqHMpB9BswCCJTZkGqRcCvgMjzLbVpbewQmlH4n2zD35uReeIiZibileG5flkVIa3x3Fw/mo0nWa5YKCE49cQsETPRLBdfleyqtFIaEScVxgDIWvxxJq9mCybvIZ9VgsthoKtcspCUcNen8ptNwzuGd2TzHeL5rs1WLJGwSlnIzGlRrbNsDb+HHgDCSZr7AKTE9H+JFbg3gKu8NtoM/M+KPXDUn03Z0RFYildsMh1Q8C58ZeHTPbX/ZMZN8VWRQfKD7YANueOEji37jeSDpWY2Iyq0Q0d65M/slm1jrR+x+C98VBpB/Iw8o1R/qOqFlqL9MXX6mg="
language: c
addons:
apt:
packages:
- libgmp-dev
- linux-kernel-headers
- build-essential
- kernel-package
- libssl-dev
before_install:
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
addons:
coverity_scan:
project:
name: "PeterHuewe/tpm-emulator"
description: "PeterHuewe/tpm-emulator"
notification_email: peterhuewe@gmx.de
build_command_prepend: mkdir -p build && cd build && cmake -DBUILD_DEV=OFF ../
build_command: make
branch_pattern: master
script: mkdir -p build && cd build && cmake -DBUILD_DEV=OFF ../ && make && cd ..
================================================
FILE: AUTHORS
================================================
Mario Strasser <mast@gmx.net>
Heiko Stamer <stamer@gaos.org> [DAA]
================================================
FILE: CMakeLists.txt
================================================
# Software-based Trusted Platform Module (TPM) Emulator
# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
#
# $Id: CMakeLists.txt 475 2011-12-20 18:21:19Z mast $
project(TPM_Emulator C)
cmake_minimum_required(VERSION 2.4)
include(GNUInstallDirs)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
# enforce out of source build
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" IS_INSOURCE)
if(IS_INSOURCE)
message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build.")
endif()
# set project and build version
set(${PROJECT_NAME}_VERSION_MAJOR 0)
set(${PROJECT_NAME}_VERSION_MINOR 7)
string(REGEX REPLACE ".*Revision: ([0-9]+).*" "\\1" ${PROJECT_NAME}_VERSION_BUILD "$Revision: 475 $")
# create project configuration
if(WIN32)
STRING(REGEX REPLACE "\\\\" "/" PROGRAMFILES "$ENV{PROGRAMFILES}/${PROJECT_NAME}")
set(TPM_LOG_FILE "${PROGRAMFILES}/tpmd.log")
set(TPM_STORAGE_NAME "${PROGRAMFILES}/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}")
set(TPM_DEVICE_NAME "//./pipe/tpmd:0")
elseif(APPLE)
set(TPM_LOG_FILE "/private/var/log/tpmd.log")
set(TPM_SOCKET_NAME "/private/var/run/tpm/tpmd_socket:0")
set(TPM_STORAGE_NAME "/private/var/lib/tpm/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}")
set(TPM_DEVICE_NAME "/dev/tpm")
else()
set(TPM_LOG_FILE "/var/log/tpmd.log")
set(TPM_SOCKET_NAME "/var/run/tpm/tpmd_socket:0")
set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}")
set(TPM_DEVICE_NAME "/dev/tpm")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-Wall -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
option(ENABLE_WERROR "Make warnings into errors")
if(ENABLE_WERROR)
add_definitions(-Werror)
endif()
if("${CMAKE_SYSTEM}" MATCHES "Linux")
add_definitions(-Wextra)
endif()
if(USE_OPENSSL)
add_definitions(-DUSE_OPENSSL)
endif()
include_directories("/opt/local/include")
link_directories("/opt/local/lib")
# configure CPack
set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
set(CPACK_SOURCE_PACKAGE_FILE_NAME "tpm_emulator-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.4")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES ".svn/" "/build/" "/.project" "/.cproject")
set(CPACK_GENERATOR "ZIP")
set(CPACK_SET_DESTDIR ON)
include(CPack)
# include root directories
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
# add internal libraries
add_subdirectory(tpm)
option(MTM_EMULATOR "MTM emulator")
if(MTM_EMULATOR)
add_subdirectory(mtm)
endif()
add_subdirectory(crypto)
# add TDDL
add_subdirectory(tddl)
# add kernel modules
option(BUILD_DEV "Build linux kernel module" ON)
if(BUILD_DEV)
add_subdirectory(tpmd_dev)
endif()
# add executables
add_subdirectory(tpmd)
================================================
FILE: ChangeLog
================================================
2011-11-05 Mario Strasser <mast@gmx.net>
* ChangeLog: ChangeLog updated
* CMakeList.txt: minor version number updated
* tpm_integrity.c: Fixed bug in TPM_Quote2; thanks go to Andreas Steffen
2011-11-12 Mario Strasser <mast@gmx.net>
* tpmd_dev/darwin/*: Added support for OS X 10.6; thanks go to Uri Blumenthal
* tpm_counter.c: Bug in TPM_IncrementCounter fixed; thanks go to Charles T
2011-11-05 Mario Strasser <mast@gmx.net>
* ChangeLog: ChangeLog updated
* CMakeList.txt: minor version number updated
2011-10-25 Mario Strasser <mast@gmx.net>
* tpm_owner.c: set Pubek to false in TakeOwnership
2011-09-15 Mario Strasser <mast@gmx.net>
* tpmd_dev.c: fixed byter order conversion bug for aligned memory
2011-09-09 Mario Strasser <mast@gmx.net>
* tpm_identity.c: bug fix for MakeIdentity;
thanks go to Matthew Fioravante
2011-07-19 Mario Strasser <mast@gmx.net>
* tpm_authorization.c, tpm_cmd_handler.c, tpm_structures.h:
copy secret to auth struct
2011-07-19 Mario Strasser <mast@gmx.net>
* tpm_owner.c: error codes revised
2011-07-19 Mario Strasser <mast@gmx.net>
* tpm_nv_storage.c: bug in NV_DefineSpace fixed; thaks go to Luigi
2011-07-09 Mario Strasser <mast@gmx.net>
* CMakeLists.txt, crypto/*: preliminary openssl support added
2011-06-08 Mario Strasser <mast@gmx.net>
* tpm_emulator.h, tpm_owner.c, tpmd.c:
removed TPM_CONF_KEEP_PUBEK_READABLE
2011-06-04 Mario Strasser <mast@gmx.net>
* tpm_migration.c: bug in TPM_CMK_ApproveMA fixed
2011-02-13 Mario Strasser <mast@gmx.net>
* CMakeLists.txt: minor package version updated
2011-02-12 Mario Strasser <mast@gmx.net>
* ChangeLog: ChangeLog updated
* CMakeLists.txt: minor package version updated
* tpmd_dev.c: switched to new ioctl function
2010-12-30 Mario Strasser <mast@gmx.net>
* build.bat: Missing path for Windows 7 added
2010-10-09 Mario Strasser <mast@gmx.net>
* tpm_capability.c: Bug in TPM_SetCapability fixed
2010-09-11 Mario Strasser <mast@gmx.net>
* all: Open/FreeBSD compatibility fixes
2010-07-19 Mario Strasser <mast@gmx.net>
* tpm_daa.c: Bug in TPM_LoadContext and TPM_DAA_Join/Sign
fixed; thanks go toEmanuele Cesena
2010-07-05 Mario Strasser <mast@gmx.net>
* ChangeLog: ChangeLog updated
* tpmd_dev/linux/*: missing kernel header file added
2010-06-13 Mario Strasser <mast@gmx.net>
* tpm_migration.c, tpm_cmd_handler.c, tpm_crypto.c:
bugs in [CMK]MigrationBlob encoding, TPM_MigrateKey(),
and TPM_CertifyKey2 fixed; thanks go to S. Tate
* tpm_structures.h: bug in TPM_CERTIFY_INFO fixed;
thanks go to S. Tate
2010-06-10 Mario Strasser <mast@gmx.net>
* tpm_nv_storage.c: bug in TPM_NV_WriteValue() fixed;
thanks go to Luigi Semenzato
2010-03-17 Mario Strasser <mast@gmx.net>
* tpm_emulator_extern.[ch]: external functions changed
into function pointers
* tpmd/*/tpmd.c: tpmd functions updated
2010-03-12 Mario Strasser <mast@gmx.net>
* tpm_nv_storage.c: bug in TPM_NV_DefineSpace fixed;
thanks go to Luigi Semenzato
* README, build.sh: build description updated
2010-02-22 Mario Strasser <mast@gmx.net>
* tpmd_dev/darwin/*: darwin module added
* Makefile: installation on Mac OS X enabled
* README: README updated
* ChangeLog: ChangeLog updated
2010-02-19 Mario Strasser <mast@gmx.net>
* windows/*: several fixes
* crypto/bn.c: work around for older gmp libs
* tddl/*: platform independent tddl
* README: README updated
2010-02-18 Mario Strasser <mast@gmx.net>
* build.sh, buils.bat: build scripts added
* tpmd.c, tpm_emulator_extern.h: log modes independent of syslog
* windows/tpmd.c: tpmd for windows added
* windows/control_tpmd.bat: service control function added
2010-02-16 Mario Strasser <mast@gmx.net>
* tpm/*: MTM functions added
* tpmd.c: parameter to set configuration flags added
* README: README updated
2010-02-15 Mario Strasser <mast@gmx.net>
* tpm_emulator.h, tpm_cmd_handler.c: startup configuration added
* CMakeLists.txt: build of openbsd module added
* tpm/*: MTM support prepared and MTM hooks added
2010-02-13 Mario Strasser <mast@gmx.net>
* all: unused variables removed; free_TPM_DATA added
2010-02-12 Mario Strasser <mast@gmx.net>
* tpm_marshalling.[ch]: (un)marshaling_TPM_DATA added
2010-02-11 Mario Strasser <mast@gmx.net>
* CMakeLists.txt: installation support added
* README: README updated
* *.h: headers updated
2010-02-10 Mario Strasser <mast@gmx.net>
* all: new CMake makefiles added
* README: README updated
* CMakeLists.txt, config.h.in: cpack support added
2010-02-09 Mario Strasser <mast@gmx.net>
* crypto/*, tpm/*: BE* conversion functions removed
* tpmd/tpmd.c: smart startup mode handling
* crypto/*.h, tpm/*.h: tpm_emulator_config.h removed
* tpm_testinc.c: usage of tpm_min/max removed
* tpm_data.c, tpm_emulator_extern.h, tpmd.c:
_file -> _storage
* config.h: central config.h added
* all: directory structure changed
2009-12-05 Mario Strasser <mast@gmx.net>
* tpmd_dev/Makefile: installation patch added, thanks go to David Anderson
2009-10-05 Mario Strasser <mast@gmx.net>
* all: numerous bug fixes to make the trousers test pass
2009-10-02 Mario Strasser <mast@gmx.net>
* tpm_delegation.c: delegation support completed
2009-09-24 Mario Strasser <mast@gmx.net>
* tpm_crypto.c: internal, deterministic PRNG added (for testing etc.)
* tpm_authorization.c: DSAP verification added
2009-09-19 Mario Strasser <mast@gmx.net>
* tpm_capability.c: TPM_SetCapability() added
* tpm_capability.c: TPM_GetCapability() completed
* ChangeLog: changelog updated
2009-09-18 Mario Strasser <mast@gmx.net>
* tpm_commands.h: declarations and descriptions of internal
functions added
2009-09-17 Mario Strasser <mast@gmx.net>
* tpm_authorization.c: DSAP support added
2009-08-28 Mario Strasser <mast@gmx.net>
* tpm_migration.c: CMK handling completed
* tpm_owner.c: TPM_OwnerClear() updated
* all: code cleanup, obsolete code removed
* tpm_capability.c: capability support revised
* tpm_commands.h: missing parameter added
2009-08-27 Mario Strasser <mast@gmx.net>
* tpm_structures.h: structures updated and completed
* all: major revision number incremented to 6 due to changes in the
internal data structure
* ChangeLog: changelog updated
2009-08-26 Mario Strasser <mast@gmx.net>
* tpm_migration.c: bugs in CMK functionality fixed, migration support
completed and enabled
* tpm_storage.c: usage of default exponent in pubkey generation fixed
2009-08-25 Mario Strasser <mast@gmx.net>
* tpm_migration.c: bugs in key migration functionality fixed
2009-08-19 Mario Strasser <mast@gmx.net>
* tpm_migration.c: TPM_CMK_CreateBlob() and
TPM_CMK_ConvertMigration() added
2009-08-13 Mario Strasser <mast@gmx.net>
* tpm_migration.c: size_t issue fixed; thanks to E. Fleury
2009-08-10 Mario Strasser <mast@gmx.net>
* tpm_storage.c: TPM_CreateWrapKey() updated
* tpm_migration.c: TPM_CMK_CreateKey() added
2009-08-09 Mario Strasser <mast@gmx.net>
* tpm_storage.c: tpm_decrypt and tpm_encrypt added
* tpm_migration.c: initial migration support added
* tpm_migration.c: CMK support added
2009-08-04 Mario Strasser <mast@gmx.net>
* tpm_deprecated.c, tpm_migration.c: bugs fixed; thanks to M. Schmidt
2009-06-05 Mario Strasser <mast@gmx.net>
* tpm_structures.c: bug in rsa key size computation fixed
2009-05-30 Mario Strasser <mast@gmx.net>
* tpm_owner.c: set readPubek to false once the TPM is owned
2009-04-08 Mario Strasser <mast@gmx.net>
* tpmd.c: missing mkdirs call added
2008-10-13 Mario Strasser <mast@gmx.net>
* rsa.[ch]: functions to determine rsa key length added
* tpm_structures.h: sizeof_RSA uses precise vales
2008-05-06 Mario Strasser <mast@gmx.net>
* tpm_storage.c: version 1.1 compatibility fixed
2008-03-23 Mario Strasser <mast@gmx.net>
* tpm_maintenance.c: management support added
* tpm_maintenance.c: several fixes in the maintenance support
* tpm_storage.c: TPM_Sealx fixed and TPM_UnSeal adapted
2008-03-22 Mario Strasser <mast@gmx.net>
* tpm_cmd_handler.c tpm_maintenance.c: maintenance support added
2008-03-21 Mario Strasser <mast@gmx.net>
* rsa.[ch], tpm_storage.c: TPM_Sealx added
2008-03-13 Mario Strasser <mast@gmx.net>
* tpm_owner.c: memory leak in TPM_OwnerClear fixed
2008-03-12 Mario Strasser <mast@gmx.net>
* rsa.c: memory leak fixed
* all: NV support added
2008-03-03 Heiko Stamer <stamer@gaos.org>
* tpm_deprecated.c, tpm_marshalling.c: TPM_ChangeAuthAsymFinish() added
* tpm_capability.c: supported commands changed
2008-02-21 Heiko Stamer <stamer@gaos.org>
* tpm_deprecated.c, tpm_storage.c: TPM_ChangeAuthAsymStart() added
2008-02-12 Mario Strasser <mast@gmx.net>
* ChangeLog: changes updated for release 0.5.1
2008-01-07 Mario Strasser <mast@gmx.net>
* tpmd_dev_openbsd/*: OpenBSD module added
2007-12-19 Heiko Stamer <stamer@gaos.org>
* tpm_cmd_handler.c, tpm_integrity.c: sig. bug in TPM_Quote2() fixed
2007-12-16 Heiko Stamer <stamer@gaos.org>
* tpm_transport.c: missing ptr initialization fixed
2007-12-15 Mario Strasser <mast@gmx.net>
* tddl.c, tpm_emulator_config.h: support for FreeBSD/OpenBSD added
2007-12-07 Heiko Stamer <stamer@gaos.org>
* tpm_structures.h: session identifier added
2007-12-07 Heiko Stamer <stamer@gaos.org>
* tpm_cmd_handler.c, tpm_counter.c: small fixes for counters
2007-12-07 Heiko Stamer <stamer@gaos.org>
* tpm_authorization.c, tpm_eviction.c, tpm_handles.c:
fixes and debug calls for TSS Test Suite (TrouSerS)
2007-12-07 Heiko Stamer <stamer@gaos.org>
* tpm_deprecated.c: fixed DIR index value, according to spec v1.2 rev 103
2007-12-05 Mario Strasser <mast@gmx.net>
* tpmd.c: optional creation of missing directories added
2007-11-19 Mario Strasser <mast@gmx.net>
* Makefile: make rule for tpmd_dev.rules.in added
2007-11-09 Mario Strasser <mast@gmx.net>
* tpm_storage.c, tpm_emulator_config.h: bug in TPMLoadKey fixed
2007-09-08 Mario Strasser <mast@gmx.net>
* Makefile: make rules for tpmd_dev.rules added
2007-09-05 Heiko Stamer <stamer@gaos.org>
* tpm_deprecated.c: minor bug fixes
2007-09-05 Heiko Stamer <stamer@gaos.org>
* tpm_deprecated.c: TPM_ChangeAuthAsymStart() updated
2007-09-02 Mario Strasser <mast@gmx.net>
* all Makefiles: some more install fixes
2007-08-23 Mario Strasser <mast@gmx.net>
* tpmd.c: bug in tpm_get_ticks fixed
2007-08-08 Mario Strasser <mast@gmx.net>
* tpm_integrity.c, tpm_startup.c: bug fixes regarding localityModifier
2007-08-07 Mario Strasser <mast@gmx.net>
* tpmd.c: effective user/group can be specified
2007-08-06 Mario Strasser <mast@gmx.net>
* all Makefiles: install-tool based installation
2007-08-02 Mario Strasser <mast@gmx.net>
* tpm_data.c, tpm_marshalling.c: fixes to make rev 103 changes work
* tpmd_dev.rules: udev rules added
2007-08-02 Heiko Stamer <stamer@gaos.org>
* tpm_credentials.c, tpm_crypto.c, tpm_daa.c, tpm_data.c,
tpm_marshalling.c, tpm_structures.h: fixes to make rev 103 changes work
2007-08-02 Mario Strasser <mast@gmx.net>
* Makefile: soname added
2007-08-01 Mario Strasser <mast@gmx.net>
* tddl.c, tpm_storage.c, Makefile, tpmd.c,
tpmd_dev.c: default storage directories for state and sockets changed
2007-07-28 Heiko Stamer <stamer@gaos.org>
* Makefile: setting soname (FIXME: need version?)
2007-07-28 Heiko Stamer <stamer@gaos.org>
* tpm_capability.c, tpm_deprecated.c,
tpm_integrity.c: fixes needed for adapting v1.2 rev 103
2007-07-27 Heiko Stamer <stamer@gaos.org>
* tpm_capability.c, tpm/tpm_commands.h, tpm_deprecated.c,
tpm_structures.h: changes from v1.2 rev 103
2007-07-25 Heiko Stamer <stamer@gaos.org>
* tpm_integrity.c: fixing a specification error corrected in v1.2 rev 103
2007-07-05 Mario Strasser <mast@gmx.net>
* tpmd.c: double free fixed, type bug fixed
2007-03-23 Mario Strasser <mast@gmx.net>
* tpmd.c: additional tpmd parameters added
2006-12-27 Mario Strasser <mast@gmx.net>
* Makefile, tddl.c: gcc 4.1 warnings removed
2006-12-03 Mario Strasser <mast@gmx.net>
* Makefile: tpm_dev excluded from standard distribution
2006-12-03 Mario Strasser <mast@gmx.net>
* all: tpm daemon and device driver library added
2006-11-29 Mario Strasser <mast@gmx.net>
* Makefile: VERSION_SUFFIX added
2006-11-14 Mario Strasser <mast@gmx.net>
* gmp_kernel_wrapper.c, tpm_data.c: import and export
functions simplified
* tpm_emulator_config.h: min/max macros renamed
* tpm_data.c, tpm_cmd_handler.c, tpm_startup.c:
startup/restore behavior adapted according to rev94
2006-11-12 Mario Strasser <mast@gmx.net>
* gmp_kernel_wrapper.c: __stack_chk_fail() to GNU MP wrapper added
* tpm_daa.c: size_t vs. uint32_t issue in DAA routines fixed
* rsa.c, tpm_daa.c, tpm_deprecated.c, tpm/tpm_testing.c,
tpm_transport.c: pointer signedness warnings fixed
2006-11-11 Mario Strasser <mast@gmx.net>
* bn.[ch], rsa.[ch], tpm_daa.c, tpm_storage.c, tpm_testing.c:
bn wrapper added
* gmp_kernel_wrapper.c, linux_module.c: printf format for size_t fixed
2006-11-10 Mario Strasser <mast@gmx.net>
* all: potential name space conflicts for global symbols solved
2006-11-07 Mario Strasser <mast@gmx.net>
* sha1.[ch], tpm_*: some issues related to 64bit architecture
and size_t fixed
* rsa.c: potential bug in key generation fixed
* all: advanced compiler warnings and name space collisions fixed
2006-10-25 Mario Strasser <mast@gmx.net>
* gmp_kernel_wrapper.c, rsa.c: removed all GNU MP random routines
* linux_module.c, linux_module.h, tpm_emulator_config.h: moved all host
specific functions and configuration parameters from
linux_module.h into tpm_emulator_config.h
* tpm_audit.c, tpm_identity.c, tpm_marshalling.h, tpm_transport.c:
fixed some marshalling statements which cause troubles
if memory alignment is mandatory
2006-10-20 Mario Strasser <mast@gmx.net>
* tpm_capability: inline definition changed due to
interoperability reasons
* tpm_cmd_handler.c: marshalling bug in TPM_Seal[x] fixed
2006-10-17 Mario Strasser <mast@gmx.net>
* tpm_cmd_handler.c, tpm_emulator.h: meaning of out/out_size
parameter for tpm_handle_command slightly modified
* linux_module.c: support for storage_file parameter added
* linux_module.[ch], tpm_data.c: file storage functions moved
into module
* all: some minor typos/bugs fixed
2006-10-11 Mario Strasser <mast@gmx.net>
* all: redundant includes removed
2006-09-03 Heiko Stamer <stamer@gaos.org>
* tpm_capability.c: small fixes (TPM_MANUFACTURER)
2006-08-14 Mario Strasser <mast@gmx.net>
* tpm_storage.c: required key size fixed
2006-08-06 Heiko Stamer <stamer@gaos.org>
* tpm_error.c: DAA error description added
2006-08-01 Heiko Stamer <stamer@gaos.org>
* tpm_integrity.c: TPM_Quote2() added
2006-06-23 Mario Strasser <mast@gmx.net>
* tpm_startup.c: behaviour of ST_CLEAR and storage of
persistent data adapted
2006-06-18 Heiko Stamer <stamer@gaos.org>
* tpm_identity.c: identity creation and activation,
that is TPM_MakeIdentity and TPM_ActivateIdentity added
2005-12-24 Mario Strasser <mast@gmx.net>
* tpm_transport.c, tpm_marshalling.c, tpm_structures.h:
Transport session functionality added
2005-12-16 Mario Strasser <mast@gmx.net>
* linux_module.c: ioctl() support added
* tpm_capability.c: TPM_GetCapability() adapted to make
it work with trousers
2005-12-09 Heiko Stamer <stamer@gaos.org>
* tpm_marshalling.c, tpm_daa.c, rsa.c: DAA functionality,
that is TPM_DAA_Join and TPM_DAA_Sign added
2005-08-15 Mario Strasser <mast@gmx.net>
* all: some typos corrected
* tpm_integrity.c: bug in TPM_Extend fixed
2005-05-07 Mario Strasser <mast@gmx.net>
* bug in TPM_SaveContext fixed
2005-04-30 Mario Strasser <mast@gmx.net>
* tpm_digest.c: audit functionality added
2005-04-29 Mario Strasser <mast@gmx.net>
* tpm_context.c: TPM_KeyControlOwner, TPM_SaveContext,
and TPM_LoadContext added
* tpm_deprecated: TPM_(Save|Load)(Key|Auth)Context added
* rc4.[ch]: RC4 encryption added
* rsa.c: rsa_copy_key added
2005-04-27 Mario Strasser <mast@gmx.net>
* tpm_crypto.c: TPM_CertifyKey and TPM_CertifyKey2 added
* tpm_deprecated: TPM_OwnerReadPubek, TPM_CertifySelfTest,
TPM_DirWriteAuth, and TPM_DirRead added
2005-04-26 Mario Strasser <mast@gmx.net>
* tpm_ticks.c: timing ticks functionality added
* tpm_authorization.c: TPM_ChangeAuth and TPM_ChangeAuthOwner added
* tpm_storage, tpm_crypto.c, tpm_integrity.c: authorization
verification now considers the value of authDataUsage
* tpm_storage: TPM_UnBind added
2004-10-24 Mario Strasser <mast@gmx.net>
* Makefile: new makefile for Linux kernels > 2.5.0 build system
* tpm_testing.c: replacement of some floating-point calculations
with fix-point arithmetic
* all: minor changes int the directory and header file structure
to make the package easier portable and maintainable
2004-07-01 Mario Strasser <mast@gmx.net>
* Initial release based on my semester thesis
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
================================================
FILE: README
================================================
_____ ____ __ __ _____ _ _
|_ _| _ \| \/ | | ____|_ __ ___ _ _| | __ _| |_ ___ _ __
| | | |_) | |\/| | _____ | _| | '_ ` _ \| | | | |/ _` | __/ _ \| '__|
| | | __/| | | | |_____| | |___| | | | | | |_| | | (_| | || (_) | |
|_| |_| |_| |_| |_____|_| |_| |_|\__,_|_|\__,_|\__\___/|_|
TPM-Emulator v0.7 -
A Software-based TPM and MTM Emulator.
--------------------------------------------------------------------------
Copyright
--------------------------------------------------------------------------
Copyright (C) 2009-2011 Mario Strasser.
Copyright (C) 2004-2009 Mario Strasser, ETH Zurich.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Package
--------------------------------------------------------------------------
The tpm emulator package comprises four main parts:
a) tpmd - a user-space application that implements the actual emulator
and can be accessed by means of Unix domain sockets (Unix) or
named pipes (Windows).
b) tpmd_dev - a kernel module that provides the device /dev/tpm for
backward compatibility and forwards the received commands to tpmd
(Unix and Mac OS X only).
c) tddl - a TSS conform device driver library for the emulator.
Compilation and Installation
--------------------------------------------------------------------------
The compilation and installation of the TPM emulator package is based on
the CMake build environment (version 2.6 or better) and requires that the
GNU MP library (version 4.0 or better) is properly installed on your
system. A working MinGW compiler suite is further required on Windows
(see http://www.mingw.org/). To compile and install the package execute:
# tar -xvzf tpm_emulator-X.Y.tar.gz
# cd tpm_emulator-X.Y
# mkdir build
# cd build
# cmake ../
# make
# make install
The script files build.sh and build.bat automate the compliation process.
On Windows, the TPM emulator system service has additionally to be
registered by calling:
# control_tpmd.bat install
MTM support can be enabled by replacing
# cmake ../
with
# cmake ../ -DMTM_EMULATOR=ON
Startup
--------------------------------------------------------------------------
In order to use the TPM emulator on Unix or Mac OS X, one has to start the
TPM emulator daemon and load the TPM device forwarding module. On Linux,
this is done by executing:
# modprobe tpmd_dev
# tpmd
On Windows, the TPM emulator service can either be started with the
Microsoft Management Console or with the control_tpmd.bat script:
# control_tpmd.bat start
# control_tpmd.bat status
The startup mode of the TPM (see TPM Spec. Part 1) is defined by the
startup mode argument and can either be set to clear, save (default)
or deactivated. Additionally supported arguments are
usage: tpmd [-d] [-f] [-s storage file] [-u unix socket name]
[-o user name] [-g group name] [-h] [startup mode]
d : enable debug mode
f : forces the application to run in the foreground
s : storage file to use (default: /var/lib/tpm/tpm_emulator-1_2_0_7)
u : unix socket name to use (default: /var/run/tpm/tpmd_socket:0)
o : effective user the application should run as
g : effective group the application should run as
h : print this help message
startup mode : must be 'clear', 'save' (default) or 'deactivated
and
usage: tpmd.exe [-d] [-f] [-s storage file] [-u windows pipe name]
[-l log file] [-h] [startup mode]
d : enable debug mode
f : forces the application to run in the foreground
s : storage file to use (default:
C:/Program Files/TPM_Emulator/tpm_emulator-1_2_0_7)
u : windows named pipe name to use (default: //./pipe/tpmd:0)
l : name of the log file (default: C:/Program Files/TPM_Emulator/tpmd.log)
h : print this help message
startup mode : must be 'clear', 'save' (default) or 'deactivated
on Unix and Windows, respectively.
If the emulator is started in mode save and fails to load a previously
stored TPM state, it will go into fail-stop mode and has to be reloaded.
Therefore, the first time the TPM emulator is started, the argument must
be set to 'clear'. Recovering a TPM emulator that is in fail-stop mode
is done by first deactivating it and then reloading it in mode 'clear':
# tpmd deactivated
# killall tpmd
# tpmd clear
Usage and Backward Compatibility
--------------------------------------------------------------------------
The most correct and convenient way to access the tpm emulator is to use
the provided device driver library (tddl). For a comprehensive description
of its functionality we refer to the official TCG specification (see
https://www.trustedcomputinggroup.org/specs/TSS), an example of use is
given by the test application tddl/test_tddl.
Note that on Windows the tddl is called ifxtpm.dll as many applications
(e.g., TPM/J) expect this name and do not support alternative drivers.
For backward compatibility with existing Unix applications, the kernel
module tpmd_dev forwards any command sent to the device /dev/tpm to the
tpm emulator daemon. In order to access the emulator directly (i.e.,
without using the device driver library or the device dev/tpm) all one
has to do is to include the header files sys/socket.h and sys/un.h and
to replace the open("/dev/tpm") call with something like:
struct sockaddr_un addr;
fh = socket(PF_UNIX, SOCK_STREAM, 0);
if (fh < 0) { /* handle error */ }
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, "/var/run/tpm/tpmd_socket:0", sizeof(addr.sun_path)-1);
res = connect(fh, (struct sockaddr*)&addr, sizeof(struct sockaddr_un));
if (res < 0) { /* handle error */ }
All subsequent calls of read(), write(), and close() should work as
expected.
Usage Examples for TPM/J
--------------------------------------------------------------------------
=== Linux
# modprobe tpmd_dev
# tpmd -d
# cd <path to tpmj>/lib
# export CLASSPATH=tpmj.jar:bcprov-jdk15-131.jar:$CLASSPATH
# java edu.mit.csail.tpmj.tools.TPMInfo
=== Mac OS X
# sudo kextload /System/Library/Extensions/tpm_bridge.kext
# sudo tpmd -d
# cd <path to tpmj>/lib
# export CLASSPATH=tpmj.jar:bcprov-jdk15-131.jar:$CLASSPATH
# sudo java edu.mit.csail.tpmj.tools.TPMInfo
=== Windows
# set PATH=%PROGRAMFILES%\TPM_Emulator;%PATH%
# set PATH=%PROGRAMFILES%\TPM_Emulator\lib;%PATH%
# control_tpmd.bat start
# cd <path to tpmj>\lib
# set CLASSPATH=tpmj.jar;bcprov-jdk15-131.jar:%CLASSPATH%
# java edu.mit.csail.tpmj.tools.TPMInfo
Notes
--------------------------------------------------------------------------
* Since release 0.7 the emulator also runs on Darwin (Mac OS X) and on
Windows; thanks go to Amit Singh and Domenic Schröder. In addition,
the emulator now also supports MTM emulation; thanks go to Jan-Erik
Ekberg and Markku Kylänpää from Nokia.
* Since release 0.5.1 the emulator supports Free- and OpenBSD; thanks go
to Sebastian Schuetz.
* Since release 0.5 the kernel-based emulator (tpm_dev) is obsolete.
* The name and format of the persistent-storage file has changed between
release 0.2 and 0.3, 0.4 and 0.4.1., 0.5 and 0.6, and 0.6 and 0.7.
* The DAA support was tested with the IBM DAA Test Suite and should work
now as expected. Thanks go to Roger Zimmermann for his kindly help.
Contact
--------------------------------------------------------------------------
Any comments, suggestions and bug reports are welcome. Please, mention
the keyword 'TPM emulator' in the subject.
Peter Huewe <peterhuewe@gmx.de>
Mario Strasser <mast@gmx.net>
================================================
FILE: build.bat
================================================
@echo off
set BUILD_DIR=build
set PATH=C:\MinGW\bin;C:\Program Files\CMake 2.8\bin;C:\Program Files (x86)\CMake 2.8\bin;%PATH%
if "%1" == "clean" rmdir "%BUILD_DIR%" /S /Q
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd %BUILD_DIR%
cmake .. -G "MinGW Makefiles"
::cmake .. -G "MinGW Makefiles" -DMTM_EMULATOR=ON
mingw32-make
cd ..
================================================
FILE: build.sh
================================================
#!/bin/sh
BUILD_DIR="build"
if [ "$1" = "clean" ]; then
rm -rf $BUILD_DIR
fi
if [ ! -d $BUILD_DIR ]; then
mkdir $BUILD_DIR || exit 1
fi
cd build
cmake ../ #-DMTM_EMULATOR=ON
make
cd ..
exit 0
================================================
FILE: config.h.in
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: config.h.in 426 2010-02-22 17:11:58Z mast $
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
/* project and build version */
#define VERSION_MAJOR ${TPM_Emulator_VERSION_MAJOR}
#define VERSION_MINOR ${TPM_Emulator_VERSION_MINOR}
#define VERSION_BUILD ${TPM_Emulator_VERSION_BUILD}
/* TDDL and LKM configuration */
#define TPM_SOCKET_NAME "${TPM_SOCKET_NAME}"
#define TPM_STORAGE_NAME "${TPM_STORAGE_NAME}"
#define TPM_DEVICE_NAME "${TPM_DEVICE_NAME}"
#define TPM_LOG_FILE "${TPM_LOG_FILE}"
#define TPM_CMD_BUF_SIZE 4096
#endif /* _CONFIG_H_ */
================================================
FILE: crypto/CMakeLists.txt
================================================
# Software-based Trusted Platform Module (TPM) Emulator
# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
#
# $Id: CMakeLists.txt 464 2011-07-09 14:57:41Z mast $
file(GLOB tpm_crypto_SRCS "*.[h|c]")
file(GLOB bn_SRCS "bn_*.c")
list(REMOVE_ITEM tpm_crypto_SRCS ${bn_SRCS})
if(USE_OPENSSL)
list(APPEND tpm_crypto_SRCS "bn_openssl.c")
add_library(tpm_crypto STATIC ${tpm_crypto_SRCS})
target_link_libraries(tpm_crypto crypto)
else()
list(APPEND tpm_crypto_SRCS "bn_gmp.c")
add_library(tpm_crypto STATIC ${tpm_crypto_SRCS})
target_link_libraries(tpm_crypto gmp)
endif()
================================================
FILE: crypto/bn.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: bn.h 464 2011-07-09 14:57:41Z mast $
*/
#ifndef _BN_H_
#define _BN_H_
#include <stddef.h>
#include <stdint.h>
#ifdef USE_OPENSSL
#include <openssl/bn.h>
typedef BIGNUM tpm_bn_t[1];
#else
#include <gmp.h>
typedef mpz_t tpm_bn_t;
#endif
void tpm_bn_init(tpm_bn_t a);
void tpm_bn_init2(tpm_bn_t a, size_t nbits);
void tpm_bn_init_set(tpm_bn_t a, tpm_bn_t val);
void tpm_bn_init_set_ui(tpm_bn_t a, uint32_t val);
void tpm_bn_set_ui(tpm_bn_t a, uint32_t val);
void tpm_bn_clear(tpm_bn_t a);
void tpm_bn_swap(tpm_bn_t a, tpm_bn_t b);
uint32_t tpm_bn_bitsize(tpm_bn_t a);
void tpm_bn_import(tpm_bn_t out, size_t count, int order, const void *in);
void tpm_bn_export(void *out, size_t *count, int order, tpm_bn_t in);
int tpm_bn_cmp(tpm_bn_t a, tpm_bn_t b);
int tpm_bn_cmp_ui(tpm_bn_t a, uint32_t b);
int tpm_bn_sgn(tpm_bn_t a);
void tpm_bn_setbit(tpm_bn_t res, uint32_t bit);
void tpm_bn_add(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b);
void tpm_bn_add_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b);
void tpm_bn_sub(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b);
void tpm_bn_sub_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b);
void tpm_bn_mul(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b);
void tpm_bn_mod(tpm_bn_t res, tpm_bn_t a, tpm_bn_t mod);
void tpm_bn_powm(tpm_bn_t res, tpm_bn_t base, tpm_bn_t exp, tpm_bn_t mod);
void tpm_bn_ui_pow_ui(tpm_bn_t res, uint32_t base, uint32_t exp);
void tpm_bn_fdiv_q_2exp(tpm_bn_t res, tpm_bn_t n, uint32_t b);
void tpm_bn_tdiv_q(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b);
void tpm_bn_gcd(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b);
void tpm_bn_invert(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b);
void tpm_bn_nextprime(tpm_bn_t res, tpm_bn_t a);
#endif /* _BN_H_ */
================================================
FILE: crypto/bn_gmp.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: bn_gmp.c 464 2011-07-09 14:57:41Z mast $
*/
#include "bn.h"
void tpm_bn_init(tpm_bn_t a)
{
mpz_init(a);
}
void tpm_bn_init2(tpm_bn_t a, size_t nbits)
{
mpz_init2(a, nbits + GMP_NUMB_BITS);
}
void tpm_bn_init_set(tpm_bn_t a, tpm_bn_t val)
{
mpz_init_set(a, val);
}
void tpm_bn_init_set_ui(tpm_bn_t a, uint32_t val)
{
mpz_init_set_ui(a, val);
}
void tpm_bn_set_ui(tpm_bn_t a, uint32_t val)
{
mpz_set_ui(a, val);
}
void tpm_bn_clear(tpm_bn_t a)
{
mpz_clear(a);
}
void tpm_bn_swap(tpm_bn_t a, tpm_bn_t b)
{
mpz_swap(a, b);
}
uint32_t tpm_bn_bitsize(tpm_bn_t a)
{
return mpz_sizeinbase(a, 2);
}
void tpm_bn_import(tpm_bn_t out, size_t count, int order, const void *in)
{
mpz_import(out, count, order, 1, 0, 0, in);
}
void tpm_bn_export(void *out, size_t *count, int order, tpm_bn_t in)
{
size_t count_out;
mpz_export(out, &count_out, order, 1, 0, 0, in);
if (count != NULL) *count = count_out;
}
int tpm_bn_cmp(tpm_bn_t a, tpm_bn_t b)
{
return mpz_cmp(a, b);
}
int tpm_bn_cmp_ui(tpm_bn_t a, uint32_t b)
{
return mpz_cmp_ui(a, b);
}
int tpm_bn_sgn(tpm_bn_t a)
{
return mpz_sgn(a);
}
void tpm_bn_setbit(tpm_bn_t res, uint32_t bit)
{
mpz_setbit(res, bit);
}
void tpm_bn_add(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
mpz_add(res, a, b);
}
void tpm_bn_add_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
{
mpz_add_ui(res, a, b);
}
void tpm_bn_sub(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
mpz_sub(res, a, b);
}
void tpm_bn_sub_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
{
mpz_sub_ui(res, a, b);
}
void tpm_bn_mul(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
mpz_mul(res, a, b);
}
void tpm_bn_mod(tpm_bn_t res, tpm_bn_t a, tpm_bn_t mod)
{
mpz_mod(res, a, mod);
}
void tpm_bn_powm(tpm_bn_t res, tpm_bn_t base, tpm_bn_t exp, tpm_bn_t mod)
{
mpz_powm(res, base, exp, mod);
}
void tpm_bn_ui_pow_ui(tpm_bn_t res, uint32_t base, uint32_t exp)
{
mpz_ui_pow_ui(res, base, exp);
}
void tpm_bn_fdiv_q_2exp(tpm_bn_t res, tpm_bn_t n, uint32_t b)
{
mpz_fdiv_q_2exp(res, n, b);
}
void tpm_bn_tdiv_q(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
mpz_tdiv_q(res, a, b);
}
void tpm_bn_gcd(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
mpz_gcd(res, a, b);
}
void tpm_bn_invert(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
mpz_invert(res, a, b);
}
void tpm_bn_nextprime(tpm_bn_t res, tpm_bn_t a)
{
mpz_nextprime(res, a);
}
================================================
FILE: crypto/bn_openssl.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2011 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: bn.c 406 2010-02-19 11:08:30Z mast $
*/
#include "bn.h"
BN_CTX *bn_ctx = NULL;
void tpm_bn_init(tpm_bn_t a)
{
if (bn_ctx == NULL) bn_ctx = BN_CTX_new();
BN_init(a);
}
void tpm_bn_init2(tpm_bn_t a, size_t nbits)
{
tpm_bn_init(a);
BN_set_bit(a, nbits);
BN_clear_bit(a, nbits);
}
void tpm_bn_init_set(tpm_bn_t a, tpm_bn_t val)
{
tpm_bn_init(a);
BN_copy(a, val);
}
void tpm_bn_init_set_ui(tpm_bn_t a, uint32_t val)
{
tpm_bn_init(a);
BN_set_word(a, val);
}
void tpm_bn_set_ui(tpm_bn_t a, uint32_t val)
{
BN_set_word(a, val);
}
void tpm_bn_clear(tpm_bn_t a)
{
BN_clear_free(a);
}
void tpm_bn_swap(tpm_bn_t a, tpm_bn_t b)
{
BN_swap(a, b);
}
uint32_t tpm_bn_bitsize(tpm_bn_t a)
{
return BN_num_bits(a);
}
void tpm_bn_import(tpm_bn_t out, size_t count, int order, const void *in)
{
//FIXME: reverse order if order != 1.
BN_bin2bn(in, count, out);
}
void tpm_bn_export(void *out, size_t *count, int order, tpm_bn_t in)
{
//FIXME: reverse order if order != 1.
BN_bn2bin(in, out);
if (count != NULL) *count = BN_num_bytes(in);
}
int tpm_bn_cmp(tpm_bn_t a, tpm_bn_t b)
{
return BN_cmp(a, b);
}
int tpm_bn_cmp_ui(tpm_bn_t a, uint32_t b)
{
tpm_bn_t b2;
tpm_bn_init_set_ui(b2, b);
int res = tpm_bn_cmp(a, b2);
tpm_bn_clear(b2);
return res;
}
int tpm_bn_sgn(tpm_bn_t a)
{
if (BN_is_zero(a)) return 0;
return BN_is_negative(a) ? -1 : 1;
}
void tpm_bn_setbit(tpm_bn_t res, uint32_t bit)
{
BN_set_bit(res, bit);
}
void tpm_bn_add(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
BN_add(res, a, b);
}
void tpm_bn_add_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
{
BN_copy(res, a);
BN_add_word(res, b);
}
void tpm_bn_sub(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
BN_sub(res, a, b);
}
void tpm_bn_sub_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
{
BN_copy(res, a);
BN_sub_word(res, b);
}
void tpm_bn_mul(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
BN_mul(res, a, b, bn_ctx);
}
void tpm_bn_mod(tpm_bn_t res, tpm_bn_t a, tpm_bn_t mod)
{
BN_mod(res, a, mod, bn_ctx);
}
void tpm_bn_powm(tpm_bn_t res, tpm_bn_t base, tpm_bn_t exp, tpm_bn_t mod)
{
BN_mod_exp(res, base, exp, mod, bn_ctx);
}
void tpm_bn_ui_pow_ui(tpm_bn_t res, uint32_t base, uint32_t exp)
{
//FIXME:
BIGNUM b, e;
BN_init(&b);
BN_init(&e);
BN_set_word(&b, base);
BN_set_word(&e, exp);
BN_exp(res, &b, &e, bn_ctx);
BN_clear_free(&b);
BN_clear_free(&e);
}
void tpm_bn_fdiv_q_2exp(tpm_bn_t res, tpm_bn_t n, uint32_t b)
{
BN_rshift(res, n, b);
}
void tpm_bn_tdiv_q(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
BN_div(res, NULL, a, b, bn_ctx);
}
void tpm_bn_gcd(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
BN_gcd(res, a, b, bn_ctx);
}
void tpm_bn_invert(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
{
BN_mod_inverse(res, a, b, bn_ctx);
}
void tpm_bn_nextprime(tpm_bn_t res, tpm_bn_t a)
{
BN_copy(res, a);
BN_set_bit(res, 0);
while (!BN_is_prime(res, BN_prime_checks, NULL, bn_ctx, NULL)) {
BN_add_word(res, 2);
}
}
================================================
FILE: crypto/hmac.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: hmac.c 364 2010-02-11 10:24:45Z mast $
*/
#include "hmac.h"
#include <string.h>
void tpm_hmac_init(tpm_hmac_ctx_t *ctx, const uint8_t *key, size_t key_len)
{
uint8_t tk[SHA1_DIGEST_LENGTH];
uint8_t k_ipad[HMAC_PAD_LENGTH];
int i;
/* if the key is longer than 64 bytes reset it to key := hash(key) */
if (key_len > HMAC_PAD_LENGTH) {
tpm_sha1_init(&ctx->ctx);
tpm_sha1_update(&ctx->ctx, key, key_len);
tpm_sha1_final(&ctx->ctx, tk);
key = tk;
key_len = SHA1_DIGEST_LENGTH;
}
/* start out by storing key in pads */
memset(k_ipad, 0, HMAC_PAD_LENGTH);
memset(ctx->k_opad, 0, HMAC_PAD_LENGTH);
memcpy(k_ipad, key, key_len);
memcpy(ctx->k_opad, key, key_len);
/* xor key with ipad and opad values */
for (i = 0; i < HMAC_PAD_LENGTH; i++) {
k_ipad[i] ^= 0x36;
ctx->k_opad[i] ^= 0x5C;
}
/* start inner hash */
tpm_sha1_init(&ctx->ctx);
tpm_sha1_update(&ctx->ctx, k_ipad, HMAC_PAD_LENGTH);
}
void tpm_hmac_update(tpm_hmac_ctx_t *ctx, const uint8_t *data, size_t length)
{
/* update inner hash */
tpm_sha1_update(&ctx->ctx, data, length);
}
void tpm_hmac_final(tpm_hmac_ctx_t *ctx, uint8_t *digest)
{
/* complete inner hash */
tpm_sha1_final(&ctx->ctx, digest);
/* perform outer hash */
tpm_sha1_init(&ctx->ctx);
tpm_sha1_update(&ctx->ctx, ctx->k_opad, HMAC_PAD_LENGTH);
tpm_sha1_update(&ctx->ctx, digest, SHA1_DIGEST_LENGTH);
tpm_sha1_final(&ctx->ctx, digest);
}
================================================
FILE: crypto/hmac.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: hmac.h 364 2010-02-11 10:24:45Z mast $
*/
#ifndef _HMAC_H_
#define _HMAC_H_
#include <stddef.h>
#include <stdint.h>
#include "sha1.h"
#define HMAC_PAD_LENGTH 64
typedef struct {
tpm_sha1_ctx_t ctx;
uint8_t k_opad[HMAC_PAD_LENGTH];
} tpm_hmac_ctx_t;
void tpm_hmac_init(tpm_hmac_ctx_t *ctx, const uint8_t *key, size_t key_len);
void tpm_hmac_update(tpm_hmac_ctx_t *ctx, const uint8_t *data, size_t length);
void tpm_hmac_final(tpm_hmac_ctx_t *ctx, uint8_t *digest);
#endif /* _HMAC_H_ */
================================================
FILE: crypto/rc4.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: rc4.c 364 2010-02-11 10:24:45Z mast $
*/
#include "rc4.h"
void tpm_rc4_init(tpm_rc4_ctx_t *ctx, uint8_t *key, size_t key_len)
{
int i;
uint8_t a, j, k;
ctx->x = ctx->y = 0;
for (i = 0; i < 256; i++) {
ctx->state[i] = i;
}
for (i = j = k = 0; i < 256; i++) {
a = ctx->state[i];
j += a + key[k++];
ctx->state[i] = ctx->state[j];
ctx->state[j] = a;
if (k >= key_len) k = 0;
}
/* to strengthen the algorithm it is recommended to
discard the first few (say 256) octets */
for (i = 0; i < 16; i++) {
uint8_t buf[16];
tpm_rc4_crypt(ctx, buf, buf, sizeof(buf));
}
}
void tpm_rc4_crypt(tpm_rc4_ctx_t *ctx, uint8_t *in, uint8_t *out, size_t length)
{
uint8_t a, x, y, *state;
x = ctx->x;
y = ctx->y;
state = ctx->state;
while (length--) {
x++;
y += state[x];
a = state[x];
state[x] = state[y];
state[y] = a;
a += state[x];
*out++ = *in++ ^ state[a];
}
ctx->x = x;
ctx->y = y;
}
================================================
FILE: crypto/rc4.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: rc4.h 364 2010-02-11 10:24:45Z mast $
*/
#ifndef _RC4_H_
#define _RC4_H_
#include <stddef.h>
#include <stdint.h>
typedef struct {
uint8_t state[256];
uint8_t x, y;
} tpm_rc4_ctx_t;
void tpm_rc4_init(tpm_rc4_ctx_t *s, uint8_t *key, size_t key_len);
void tpm_rc4_crypt(tpm_rc4_ctx_t *s, uint8_t *in, uint8_t *out, size_t length);
#endif /* _RC4_h_ */
================================================
FILE: crypto/rsa.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: rsa.c 364 2010-02-11 10:24:45Z mast $
*/
#include "rsa.h"
#include "sha1.h"
#include "tpm/tpm_commands.h"
static int rsa_public(tpm_rsa_public_key_t *key,
const uint8_t *in, size_t in_len, uint8_t *out)
{
size_t t;
tpm_bn_t p, c;
tpm_bn_init2(p, key->size);
tpm_bn_init2(c, key->size);
tpm_bn_import(p, in_len, 1, in);
/* c = p ^ d mod n */
tpm_bn_powm(c, p, key->e, key->n);
t = tpm_bn_bitsize(c);
if (t > key->size) {
tpm_bn_clear(p);
tpm_bn_clear(c);
return -1;
}
t = (key->size - t) >> 3;
memset(out, 0, t);
tpm_bn_export(&out[t], &t, 1, c);
tpm_bn_clear(p);
tpm_bn_clear(c);
return 0;
}
static int rsa_private(tpm_rsa_private_key_t *key,
const uint8_t *in, size_t in_len, uint8_t *out)
{
size_t t;
tpm_bn_t p, c, m1, m2, h;
tpm_bn_init2(p, key->size);
tpm_bn_init2(c, key->size);
tpm_bn_import(p, in_len, 1, in);
if (!key->p || !key->q || !key->u) {
/* c = p ^ d mod n */
tpm_bn_powm(c, p, key->d, key->n);
} else {
tpm_bn_init2(m1, key->size / 2);
tpm_bn_init2(m2, key->size / 2);
tpm_bn_init2(h, key->size);
/* m1 = p ^ (d mod (p-1)) mod p */
tpm_bn_sub_ui(h, key->p, 1);
tpm_bn_mod(h, key->d, h);
tpm_bn_powm(m1, p, h, key->p);
/* m2 = p ^ (d mod (q-1)) mod q */
tpm_bn_sub_ui(h, key->q, 1);
tpm_bn_mod(h, key->d, h);
tpm_bn_powm(m2, p, h, key->q);
/* h = u * ( m2 - m1 ) mod q */
tpm_bn_sub(h, m2, m1);
if (tpm_bn_sgn(h) < 0) tpm_bn_add(h, h, key->q);
tpm_bn_mul(h, key->u, h);
tpm_bn_mod(h, h, key->q);
/* c = m1 + h * p */
tpm_bn_mul(h, h, key->p);
tpm_bn_add(c, m1, h);
tpm_bn_clear(m1);
tpm_bn_clear(m2);
tpm_bn_clear(h);
}
t = tpm_bn_bitsize(c);
if (t > key->size) {
tpm_bn_clear(p);
tpm_bn_clear(c);
return -1;
}
t = (key->size - t) >> 3;
memset(out, 0, t);
tpm_bn_export(&out[t], &t, 1, c);
tpm_bn_clear(p);
tpm_bn_clear(c);
return 0;
}
static int rsa_test_key(tpm_rsa_private_key_t *key)
{
tpm_bn_t a, b, t;
int res = 0;
tpm_bn_init2(a, key->size);
tpm_bn_init2(b, key->size);
tpm_bn_init2(t, key->size);
tpm_bn_set_ui(t, 0xdeadbeef);
tpm_bn_powm(a, t, key->e, key->n);
tpm_bn_powm(b, a, key->d, key->n);
if (tpm_bn_cmp(t, b) != 0) res = -1;
tpm_bn_powm(a, t, key->d, key->n);
tpm_bn_powm(b, a, key->e, key->n);
if (tpm_bn_cmp(t, b) != 0) res = -1;
tpm_bn_clear(a);
tpm_bn_clear(b);
tpm_bn_clear(t);
return res;
}
int tpm_rsa_import_key(tpm_rsa_private_key_t *key, int endian,
const uint8_t *n, size_t n_len,
const uint8_t *e, size_t e_len,
const uint8_t *p, const uint8_t *q)
{
tpm_bn_t t1, t2, phi;
if (n == NULL || n_len == 0 || (p == NULL && q == NULL)) return -1;
/* init key */
key->size = n_len << 3;
if (e == NULL || e_len == 0) {
tpm_bn_init_set_ui(key->e, 65537);
} else {
tpm_bn_init2(key->e, e_len << 3);
tpm_bn_import(key->e, e_len, endian, e);
}
tpm_bn_init2(key->n, key->size);
tpm_bn_init2(key->p, key->size / 2);
tpm_bn_init2(key->q, key->size / 2);
tpm_bn_init2(key->d, key->size);
tpm_bn_init2(key->u, key->size / 2);
tpm_bn_init2(t1, key->size / 2);
tpm_bn_init2(t2, key->size / 2);
tpm_bn_init2(phi, key->size);
/* import values */
tpm_bn_import(key->n, n_len, endian, n);
if (p != NULL) tpm_bn_import(key->p, n_len / 2, endian, p);
if (q != NULL) tpm_bn_import(key->q, n_len / 2, endian, q);
if (p == NULL) tpm_bn_tdiv_q(key->p, key->n, key->q);
if (q == NULL) tpm_bn_tdiv_q(key->q, key->n, key->p);
/* p shall be smaller than q */
if (tpm_bn_cmp(key->p, key->q) > 0) tpm_bn_swap(key->p, key->q);
/* calculate missing values */
tpm_bn_sub_ui(t1, key->p, 1);
tpm_bn_sub_ui(t2, key->q, 1);
tpm_bn_mul(phi, t1, t2);
tpm_bn_invert(key->d, key->e, phi);
tpm_bn_invert(key->u, key->p, key->q);
/* release helper variables */
tpm_bn_clear(t1);
tpm_bn_clear(t2);
tpm_bn_clear(phi);
/* test key */
if (rsa_test_key(key) != 0) {
tpm_rsa_release_private_key(key);
return -1;
}
return 0;
}
void tpm_rsa_copy_key(tpm_rsa_private_key_t *dst, tpm_rsa_private_key_t *src)
{
tpm_bn_init_set(dst->n, src->n);
tpm_bn_init_set(dst->e, src->e);
tpm_bn_init_set(dst->d, src->d);
tpm_bn_init_set(dst->p, src->p);
tpm_bn_init_set(dst->q, src->q);
tpm_bn_init_set(dst->u, src->u);
dst->size = src->size;
}
int tpm_rsa_import_public_key(tpm_rsa_public_key_t *key, int endian,
const uint8_t *n, size_t n_len,
const uint8_t *e, size_t e_len)
{
if (n == NULL || n_len == 0) return -1;
/* init key */
key->size = n_len << 3;
if (e == NULL || e_len == 0) {
tpm_bn_init_set_ui(key->e, 65537);
} else {
tpm_bn_init2(key->e, e_len << 3);
tpm_bn_import(key->e, e_len, endian, e);
}
tpm_bn_init2(key->n, key->size);
/* import values */
tpm_bn_import(key->n, n_len, endian, n);
return 0;
}
static void rsa_tpm_bn_random(tpm_bn_t a, size_t nbits)
{
size_t size = nbits >> 3;
uint8_t buf[size];
tpm_get_random_bytes(buf, size);
tpm_bn_import(a, size, 1, buf);
}
int tpm_rsa_generate_key(tpm_rsa_private_key_t *key, uint16_t key_size)
{
tpm_bn_t e, p, q, n, t1, t2, phi, d, u;
/* bit_size must be a multiply of eight */
while (key_size & 0x07) key_size++;
/* we use e = 65537 */
tpm_bn_init_set_ui(e, 65537);
tpm_bn_init2(p, key_size / 2);
tpm_bn_init2(q, key_size / 2);
tpm_bn_init2(n, key_size);
tpm_bn_init2(t1, key_size / 2);
tpm_bn_init2(t2, key_size / 2);
tpm_bn_init2(phi, key_size);
tpm_bn_init2(d, key_size);
tpm_bn_init2(u, key_size / 2);
do {
/* get prime p */
rsa_tpm_bn_random(p, key_size / 2);
tpm_bn_setbit(p, 0);
tpm_bn_setbit(p, key_size / 2 - 1);
tpm_bn_setbit(p, key_size / 2 - 2);
tpm_bn_nextprime(p, p);
tpm_bn_sub_ui(t1, p, 1);
tpm_bn_gcd(phi, e, t1);
if (tpm_bn_cmp_ui(phi, 1) != 0) continue;
/* get prime q */
rsa_tpm_bn_random(q, key_size / 2);
tpm_bn_setbit(q, 0);
tpm_bn_setbit(q, key_size / 2 - 1);
tpm_bn_setbit(q, key_size / 2 - 2);
tpm_bn_nextprime(q, q);
tpm_bn_sub_ui(t2, q, 1);
tpm_bn_gcd(phi, e, t1);
if (tpm_bn_cmp_ui(phi, 1) != 0) continue;
/* p shall be smaller than q */
if (tpm_bn_cmp(p, q) > 0) tpm_bn_swap(p, q);
/* calculate the modulus */
tpm_bn_mul(n, p, q);
} while (tpm_bn_bitsize(n) != key_size);
/* calculate Euler totient: phi = (p-1)(q-1) */
tpm_bn_mul(phi, t1, t2);
/* calculate the secret key d = e^(-1) mod phi */
tpm_bn_invert(d, e, phi);
/* calculate the inverse of p and q (used for chinese remainder theorem) */
tpm_bn_invert(u, p, q);
/* setup private key */
tpm_bn_init_set(key->n, n);
tpm_bn_init_set(key->e, e);
tpm_bn_init_set(key->p, p);
tpm_bn_init_set(key->q, q);
tpm_bn_init_set(key->d, d);
tpm_bn_init_set(key->u, u);
key->size = key_size;
/* release helper variables */
tpm_bn_clear(e);
tpm_bn_clear(p);
tpm_bn_clear(q);
tpm_bn_clear(n);
tpm_bn_clear(t1);
tpm_bn_clear(t2);
tpm_bn_clear(phi);
tpm_bn_clear(d);
tpm_bn_clear(u);
/* test key */
if (rsa_test_key(key) != 0) {
tpm_rsa_release_private_key(key);
return -1;
}
return 0;
}
void tpm_rsa_release_private_key(tpm_rsa_private_key_t *key)
{
tpm_bn_clear(key->n);
tpm_bn_clear(key->e);
tpm_bn_clear(key->p);
tpm_bn_clear(key->q);
tpm_bn_clear(key->d);
tpm_bn_clear(key->u);
memset(key, 0, sizeof(*key));
}
void tpm_rsa_release_public_key(tpm_rsa_public_key_t *key)
{
tpm_bn_clear(key->n);
tpm_bn_clear(key->e);
memset(key, 0, sizeof(*key));
}
void tpm_rsa_export_modulus(tpm_rsa_private_key_t *key,
uint8_t *modulus, size_t *length)
{
tpm_bn_export(modulus, length, 1, key->n);
}
void tpm_rsa_export_exponent(tpm_rsa_private_key_t *key,
uint8_t *exponent, size_t *length)
{
tpm_bn_export(exponent, length, 1, key->e);
}
void tpm_rsa_export_prime1(tpm_rsa_private_key_t *key,
uint8_t *prime, size_t *length)
{
tpm_bn_export(prime, length, 1, key->p);
}
void tpm_rsa_export_prime2(tpm_rsa_private_key_t *key,
uint8_t *prime, size_t *length)
{
tpm_bn_export(prime, length, 1, key->q);
}
void tpm_rsa_export_public_modulus(tpm_rsa_public_key_t *key,
uint8_t *modulus, size_t *length)
{
tpm_bn_export(modulus, length, 1, key->n);
}
void tpm_rsa_export_public_exponent(tpm_rsa_public_key_t *key,
uint8_t *exponent, size_t *length)
{
tpm_bn_export(exponent, length, 1, key->e);
}
size_t tpm_rsa_modulus_length(tpm_rsa_private_key_t *key)
{
return (tpm_bn_bitsize(key->n) + 7) >> 3;
}
size_t tpm_rsa_exponent_length(tpm_rsa_private_key_t *key)
{
return (tpm_bn_bitsize(key->e) + 7) >> 3;
}
size_t tpm_rsa_prime1_length(tpm_rsa_private_key_t *key)
{
return (tpm_bn_bitsize(key->p) + 7) >> 3;
}
size_t tpm_rsa_prime2_length(tpm_rsa_private_key_t *key)
{
return (tpm_bn_bitsize(key->q) + 7) >> 3;
}
size_t tpm_rsa_public_modulus_length(tpm_rsa_public_key_t *key)
{
return (tpm_bn_bitsize(key->n) + 7) >> 3;
}
size_t tpm_rsa_public_exponent_length(tpm_rsa_public_key_t *key)
{
return (tpm_bn_bitsize(key->e) + 7) >> 3;
}
void tpm_rsa_mask_generation(const uint8_t *seed, size_t seed_len,
uint8_t *data, size_t data_len)
{
tpm_sha1_ctx_t ctx;
uint8_t mask[SHA1_DIGEST_LENGTH];
uint32_t i, len, counter = 0;
while (data_len > 0) {
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, seed, seed_len);
tpm_sha1_update_be32(&ctx, counter);
tpm_sha1_final(&ctx, mask);
counter++;
len = (data_len < SHA1_DIGEST_LENGTH) ? data_len : SHA1_DIGEST_LENGTH;
for (i = 0; i < len; i++) *data++ ^= mask[i];
data_len -= len;
}
}
static int encode_message(int type, const uint8_t *data, size_t data_len,
uint8_t *msg, size_t msg_len)
{
size_t i;
tpm_sha1_ctx_t ctx;
/* encode message according to type */
switch (type) {
case RSA_SSA_PKCS1_SHA1:
/* EM = 0x00||0x01||0xff-pad||0x00||SHA-1 DER header||SHA-1 digest */
if (msg_len < 35 + 11) return -1;
msg[0] = 0x00; msg[1] = 0x01;
memset(&msg[2], 0xff, msg_len - 38);
msg[msg_len - 36] = 0x00;
memcpy(&msg[msg_len - 35], "\x30\x21\x30\x09\x06\x05\x2b"
"\x0e\x03\x02\x1a\x05\x00\x04\x14", 15);
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, data, data_len);
tpm_sha1_final(&ctx, &msg[msg_len - 20]);
break;
case RSA_SSA_PKCS1_SHA1_RAW:
/* EM = 0x00||0x01||0xff-pad||0x00||SHA-1 DER header||SHA-1 digest */
if (msg_len < 35 + 11 || data_len != 20) return -1;
msg[0] = 0x00; msg[1] = 0x01;
memset(&msg[2], 0xff, msg_len - 38);
msg[msg_len - 36] = 0x00;
memcpy(&msg[msg_len - 35], "\x30\x21\x30\x09\x06\x05\x2b"
"\x0e\x03\x02\x1a\x05\x00\x04\x14", 15);
memcpy(&msg[msg_len - 20], data, data_len);
break;
case RSA_SSA_PKCS1_DER:
/* EM = 0x00||0x01||0xff-pad||0x00||DER encoded data */
if (msg_len < data_len + 11) return -1;
msg[0] = 0x00; msg[1] = 0x01;
memset(&msg[2], 0xff, msg_len - data_len - 3);
msg[msg_len - data_len - 1] = 0x00;
memcpy(&msg[msg_len - data_len], data, data_len);
break;
case RSA_ES_PKCSV15:
/* EM = 0x00||0x02||nonzero random-pad||0x00||data */
if (msg_len < data_len + 11) return -1;
msg[0] = 0x00; msg[1] = 0x02;
tpm_get_random_bytes(&msg[2], msg_len - data_len - 3);
for (i = 2; i < msg_len - data_len; i++)
while (!msg[i]) tpm_get_random_bytes(&msg[i], 1);
msg[msg_len - data_len - 1] = 0x00;
memcpy(&msg[msg_len - data_len], data, data_len);
break;
case RSA_ES_OAEP_SHA1:
/* DB = SHA-1("TCPA")||0x00-pad||0x01||data
seed = random value of size SHA1_DIGEST_LENGTH
masked-seed = seed xor MFG(seed, seed_len)
masked-DB = DB xor MFG(seed, DB_len)
EM = 0x00||masked-seed||masked-DB */
if (msg_len < data_len + 2 * SHA1_DIGEST_LENGTH + 2) return -1;
msg[0] = 0x00;
tpm_get_random_bytes(&msg[1], SHA1_DIGEST_LENGTH);
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, (uint8_t*)"TCPA", 4);
tpm_sha1_final(&ctx, &msg[1 + SHA1_DIGEST_LENGTH]);
memset(&msg[1 + 2 * SHA1_DIGEST_LENGTH], 0x00,
msg_len - data_len - 2 * SHA1_DIGEST_LENGTH - 2);
msg[msg_len - data_len - 1] = 0x01;
memcpy(&msg[msg_len - data_len], data, data_len);
tpm_rsa_mask_generation(&msg[1], SHA1_DIGEST_LENGTH,
&msg[1 + SHA1_DIGEST_LENGTH], msg_len - SHA1_DIGEST_LENGTH - 1);
tpm_rsa_mask_generation(&msg[1 + SHA1_DIGEST_LENGTH],
msg_len - SHA1_DIGEST_LENGTH - 1, &msg[1], SHA1_DIGEST_LENGTH);
break;
case RSA_ES_PLAIN:
/* EM = data */
if (msg_len != data_len) return -1;
if (msg != data) memcpy(msg, data, data_len);
break;
default:
/* unsupported encoding method */
return -1;
}
return 0;
}
static int decode_message(int type, uint8_t *msg, size_t msg_len,
uint8_t *data, size_t *data_len)
{
size_t i;
tpm_sha1_ctx_t ctx;
/* decode message according to type */
switch (type) {
case RSA_ES_PKCSV15:
/* EM = 0x00||0x02||nonzero random-pad||0x00||data */
if (msg_len < 11) return -1;
if (msg[0] != 0x00 || msg[1] != 0x02) return -1;
for (i = 2; i < msg_len && msg[i]; i++);
if (i < 10 || i >= msg_len) return -1;
*data_len = msg_len - i - 1;
memmove(data, &msg[i + 1], *data_len);
break;
case RSA_ES_OAEP_SHA1:
/* DB = SHA-1("TCPA")||0x00-pad||0x01||data
seed = random value of size SHA1_DIGEST_LENGTH
masked-seed = seed xor MFG(seed, seed_len)
masked-DB = DB xor MFG(seed, DB_len)
EM = 0x00||masked-seed||masked-DB */
if (msg_len < 2 + 2 * SHA1_DIGEST_LENGTH) return -1;
if (msg[0] != 0x00) return -1;
tpm_rsa_mask_generation(&msg[1 + SHA1_DIGEST_LENGTH],
msg_len - SHA1_DIGEST_LENGTH - 1, &msg[1], SHA1_DIGEST_LENGTH);
tpm_rsa_mask_generation(&msg[1], SHA1_DIGEST_LENGTH,
&msg[1 + SHA1_DIGEST_LENGTH], msg_len - SHA1_DIGEST_LENGTH - 1);
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, (uint8_t*)"TCPA", 4);
tpm_sha1_final(&ctx, &msg[1]);
if (memcmp(&msg[1], &msg[1 + SHA1_DIGEST_LENGTH],
SHA1_DIGEST_LENGTH) != 0) return -1;
for (i = 1 + 2 * SHA1_DIGEST_LENGTH; i < msg_len && !msg[i]; i++);
if (i >= msg_len || msg[i] != 0x01) return -1;
*data_len = msg_len - i - 1;
memmove(data, &msg[i + 1], *data_len);
break;
case RSA_ES_PLAIN:
/* EM = data */
*data_len = msg_len;
if (msg != data) memcpy(msg, data, msg_len);
break;
default:
/* unsupported encoding method */
return -1;
}
return 0;
}
int tpm_rsa_sign(tpm_rsa_private_key_t *key, int type,
const uint8_t *data, size_t data_len, uint8_t *sig)
{
size_t sig_len = key->size >> 3;
/* encode message */
if (encode_message(type, data, data_len, sig, sig_len) != 0) return -1;
/* sign encoded message */
if (rsa_private(key, sig, sig_len, sig) != 0) return -1;
return 0;
}
int tpm_rsa_verify(tpm_rsa_public_key_t *key, int type,
const uint8_t *data, size_t data_len, uint8_t *sig)
{
size_t sig_len = key->size >> 3;
uint8_t msg_a[sig_len];
uint8_t msg_b[sig_len];
/* encode message */
if (encode_message(type, data, data_len, msg_a, sig_len) != 0) return -1;
/* decrypt signature */
if (rsa_public(key, sig, sig_len, msg_b) != 0) return -1;
/* compare messages */
return (memcmp(msg_a, msg_b, sig_len) == 0) ? 0 : 1;
}
int tpm_rsa_decrypt(tpm_rsa_private_key_t *key, int type,
const uint8_t *in, size_t in_len,
uint8_t *out, size_t *out_len)
{
*out_len = key->size >> 3;
if (in_len != *out_len || in_len < 11) return -1;
/* decrypt message */
if (rsa_private(key, in, in_len, out) != 0) return -1;
/* decode message */
if (decode_message(type, out, *out_len, out, out_len) != 0) return -1;
return 0;
}
int tpm_rsa_encrypt(tpm_rsa_public_key_t *key, int type,
const uint8_t *in, size_t in_len,
uint8_t *out, size_t *out_len)
{
*out_len = key->size >> 3;
/* encode message */
if (encode_message(type, in, in_len, out, *out_len) != 0) return -1;
/* encrypt encoded message */
if (rsa_public(key, out, *out_len, out) != 0) return -1;
return 0;
}
================================================
FILE: crypto/rsa.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: rsa.h 364 2010-02-11 10:24:45Z mast $
*/
#ifndef _RSA_H_
#define _RSA_H_
#include <stddef.h>
#include <stdint.h>
#include "bn.h"
typedef struct {
tpm_bn_t n;
tpm_bn_t e;
tpm_bn_t d;
tpm_bn_t p;
tpm_bn_t q;
tpm_bn_t u;
uint16_t size;
} tpm_rsa_private_key_t;
typedef struct {
tpm_bn_t n;
tpm_bn_t e;
uint16_t size;
} tpm_rsa_public_key_t;
enum {
RSA_ES_PKCSV15,
RSA_ES_OAEP_SHA1,
RSA_ES_PLAIN,
RSA_SSA_PKCS1_SHA1,
RSA_SSA_PKCS1_SHA1_RAW,
RSA_SSA_PKCS1_DER
};
enum {
RSA_LSB_FIRST = -1, RSA_MSB_FIRST = 1
};
#define TPM_RSA_EXTRACT_PUBLIC_KEY(priv_key, pub_key) { \
tpm_bn_init_set(pub_key.n, priv_key.n); \
tpm_bn_init_set(pub_key.e, priv_key.e); \
pub_key.size = priv_key.size; }
int tpm_rsa_import_key(tpm_rsa_private_key_t *key, int endian,
const uint8_t *n, size_t n_len,
const uint8_t *e, size_t e_len,
const uint8_t *p, const uint8_t *q);
void tpm_rsa_copy_key(tpm_rsa_private_key_t *dst, tpm_rsa_private_key_t *src);
int tpm_rsa_import_public_key(tpm_rsa_public_key_t *key, int endian,
const uint8_t *n, size_t n_len,
const uint8_t *e, size_t e_len);
int tpm_rsa_generate_key(tpm_rsa_private_key_t *key, uint16_t key_size);
void tpm_rsa_release_private_key(tpm_rsa_private_key_t *key);
void tpm_rsa_release_public_key(tpm_rsa_public_key_t *key);
void tpm_rsa_export_modulus(tpm_rsa_private_key_t *key,
uint8_t *modulus, size_t *length);
void tpm_rsa_export_exponent(tpm_rsa_private_key_t *key,
uint8_t *exponent, size_t *length);
void tpm_rsa_export_prime1(tpm_rsa_private_key_t *key,
uint8_t *prime, size_t *length);
void tpm_rsa_export_prime2(tpm_rsa_private_key_t *key,
uint8_t *prime, size_t *length);
size_t tpm_rsa_modulus_length(tpm_rsa_private_key_t *key);
size_t tpm_rsa_exponent_length(tpm_rsa_private_key_t *key);
size_t tpm_rsa_prime1_length(tpm_rsa_private_key_t *key);
size_t tpm_rsa_prime2_length(tpm_rsa_private_key_t *key);
void tpm_rsa_mask_generation(const uint8_t *seed, size_t seed_len,
uint8_t *data, size_t data_len);
void tpm_rsa_export_public_modulus(tpm_rsa_public_key_t *key,
uint8_t *modulus, size_t *length);
void tpm_rsa_export_public_exponent(tpm_rsa_public_key_t *key,
uint8_t *exponent, size_t *length);
size_t tpm_rsa_public_modulus_length(tpm_rsa_public_key_t *key);
size_t tpm_rsa_public_exponent_length(tpm_rsa_public_key_t *key);
/* Note: Input and output areas MUST NOT overlap (i.e., one can't
use the same buffer for data and sig or in and out). */
int tpm_rsa_sign(tpm_rsa_private_key_t *key, int type,
const uint8_t *data, size_t data_len, uint8_t *sig);
int tpm_rsa_verify(tpm_rsa_public_key_t *key, int type,
const uint8_t *data, size_t data_len, uint8_t *sig);
int tpm_rsa_decrypt(tpm_rsa_private_key_t *key, int type,
const uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len);
int tpm_rsa_encrypt(tpm_rsa_public_key_t *key, int type,
const uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len);
#endif /* _RSA_H_ */
================================================
FILE: crypto/sha1.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: sha1.c 364 2010-02-11 10:24:45Z mast $
*/
#include "sha1.h"
#include <string.h>
/* This code is based on Steve Reid's <steve@edmweb.com>
public domain implementation. */
#define rol(v,b) (((v) << (b)) | ((v) >> (32 - (b))))
#ifdef __BIG_ENDIAN__
#define B0(i) (buf[i] = buf[i])
#else
#define B0(i) (buf[i] = (((buf[i] & 0xff000000) >> 24) \
| ((buf[i] & 0x00ff0000) >> 8) \
| ((buf[i] & 0x0000ff00) << 8) \
| ((buf[i] & 0x000000ff) << 24)))
#endif
#define B1(i) (buf[i & 15] = rol(buf[i & 15] ^ buf[(i-14) & 15] \
^ buf[(i-8) & 15] ^ buf[(i-3) & 15], 1))
#define F0(x,y,z) ((x & (y ^ z)) ^ z)
#define F1(x,y,z) (x ^ y ^ z)
#define F2(x,y,z) (((x | y) & z) | (x & y))
#define R0(a,b,c,d,e,i) e += F0(b,c,d) + B0(i) + 0x5A827999 + rol(a,5); b = rol(b,30);
#define R1(a,b,c,d,e,i) e += F0(b,c,d) + B1(i) + 0x5A827999 + rol(a,5); b = rol(b,30);
#define R2(a,b,c,d,e,i) e += F1(b,c,d) + B1(i) + 0x6ED9EBA1 + rol(a,5); b = rol(b,30);
#define R3(a,b,c,d,e,i) e += F2(b,c,d) + B1(i) + 0x8F1BBCDC + rol(a,5); b = rol(b,30);
#define R4(a,b,c,d,e,i) e += F1(b,c,d) + B1(i) + 0xCA62C1D6 + rol(a,5); b = rol(b,30);
static void tpm_sha1_transform(uint32_t h[5], const uint8_t data[64])
{
uint32_t a, b, c, d, e;
uint32_t buf[16];
/* copy state and data*/
a = h[0];
b = h[1];
c = h[2];
d = h[3];
e = h[4];
memcpy(buf, data, 64);
/* unrolled sha-1 rounds */
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
/* update state */
h[0] += a;
h[1] += b;
h[2] += c;
h[3] += d;
h[4] += e;
/* overwrite all used variables */
a = b = c = d = e = 0;
memset(buf, 0, 64);
}
void tpm_sha1_init(tpm_sha1_ctx_t *ctx)
{
/* initialise with sha-1 constants */
ctx->h[0] = 0x67452301;
ctx->h[1] = 0xEFCDAB89;
ctx->h[2] = 0x98BADCFE;
ctx->h[3] = 0x10325476;
ctx->h[4] = 0xC3D2E1F0;
ctx->count_lo = ctx->count_hi = 0;
}
void tpm_sha1_update(tpm_sha1_ctx_t *ctx, const uint8_t *data, size_t length)
{
size_t buf_off = (ctx->count_lo >> 3) & 63;
size_t data_off = 0;
/* add data */
if (length + buf_off >= 64) {
data_off = 64 - buf_off;
memcpy(&ctx->buf[buf_off], data, data_off);
tpm_sha1_transform(ctx->h, ctx->buf);
while (data_off + 64 <= length) {
tpm_sha1_transform(ctx->h, &data[data_off]);
data_off += 64;
}
buf_off = 0;
}
memcpy(&ctx->buf[buf_off], &data[data_off], length - data_off);
/* update counter */
buf_off = ctx->count_lo;
ctx->count_lo += length << 3;
if (ctx->count_lo < buf_off) ctx->count_hi++;
ctx->count_hi += length >> 29;
}
void tpm_sha1_update_be32(tpm_sha1_ctx_t *ctx, uint32_t data)
{
uint8_t buf[4];
buf[0] = (data >> 24) & 0xff;
buf[1] = (data >> 16) & 0xff;
buf[2] = (data >> 8) & 0xff;
buf[3] = (data >> 0) & 0xff;
tpm_sha1_update(ctx, buf, 4);
}
void tpm_sha1_final(tpm_sha1_ctx_t *ctx, uint8_t digest[SHA1_DIGEST_LENGTH])
{
uint8_t d, counter[8];
/* setup counter */
for (d = 0; d < 4; d++) {
counter[d ] = (ctx->count_hi >> (24 - d * 8)) & 0xff;
counter[d + 4] = (ctx->count_lo >> (24 - d * 8)) & 0xff;
}
/* add padding */
d = 0x80;
tpm_sha1_update(ctx, &d, 1);
d = 0x00;
while ((ctx->count_lo & (63 * 8)) != (56 * 8)) tpm_sha1_update(ctx, &d, 1);
/* add counter */
tpm_sha1_update(ctx, counter, 8);
for (d = 0; d < SHA1_DIGEST_LENGTH; d++)
digest[d] = (uint8_t)(ctx->h[d >> 2] >> (8 * (3 - (d & 3))) & 0xff);
/* overwrite all used variables */
memset(ctx, 0, sizeof(*ctx));
memset(counter, 0, sizeof(counter));
}
================================================
FILE: crypto/sha1.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: sha1.h 364 2010-02-11 10:24:45Z mast $
*/
#ifndef _SHA1_H_
#define _SHA1_H_
#include <stddef.h>
#include <stdint.h>
#define SHA1_DIGEST_LENGTH 20
typedef struct {
uint32_t h[5];
uint32_t count_lo, count_hi;
uint8_t buf[64];
} tpm_sha1_ctx_t;
void tpm_sha1_init(tpm_sha1_ctx_t *ctx);
void tpm_sha1_update(tpm_sha1_ctx_t *ctx, const uint8_t *data, size_t length);
void tpm_sha1_update_be32(tpm_sha1_ctx_t *ctx, uint32_t data);
void tpm_sha1_final(tpm_sha1_ctx_t *ctx, uint8_t digest[SHA1_DIGEST_LENGTH]);
#endif /* _SHA1_H_ */
================================================
FILE: mtm/CMakeLists.txt
================================================
# Software-based Trusted Platform Module (TPM) Emulator
# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
#
# $Id: CMakeLists.txt 376 2010-02-16 14:51:42Z mast $
add_definitions(-DMTM_EMULATOR)
file(GLOB tpm_SRCS ../tpm/tpm_cmd_handler.c ../tpm/tpm_data.c)
file(GLOB mtm_SRCS "*.[h|c]")
add_library(mtm STATIC ${mtm_SRCS} ${tpm_SRCS})
================================================
FILE: mtm/mtm_capability.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_structures.h"
#include "mtm_marshalling.h"
#include "mtm_data.h"
#include "tpm/tpm_data.h"
#include "tpm/tpm_commands.h"
static inline TPM_RESULT return_UINT32(UINT32 *respSize, BYTE **resp, UINT32 value)
{
UINT32 len = *respSize = 4;
BYTE *ptr = *resp = tpm_malloc(*respSize);
if (ptr == NULL || tpm_marshal_UINT32(&ptr, &len, value)) {
tpm_free(*resp);
return TPM_FAIL;
}
return TPM_SUCCESS;
}
static inline TPM_RESULT return_BOOL(UINT32 *respSize, BYTE **resp, BOOL value)
{
UINT32 len = *respSize = 1;
BYTE *ptr = *resp = tpm_malloc(*respSize);
if (ptr == NULL || tpm_marshal_BOOL(&ptr, &len, value)) {
tpm_free(*resp);
return TPM_FAIL;
}
return TPM_SUCCESS;
}
#define return_BYTE return_BOOL
static TPM_RESULT cap_ord(UINT32 subCapSize, BYTE *subCap,
UINT32 *respSize, BYTE **resp)
{
TPM_COMMAND_CODE ord;
if (tpm_unmarshal_TPM_COMMAND_CODE(&subCap, &subCapSize, &ord))
return TPM_BAD_MODE;
switch (ord) {
case MTM_ORD_InstallRIM:
case MTM_ORD_LoadVerificationKey:
case MTM_ORD_LoadVerificationRootKeyDisable:
case MTM_ORD_VerifyRIMCert:
case MTM_ORD_VerifyRIMCertAndExtend:
case MTM_ORD_IncrementBootstrapCounter:
case MTM_ORD_SetVerifiedPCRSelection:
return return_BOOL(respSize, resp, TRUE);
default:
return return_BOOL(respSize, resp, FALSE);
}
}
static TPM_RESULT cap_mtm_permanent_data(UINT32 subCapSize, BYTE *subCap,
UINT32 *respSize, BYTE **resp)
{
UINT32 subCapVal, len;
BYTE* ptr;
/* unmarshal subCap */
if (tpm_unmarshal_UINT32(&subCap, &subCapSize, &subCapVal) != 0)
return TPM_BAD_PARAMETER;
switch (subCapVal) {
case 1:
return TPM_FAIL;
break;
case 2:
*respSize = len = sizeof_TPM_PCR_SELECTION(mtmData.permanent.data.verifiedPCRs);
*resp = ptr = tpm_malloc(*respSize);
if (*resp == NULL
|| tpm_marshal_TPM_PCR_SELECTION(&ptr, &len, &mtmData.permanent.data.verifiedPCRs)) {
tpm_free(*resp);
return TPM_FAIL;
}
error("[TPM_CAP_MTM_PERMANENT_DATA] SubCap 2 not Implemented");
return TPM_FAIL; // TODO not implemented.
case 3:
return return_UINT32(respSize, resp,
tpmData.permanent.data.counters[MTM_COUNTER_SELECT_BOOTSTRAP].counter);
case 4:
return return_UINT32(respSize, resp, mtmData.permanent.data.counterRimProtectId);
case 5:
return return_UINT32(respSize, resp, mtmData.permanent.data.counterStorageProtectId);
case 6:
return return_BYTE(respSize, resp, mtmData.permanent.data.specMajor);
case 7:
return return_BYTE(respSize, resp, mtmData.permanent.data.specMinor);
case 8:
return return_BYTE(respSize, resp, mtmData.permanent.data.loadVerificationKeyMethods);
default:
return TPM_BAD_PARAMETER;
}
return TPM_SUCCESS;
}
TPM_RESULT MTM_GetCapability(TPM_CAPABILITY_AREA capArea, UINT32 subCapSize,
BYTE *subCap, UINT32 *respSize, BYTE **resp)
{
info("MTM_GetCapability()");
switch (capArea) {
case TPM_CAP_ORD:
debug("[MTM_CAP_ORD]");
TPM_RESULT res = cap_ord(subCapSize, subCap, respSize, resp);
if (res == TPM_SUCCESS && resp[0] == FALSE) {
res = TPM_GetCapability(capArea, subCapSize, subCap, respSize, resp);
}
return res;
case TPM_CAP_MTM_PERMANENT_DATA:
debug("[TPM_CAP_MTM_PERMANENT_DATA]");
return cap_mtm_permanent_data(subCapSize, subCap, respSize, resp);
default:
return TPM_GetCapability(capArea, subCapSize, subCap, respSize, resp);
}
}
================================================
FILE: mtm/mtm_cmd_handler.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
* Copyright (C) 2007 Jan-Erik Ekberg <jan-erik.ekberg@nokia.com>,
* Nokia Corporation and/or its subsidiary(-ies)
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_commands.h"
#include "mtm_marshalling.h"
extern void tpm_compute_in_param_digest(TPM_REQUEST *req);
static TPM_RESULT execute_MTM_InstallRIM(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
BYTE *ptr;
UINT32 len;
UINT32 rimCertSize;
TPM_RIM_CERTIFICATE rimCertIn;
TPM_RIM_CERTIFICATE rimCertOut;
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* unmarshal input */
ptr = req->param;
len = req->paramSize;
if (tpm_unmarshal_UINT32(&ptr, &len, &rimCertSize)
|| tpm_unmarshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCertIn)
|| len != 0) return TPM_BAD_PARAMETER;
/* execute command */
res = MTM_InstallRIM(&rimCertIn, &req->auth1, &rimCertOut);
if (res != TPM_SUCCESS) return res;
/* marshal output */
rsp->paramSize = len = 4 + sizeof_TPM_RIM_CERTIFICATE(rimCertOut);
rsp->param = ptr = tpm_malloc(len);
if (ptr == NULL
|| tpm_marshal_UINT32(&ptr, &len, sizeof_TPM_RIM_CERTIFICATE(rimCertOut))
|| tpm_marshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCertOut)) {
tpm_free(rsp->param);
res = TPM_FAIL;
}
free_TPM_RIM_CERTIFICATE(rimCertOut);
return res;
}
static TPM_RESULT execute_MTM_LoadVerificationKey(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
BYTE *ptr;
UINT32 len;
TPM_VERIFICATION_KEY_HANDLE parentKey;
UINT32 verificationKeySize;
TPM_VERIFICATION_KEY verificationKey;
TPM_VERIFICATION_KEY_HANDLE verificationKeyHandle;
BYTE loadMethod;
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* unmarshal input */
ptr = req->param;
len = req->paramSize;
if (tpm_unmarshal_TPM_VERIFICATION_KEY_HANDLE(&ptr, &len, &parentKey)
|| tpm_unmarshal_UINT32(&ptr, &len, &verificationKeySize)
|| tpm_unmarshal_TPM_VERIFICATION_KEY(&ptr, &len, &verificationKey)
|| len != 0) return TPM_BAD_PARAMETER;
/* execute command */
res = MTM_LoadVerificationKey(parentKey, &verificationKey, &req->auth1,
&verificationKeyHandle, &loadMethod);
if (res != TPM_SUCCESS) return res;
/* marshal output */
rsp->paramSize = len = 4 + 1;
rsp->param = ptr = tpm_malloc(len);
if (ptr == NULL
|| tpm_marshal_TPM_VERIFICATION_KEY_HANDLE(&ptr, &len, verificationKeyHandle)
|| tpm_marshal_BYTE(&ptr, &len, loadMethod)) {
tpm_free(rsp->param);
res = TPM_FAIL;
}
return res;
}
static TPM_RESULT execute_MTM_LoadVerificationRootKeyDisable(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* execute command */
res = MTM_LoadVerificationRootKeyDisable();
/* marshal output */
rsp->paramSize = 0;
rsp->param = NULL;
return res;
}
static TPM_RESULT execute_MTM_VerifyRIMCert(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
BYTE *ptr;
UINT32 len;
UINT32 rimCertSize;
TPM_RIM_CERTIFICATE rimCert;
TPM_VERIFICATION_KEY_HANDLE rimKey;
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* unmarshal input */
ptr = req->param;
len = req->paramSize;
if (tpm_unmarshal_UINT32(&ptr, &len, &rimCertSize)
|| tpm_unmarshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCert)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_HANDLE(&ptr, &len, &rimKey)
|| len != 0) return TPM_BAD_PARAMETER;
/* execute command */
res = MTM_VerifyRIMCert(&rimCert, rimKey);
/* marshal output */
rsp->paramSize = len = 0;
rsp->param = ptr = NULL;
return res;
}
static TPM_RESULT execute_MTM_VerifyRIMCertAndExtend(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
BYTE *ptr;
UINT32 len;
UINT32 rimCertSize;
TPM_RIM_CERTIFICATE rimCert;
TPM_VERIFICATION_KEY_HANDLE rimKey;
TPM_PCRVALUE outDigest;
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* unmarshal input */
ptr = req->param;
len = req->paramSize;
if (tpm_unmarshal_UINT32(&ptr, &len, &rimCertSize)
|| tpm_unmarshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCert)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_HANDLE(&ptr, &len, &rimKey)
|| len != 0) return TPM_BAD_PARAMETER;
/* execute command */
res = MTM_VerifyRIMCertAndExtend(&rimCert, rimKey, &outDigest);
/* marshal output */
rsp->paramSize = len = 20;
rsp->param = ptr = tpm_malloc(len);
if (ptr == NULL
|| tpm_marshal_TPM_PCRVALUE(&ptr, &len, &outDigest)) {
tpm_free(rsp->param);
res = TPM_FAIL;
}
return res;
}
static TPM_RESULT execute_MTM_IncrementBootstrapCounter(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
BYTE *ptr;
UINT32 len;
UINT32 rimCertSize;
TPM_RIM_CERTIFICATE rimCert;
TPM_VERIFICATION_KEY_HANDLE rimKey;
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* unmarshal input */
ptr = req->param;
len = req->paramSize;
if (tpm_unmarshal_UINT32(&ptr, &len, &rimCertSize)
|| tpm_unmarshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCert)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_HANDLE(&ptr, &len, &rimKey)
|| len != 0) return TPM_BAD_PARAMETER;
/* execute command */
res = MTM_IncrementBootstrapCounter(&rimCert, rimKey);
/* marshal output */
rsp->paramSize = len = 0;
rsp->param = ptr = NULL;
return res;
}
static TPM_RESULT execute_MTM_SetVerifiedPCRSelection(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
BYTE *ptr;
UINT32 len;
TPM_PCR_SELECTION verifiedSelection;
TPM_RESULT res;
/* compute parameter digest */
tpm_compute_in_param_digest(req);
/* unmarshal input */
ptr = req->param;
len = req->paramSize;
if (tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &verifiedSelection)
|| len != 0) return TPM_BAD_PARAMETER;
/* execute command */
res = MTM_SetVerifiedPCRSelection(&verifiedSelection, &req->auth1);
/* marshal output */
rsp->paramSize = len = 0;
rsp->param = ptr = NULL;
return res;
}
TPM_RESULT mtm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
TPM_RESULT res;
/* handle command ordinal */
switch (req->ordinal) {
case MTM_ORD_InstallRIM:
debug("[MTM_ORD_InstallRIM]");
res = execute_MTM_InstallRIM(req, rsp);
break;
case MTM_ORD_LoadVerificationKey:
debug("[MTM_ORD_LoadVerificationKey]");
res = execute_MTM_LoadVerificationKey(req, rsp);
break;
case MTM_ORD_LoadVerificationRootKeyDisable:
debug("[MTM_ORD_LoadVerificationRootKeyDisable]");
res = execute_MTM_LoadVerificationRootKeyDisable(req, rsp);
break;
case MTM_ORD_VerifyRIMCert:
debug("[MTM_ORD_VerifyRIMCert]");
res = execute_MTM_VerifyRIMCert(req, rsp);
break;
case MTM_ORD_VerifyRIMCertAndExtend:
debug("[MTM_ORD_VerifyRIMCertAndExtend]");
res = execute_MTM_VerifyRIMCertAndExtend(req, rsp);
break;
case MTM_ORD_IncrementBootstrapCounter:
debug("[MTM_ORD_IncrementBootstrapCounter]");
res = execute_MTM_IncrementBootstrapCounter(req, rsp);
break;
case MTM_ORD_SetVerifiedPCRSelection:
debug("[MTM_ORD_SetVerifiedPCRSelection]");
res = execute_MTM_SetVerifiedPCRSelection(req, rsp);
break;
default:
res = TPM_BAD_ORDINAL;
break;
}
return res;
}
================================================
FILE: mtm/mtm_commands.h
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
* Copyright (C) 2007 Jan-Erik Ekberg <jan-erik.ekberg@nokia.com>,
* Nokia Corporation and/or its subsidiary(-ies)
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#ifndef _MTM_COMMANDS_H_
#define _MTM_COMMANDS_H_
#include "mtm_structures.h"
/*
* Modified TPM commands
*/
/**
* MTM_Extend - adds a new measurement to a PCR
* @pcrNum: [in] The PCR to be updated
* @inDigest: [in] The 160 bit value representing the event to be recorded
* @outDigest: [out] The PCR value after execution of the command
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*/
TPM_RESULT MTM_Extend(
TPM_PCRINDEX pcrNum,
TPM_DIGEST *inDigest,
TPM_PCRVALUE *outDigest
);
/**
* MTM_PCR_Reset - resets the indicated PCRs
* @pcrSelection: [in] The PCRs to reset
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*/
TPM_RESULT MTM_PCR_Reset(
TPM_PCR_SELECTION *pcrSelection
);
/**
* MTM_GetCapability - provides current information regarding the TPM
* @capArea: [in] Partition of capabilities to be interrogated
* @subCapSize: [in] Size of subCap parameter
* @subCap: [in] Further definition of information
* @respSize: [out] The length of the returned capability response
* @resp: [out] The capability response
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*/
TPM_RESULT MTM_GetCapability(
TPM_CAPABILITY_AREA capArea,
UINT32 subCapSize,
BYTE *subCap,
UINT32 *respSize,
BYTE **resp
);
/**
* MTM_ReleaseCounter - releases a counter
* @countID: [in] ID value of the counter
* @auth1: [in, out] Authorization protocol parameters
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*/
TPM_RESULT MTM_ReleaseCounter(
TPM_COUNT_ID countID,
TPM_AUTH *auth1
);
/**
* MTM_ReleaseCounterOwner - releases a counter
* @countID: [in] ID value of the counter
* @auth1: [in, out] Authorization protocol parameters
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*/
TPM_RESULT MTM_ReleaseCounterOwner(
TPM_COUNT_ID countID,
TPM_AUTH *auth1
);
/**
* MTM_FlushSpecific - flushes a specific handle
* @handle: [in] Handle of the item to flush
* @resourceType: [in] The type of resource that is being flushed
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*/
TPM_RESULT MTM_FlushSpecific(
TPM_HANDLE handle,
TPM_RESOURCE_TYPE resourceType
);
/*
* Additional, MTM specific commands
*/
/**
* MTM_InstallRIM - generates internal RIM certificates.
* @rimCertIn: [in] Data to be used for internal RIM certificate
* @auth1: [in, out] Authorization protocol parameters
* @rimCertOut: [out] An internal RIM certificate
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*
* Description: ([MTM_spec, v1.0], Section 7.2)
*/
TPM_RESULT MTM_InstallRIM(
TPM_RIM_CERTIFICATE *rimCertIn,
TPM_AUTH *auth1,
TPM_RIM_CERTIFICATE *rimCertOut
);
/**
* MTM_LoadVerificationKey - load one Verification Key into the MTM
* @parentKey: [in] Parent key used to verify this key
* @auth1: [in, out] Authorization protocol parameters
* @verificationKeyHandle: [out] Handle for the key that was loaded
* @loadMethod: [out] which method was used to load this verification key
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*
* Description: ([MTM_spec, v1.0], Section 7.3)
*/
TPM_RESULT MTM_LoadVerificationKey(
TPM_VERIFICATION_KEY_HANDLE parentKey,
TPM_VERIFICATION_KEY *verificationKey,
TPM_AUTH *auth1,
TPM_VERIFICATION_KEY_HANDLE *verificationKeyHandle,
BYTE *loadMethod
);
/**
* MTM_LoadVerificationRootKeyDisable - disables the functionality to load Verification Root Keys.
* Returns: TPM_SUCCESS
*
* Description: ([MTM_spec, v1.0], Section 7.4)
*/
TPM_RESULT MTM_LoadVerificationRootKeyDisable();
/**
* MTM_VerifyRIMCert - verify an internal or external RIM certificate.
* @rimCert: [in] RIM certificate to be validated
* @rimKey: [in] Key handle for the verification. NULL if internal verification key is used.
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*
* Description: ([MTM_spec, v1.0], Section 7.5)
*/
TPM_RESULT MTM_VerifyRIMCert(
TPM_RIM_CERTIFICATE* rimCert,
TPM_VERIFICATION_KEY_HANDLE rimKey
);
/**
* MTM_VerifyRIMCertAndExtend - verify an internal or external RIM certificate and extend PCR given in RIM certificate.
* @rimCert: [in] RIM certificate to be validated
* @rimKey: [in] Key handle for the verification key. NULL if internal verification key is used.
* @outDigest: [out] The PCR value after the execution of the command
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*
* Description: ([MTM_spec, v1.0], Section 7.6)
*/
TPM_RESULT MTM_VerifyRIMCertAndExtend(
TPM_RIM_CERTIFICATE *rimCert,
TPM_VERIFICATION_KEY_HANDLE rimKey,
TPM_PCRVALUE *outDigest
);
/**
* MTM_IncrementBootstrapCounter - increment bootstrap counter in MTM permanent data.
* @rimCert: [in] A RIM certificate
* @rimKey: [in] Key handle for the verification key to be used
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*
* Description: ([MTM_spec, v1.0], Section 7.7)
*/
TPM_RESULT MTM_IncrementBootstrapCounter(
TPM_RIM_CERTIFICATE *rimCert,
TPM_VERIFICATION_KEY_HANDLE rimKey
);
/**
* MTM_SetVerifiedPCRSelection - Set verifiedPCRs field in MTM_PERMANENT_DATA
* @verifiedSelection: [in] Set of PCRs that can only be extended with this function
* @auth1: [in, out] Authorization protocol parameters
* Returns: TPM_SUCCESS on success, a TPM error code otherwise.
*
* Description: ([MTM_spec, v1.0], Section 7.8)
*/
TPM_RESULT MTM_SetVerifiedPCRSelection(
TPM_PCR_SELECTION *verifiedSelection,
TPM_AUTH *auth1
);
TPM_RESULT mtm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp);
#endif /* _MTM_COMMANDS_H_ */
================================================
FILE: mtm/mtm_counter.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_commands.h"
#include "tpm/tpm_handles.h"
#include "tpm/tpm_commands.h"
TPM_RESULT MTM_ReleaseCounter(TPM_COUNT_ID countID, TPM_AUTH *auth1)
{
int i = HANDLE_TO_INDEX(countID);
info("MTM_ReleaseCounter()");
if (i == MTM_COUNTER_SELECT_BOOTSTRAP
|| i == MTM_COUNTER_SELECT_RIMPROTECT
|| i == MTM_COUNTER_SELECT_STORAGEPROTECT) {
debug("MTM counters cannot be released");
return TPM_FAIL;
}
return TPM_ReleaseCounter(countID, auth1);
}
TPM_RESULT MTM_ReleaseCounterOwner(TPM_COUNT_ID countID, TPM_AUTH *auth1)
{
int i = HANDLE_TO_INDEX(countID);
info("MTM_ReleaseCounterOwner()");
if (i == MTM_COUNTER_SELECT_BOOTSTRAP
|| i == MTM_COUNTER_SELECT_RIMPROTECT
|| i == MTM_COUNTER_SELECT_STORAGEPROTECT) {
debug("MTM counters cannot be released");
return TPM_FAIL;
}
return TPM_ReleaseCounterOwner(countID, auth1);
}
================================================
FILE: mtm/mtm_data.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_data.h"
#include "tpm/tpm_data.h"
MTM_DATA mtmData;
static void set_counter(unsigned int num, const char *label)
{
TPM_COUNTER_VALUE *counter = &tpmData.permanent.data.counters[num];
counter->valid = TRUE;
counter->tag = TPM_TAG_COUNTER_VALUE;
memcpy(counter->label, label, sizeof(counter->label));
counter->counter = 1;
memset(counter->usageAuth, 0, sizeof(TPM_SECRET));
}
void mtm_init_data(void)
{
int i;
info("initializing MTM data to default values");
/* reset all data to NULL, FALSE or 0 */
memset(&mtmData, 0, sizeof(mtmData));
mtmData.permanent.data.tag = MTM_TAG_PERMANENT_DATA;
/* set specification version */
mtmData.permanent.data.specMajor = 0x01;
mtmData.permanent.data.specMinor = 0x00;
/* define verified PCRs */
mtmData.permanent.data.verifiedPCRs.sizeOfSelect = TPM_NUM_PCR / 8;
for (i = 0; i < TPM_NUM_PCR / 8; i++) {
mtmData.permanent.data.verifiedPCRs.pcrSelect[i] = 0x00;
}
/* map MTM counters to TPM counters */
set_counter(MTM_COUNTER_SELECT_BOOTSTRAP, "MTM1");
set_counter(MTM_COUNTER_SELECT_RIMPROTECT, "MTM2");
set_counter(MTM_COUNTER_SELECT_STORAGEPROTECT, "MTM3");
/* the field integrityCheckRootData is filled when the first verification key is loaded */
memset(mtmData.permanent.data.integrityCheckRootData, 0xff,
sizeof(mtmData.permanent.data.integrityCheckRootData));
/* set internal verification key */
memcpy(mtmData.permanent.data.internalVerificationKey,
"\x77\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x77", sizeof(TPM_SECRET));
/* init flags */
mtmData.stany.flags.tag = MTM_TAG_STANY_FLAGS;
mtmData.stany.flags.loadVerificationRootKeyEnabled = TRUE;
}
================================================
FILE: mtm/mtm_data.h
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#ifndef _MTM_DATA_H_
#define _MTM_DATA_H_
#include "mtm_structures.h"
extern MTM_DATA mtmData;
void mtm_init_data(void);
#endif /* _MTM_DATA_H_ */
================================================
FILE: mtm/mtm_eviction.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_commands.h"
#include "mtm_handles.h"
#include "tpm/tpm_commands.h"
TPM_RESULT MTM_FlushSpecific(TPM_HANDLE handle,
TPM_RESOURCE_TYPE resourceType)
{
MTM_KEY_DATA *key;
info("MTM_FlushSpecific()");
debug("handle = %08x, resourceType = %08x", handle, resourceType);
if (resourceType == TPM_RT_KEY) {
key = mtm_get_key(handle);
if (key != NULL) {
free_MTM_KEY_DATA((*key));
memset(key, 0, sizeof(*key));
tpm_invalidate_sessions(handle);
return TPM_SUCCESS;
}
}
return TPM_FlushSpecific(handle, resourceType);
}
================================================
FILE: mtm/mtm_handles.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_handles.h"
#include "mtm_data.h"
MTM_KEY_DATA *mtm_get_key_slot(TPM_VERIFICATION_KEY_HANDLE handle)
{
if (handle == TPM_INVALID_HANDLE) return NULL;
handle &= 0x00ffffff;
if (handle < TPM_MAX_KEYS) return NULL;
handle -= TPM_MAX_KEYS;
if (handle >= MTM_MAX_KEYS) return NULL;
return &mtmData.permanent.data.keys[handle];
}
MTM_KEY_DATA *mtm_get_key(TPM_VERIFICATION_KEY_HANDLE handle)
{
if (handle == TPM_INVALID_HANDLE
|| (handle >> 24) != TPM_RT_KEY) return NULL;
handle &= 0x00ffffff;
if (handle < TPM_MAX_KEYS) return NULL;
handle -= TPM_MAX_KEYS;
if (handle >= MTM_MAX_KEYS
|| !mtmData.permanent.data.keys[handle].valid) return NULL;
return &mtmData.permanent.data.keys[handle];
}
MTM_KEY_DATA *mtm_get_key_by_id(TPM_VERIFICATION_KEY_ID id)
{
int i;
for (i = 0; i < MTM_MAX_KEYS; i++) {
if (mtmData.permanent.data.keys[i].valid
&& mtmData.permanent.data.keys[i].myId == id)
return &mtmData.permanent.data.keys[i];
}
return NULL;
}
================================================
FILE: mtm/mtm_handles.h
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_structures.h"
#include "tpm/tpm_handles.h"
MTM_KEY_DATA *mtm_get_key_slot(TPM_VERIFICATION_KEY_HANDLE handle);
MTM_KEY_DATA *mtm_get_key(TPM_VERIFICATION_KEY_HANDLE handle);
MTM_KEY_DATA *mtm_get_key_by_id(TPM_VERIFICATION_KEY_ID id);
================================================
FILE: mtm/mtm_integrity.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_structures.h"
#include "mtm_data.h"
#include "tpm/tpm_commands.h"
TPM_RESULT MTM_Extend(TPM_PCRINDEX pcrNum, TPM_DIGEST *inDigest,
TPM_PCRVALUE *outDigest)
{
info("MTM_Extend()");
if (mtmData.permanent.data.verifiedPCRs.pcrSelect[pcrNum >> 3] & (1 << (pcrNum & 7))) {
return TPM_BAD_LOCALITY;
}
return TPM_Extend(pcrNum, inDigest, outDigest);
}
TPM_RESULT MTM_PCR_Reset(TPM_PCR_SELECTION *pcrSelection)
{
int i;
info("MTM_PCR_Reset()");
for (i = 0; i < pcrSelection->sizeOfSelect * 8; i++) {
if ((pcrSelection->pcrSelect[i >> 3] & (1 << (i & 7)))
&& (mtmData.permanent.data.verifiedPCRs.pcrSelect[i >> 3] & (1 << (i & 7)))) {
return TPM_FAIL;
}
}
return TPM_PCR_Reset(pcrSelection);
}
================================================
FILE: mtm/mtm_marshalling.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_marshalling.h"
int tpm_marshal_MTM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, MTM_PERMANENT_DATA *v)
{
int i;
if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
|| tpm_marshal_BYTE(ptr, length, v->specMajor)
|| tpm_marshal_BYTE(ptr, length, v->specMinor)
|| tpm_marshal_TPM_PCR_SELECTION(ptr, length, &v->verifiedPCRs)
|| tpm_marshal_TPM_COUNT_ID(ptr, length, v->counterRimProtectId)
|| tpm_marshal_TPM_COUNT_ID(ptr, length, v->counterStorageProtectId)
|| tpm_marshal_BYTE(ptr, length, v->loadVerificationKeyMethods)
|| tpm_marshal_BOOL(ptr, length, v->integrityCheckRootValid)
|| tpm_marshal_BYTE_ARRAY(ptr, length, v->integrityCheckRootData,
sizeof(v->integrityCheckRootData))
|| tpm_marshal_TPM_SECRET(ptr, length, &v->internalVerificationKey)) return -1;
for (i = 0; i < MTM_MAX_KEYS; i++) {
if (tpm_marshal_MTM_KEY_DATA(ptr, length, &v->keys[i])) return -1;
}
return 0;
}
int tpm_unmarshal_MTM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, MTM_PERMANENT_DATA *v)
{
int i;
if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
|| tpm_unmarshal_BYTE(ptr, length, &v->specMajor)
|| tpm_unmarshal_BYTE(ptr, length, &v->specMinor)
|| tpm_unmarshal_TPM_PCR_SELECTION(ptr, length, &v->verifiedPCRs)
|| tpm_unmarshal_TPM_COUNT_ID(ptr, length, &v->counterRimProtectId)
|| tpm_unmarshal_TPM_COUNT_ID(ptr, length, &v->counterStorageProtectId)
|| tpm_unmarshal_BYTE(ptr, length, &v->loadVerificationKeyMethods)
|| tpm_unmarshal_BOOL(ptr, length, &v->integrityCheckRootValid)
|| tpm_unmarshal_BYTE_ARRAY(ptr, length, v->integrityCheckRootData,
sizeof(v->integrityCheckRootData))
|| tpm_unmarshal_TPM_SECRET(ptr, length, &v->internalVerificationKey)) return -1;
for (i = 0; i < MTM_MAX_KEYS; i++) {
if (tpm_unmarshal_MTM_KEY_DATA(ptr, length, &v->keys[i])) return -1;
}
return 0;
}
int tpm_marshal_MTM_STANY_FLAGS(BYTE **ptr, UINT32 *length, MTM_STANY_FLAGS *v)
{
if (tpm_marshal_TPM_TAG(ptr, length, v->tag)
|| tpm_marshal_BOOL(ptr, length, v->loadVerificationRootKeyEnabled)) return -1;
return 0;
}
int tpm_unmarshal_MTM_STANY_FLAGS(BYTE **ptr, UINT32 *length, MTM_STANY_FLAGS *v)
{
if (tpm_unmarshal_TPM_TAG(ptr, length, &v->tag)
|| tpm_unmarshal_BOOL(ptr, length, &v->loadVerificationRootKeyEnabled)) return -1;
return 0;
}
int tpm_marshal_MTM_COUNTER_REFERENCE(BYTE **ptr, UINT32 *length, MTM_COUNTER_REFERENCE *v)
{
if (tpm_marshal_BYTE(ptr, length, v->counterSelection)
|| tpm_marshal_TPM_ACTUAL_COUNT(ptr, length, v->counterValue)) return -1;
return 0;
}
int tpm_unmarshal_MTM_COUNTER_REFERENCE(BYTE **ptr, UINT32 *length, MTM_COUNTER_REFERENCE *v)
{
if (tpm_unmarshal_BYTE(ptr, length, &v->counterSelection)
|| tpm_unmarshal_TPM_ACTUAL_COUNT(ptr, length, &v->counterValue)) return -1;
return 0;
}
int tpm_marshal_TPM_RIM_CERTIFICATE(BYTE **ptr, UINT32 *length, TPM_RIM_CERTIFICATE *v)
{
if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
|| tpm_marshal_BYTE_ARRAY(ptr, length, v->label, 8)
|| tpm_marshal_UINT32(ptr, length, v->rimVersion)
|| tpm_marshal_MTM_COUNTER_REFERENCE(ptr, length, &v->referenceCounter)
|| tpm_marshal_TPM_PCR_INFO_SHORT(ptr, length, &v->state)
|| tpm_marshal_UINT32(ptr, length, v->measurementPcrIndex)
|| tpm_marshal_TPM_PCRVALUE(ptr, length, &v->measurementValue)
|| tpm_marshal_TPM_VERIFICATION_KEY_ID(ptr, length, v->parentId)
|| tpm_marshal_BYTE(ptr, length, v->extensionDigestSize)
|| (v->extensionDigestSize > 0
&& tpm_marshal_BLOB(ptr, length, v->extensionDigestData, v->extensionDigestSize))
|| tpm_marshal_UINT32(ptr, length, v->integrityCheckSize)
|| (v->integrityCheckSize > 0
&& tpm_marshal_BLOB(ptr, length, v->integrityCheckData, v->integrityCheckSize))) return -1;
return 0;
}
int tpm_unmarshal_TPM_RIM_CERTIFICATE(BYTE **ptr, UINT32 *length, TPM_RIM_CERTIFICATE *v)
{
if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
|| tpm_unmarshal_BYTE_ARRAY(ptr, length, v->label, 8)
|| tpm_unmarshal_UINT32(ptr, length, &v->rimVersion)
|| tpm_unmarshal_MTM_COUNTER_REFERENCE(ptr, length, &v->referenceCounter)
|| tpm_unmarshal_TPM_PCR_INFO_SHORT(ptr, length, &v->state)
|| tpm_unmarshal_UINT32(ptr, length, &v->measurementPcrIndex)
|| tpm_unmarshal_TPM_PCRVALUE(ptr, length, &v->measurementValue)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_ID(ptr, length, &v->parentId)
|| tpm_unmarshal_BYTE(ptr, length, &v->extensionDigestSize)
|| (v->extensionDigestSize > 0
&& tpm_unmarshal_BLOB(ptr, length, &v->extensionDigestData, v->extensionDigestSize))
|| tpm_unmarshal_UINT32(ptr, length, &v->integrityCheckSize)
|| (v->integrityCheckSize > 0
&& tpm_unmarshal_BLOB(ptr, length, &v->integrityCheckData, v->integrityCheckSize))) return -1;
return 0;
}
int tpm_marshal_TPM_VERIFICATION_KEY(BYTE **ptr, UINT32 *length, TPM_VERIFICATION_KEY *v)
{
if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
|| tpm_marshal_UINT16(ptr, length, v->usageFlags)
|| tpm_marshal_TPM_VERIFICATION_KEY_ID(ptr, length, v->parentId)
|| tpm_marshal_TPM_VERIFICATION_KEY_ID(ptr, length, v->myId)
|| tpm_marshal_MTM_COUNTER_REFERENCE(ptr, length, &v->referenceCounter)
|| tpm_marshal_TPM_ALGORITHM_ID(ptr, length, v->keyAlgorithm)
|| tpm_marshal_TPM_SIG_SCHEME(ptr, length, v->keyScheme)
|| tpm_marshal_BYTE(ptr, length, v->extensionDigestSize)
|| (v->extensionDigestSize > 0
&& tpm_marshal_BLOB(ptr, length, v->extensionDigestData, v->extensionDigestSize))
|| tpm_marshal_UINT32(ptr, length, v->keySize)
|| (v->keySize > 0 && tpm_marshal_BLOB(ptr, length, v->keyData, v->keySize))
|| tpm_marshal_UINT32(ptr, length, v->integrityCheckSize)
|| (v->integrityCheckSize > 0
&& tpm_marshal_BLOB(ptr, length, v->integrityCheckData, v->integrityCheckSize))) return -1;
return 0;
}
int tpm_unmarshal_TPM_VERIFICATION_KEY(BYTE **ptr, UINT32 *length, TPM_VERIFICATION_KEY *v)
{
if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
|| tpm_unmarshal_UINT16(ptr, length, &v->usageFlags)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_ID(ptr, length, &v->parentId)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_ID(ptr, length, &v->myId)
|| tpm_unmarshal_MTM_COUNTER_REFERENCE(ptr, length, &v->referenceCounter)
|| tpm_unmarshal_TPM_ALGORITHM_ID(ptr, length, &v->keyAlgorithm)
|| tpm_unmarshal_TPM_SIG_SCHEME(ptr, length, &v->keyScheme)
|| tpm_unmarshal_BYTE(ptr, length, &v->extensionDigestSize)
|| (v->extensionDigestSize > 0
&& tpm_unmarshal_BLOB(ptr, length, &v->extensionDigestData, v->extensionDigestSize))
|| tpm_unmarshal_UINT32(ptr, length, &v->keySize)
|| (v->keySize > 0 && tpm_unmarshal_BLOB(ptr, length, &v->keyData, v->keySize))
|| tpm_unmarshal_UINT32(ptr, length, &v->integrityCheckSize)
|| (v->integrityCheckSize > 0
&& tpm_unmarshal_BLOB(ptr, length, &v->integrityCheckData, v->integrityCheckSize))) return -1;
return 0;
}
int tpm_marshal_MTM_KEY_DATA(BYTE **ptr, UINT32 *length, MTM_KEY_DATA *v)
{
if (tpm_marshal_BOOL(ptr, length, v->valid)) return -1;
if (v->valid) {
if (tpm_marshal_UINT16(ptr, length, v->usageFlags)
|| tpm_marshal_TPM_VERIFICATION_KEY_ID(ptr, length, v->parentId)
|| tpm_marshal_TPM_VERIFICATION_KEY_ID(ptr, length, v->myId)
|| tpm_marshal_TPM_ALGORITHM_ID(ptr, length, v->keyAlgorithm)
|| tpm_marshal_TPM_SIG_SCHEME(ptr, length, v->keyScheme)
|| tpm_marshal_RSAPub(ptr, length, &v->key)) return -1;
}
return 0;
}
int tpm_unmarshal_MTM_KEY_DATA(BYTE **ptr, UINT32 *length, MTM_KEY_DATA *v)
{
if (tpm_unmarshal_BOOL(ptr, length, &v->valid)) return -1;
if (v->valid) {
if (tpm_unmarshal_UINT16(ptr, length, &v->usageFlags)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_ID(ptr, length, &v->parentId)
|| tpm_unmarshal_TPM_VERIFICATION_KEY_ID(ptr, length, &v->myId)
|| tpm_unmarshal_TPM_ALGORITHM_ID(ptr, length, &v->keyAlgorithm)
|| tpm_unmarshal_TPM_SIG_SCHEME(ptr, length, &v->keyScheme)
|| tpm_unmarshal_RSAPub(ptr, length, &v->key)) return -1;
}
return 0;
}
int tpm_marshal_MTM_DATA(BYTE **ptr, UINT32 *length, MTM_DATA *v)
{
if (tpm_marshal_MTM_PERMANENT_DATA(ptr, length, &v->permanent.data)
|| tpm_marshal_MTM_STANY_FLAGS(ptr, length, &v->stany.flags)) return -1;
return 0;
}
int tpm_unmarshal_MTM_DATA(BYTE **ptr, UINT32 *length, MTM_DATA *v)
{
if (tpm_unmarshal_MTM_PERMANENT_DATA(ptr, length, &v->permanent.data)
|| tpm_unmarshal_MTM_STANY_FLAGS(ptr, length, &v->stany.flags)) return -1;
return 0;
}
================================================
FILE: mtm/mtm_marshalling.h
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#ifndef _MTM_MARSHALLING_H_
#define _MTM_MARSHALLING_H_
#include "mtm_structures.h"
#include "tpm/tpm_marshalling.h"
#define tpm_marshal_TPM_VERIFICATION_KEY_ID tpm_marshal_UINT32
#define tpm_unmarshal_TPM_VERIFICATION_KEY_ID tpm_unmarshal_UINT32
#define tpm_marshal_TPM_VERIFICATION_KEY_HANDLE tpm_marshal_UINT32
#define tpm_unmarshal_TPM_VERIFICATION_KEY_HANDLE tpm_unmarshal_UINT32
int tpm_marshal_MTM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, MTM_PERMANENT_DATA *v);
int tpm_unmarshal_MTM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, MTM_PERMANENT_DATA *v);
int tpm_marshal_MTM_STANY_FLAGS(BYTE **ptr, UINT32 *length, MTM_STANY_FLAGS *v);
int tpm_unmarshal_MTM_STANY_FLAGS(BYTE **ptr, UINT32 *length, MTM_STANY_FLAGS *v);
int tpm_marshal_MTM_COUNTER_REFERENCE(BYTE **ptr, UINT32 *length, MTM_COUNTER_REFERENCE *v);
int tpm_unmarshal_MTM_COUNTER_REFERENCE(BYTE **ptr, UINT32 *length, MTM_COUNTER_REFERENCE *v);
int tpm_marshal_TPM_RIM_CERTIFICATE(BYTE **ptr, UINT32 *length, TPM_RIM_CERTIFICATE *v);
int tpm_unmarshal_TPM_RIM_CERTIFICATE(BYTE **ptr, UINT32 *length, TPM_RIM_CERTIFICATE *v);
int tpm_marshal_TPM_VERIFICATION_KEY(BYTE **ptr, UINT32 *length, TPM_VERIFICATION_KEY *v);
int tpm_unmarshal_TPM_VERIFICATION_KEY(BYTE **ptr, UINT32 *length, TPM_VERIFICATION_KEY *v);
int tpm_marshal_MTM_KEY_DATA(BYTE **ptr, UINT32 *length, MTM_KEY_DATA *v);
int tpm_unmarshal_MTM_KEY_DATA(BYTE **ptr, UINT32 *length, MTM_KEY_DATA *v);
int tpm_marshal_MTM_DATA(BYTE **ptr, UINT32 *length, MTM_DATA *v);
int tpm_unmarshal_MTM_DATA(BYTE **ptr, UINT32 *length, MTM_DATA *v);
#endif /* _MTM_MARSHALLING_H_ */
================================================
FILE: mtm/mtm_structures.h
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#ifndef _MTM_STRUCTURES_H_
#define _MTM_STRUCTURES_H_
#include "tpm/tpm_structures.h"
#include "crypto/sha1.h"
/*
* Ordinals
* The command ordinals provide the index value for each command.
*/
#define MTM_ORD_InstallRIM (66 + TPM_PROTECTED_COMMAND)
#define MTM_ORD_LoadVerificationKey (67 + TPM_PROTECTED_COMMAND)
#define MTM_ORD_LoadVerificationRootKeyDisable (68 + TPM_PROTECTED_COMMAND)
#define MTM_ORD_VerifyRIMCert (69 + TPM_PROTECTED_COMMAND)
#define MTM_ORD_VerifyRIMCertAndExtend (72 + TPM_PROTECTED_COMMAND)
#define MTM_ORD_IncrementBootstrapCounter (73 + TPM_PROTECTED_COMMAND)
#define MTM_ORD_SetVerifiedPCRSelection (74 + TPM_PROTECTED_COMMAND)
/*
* TPM_CAPABILITY_AREA Values for TPM_GetCapability
*/
#define TPM_CAP_MTM_PERMANENT_DATA 0x0000000A
/*
* MTM_COUNTER_REFERENCE ([MTM], Section 5.1)
* MTM counter reference structure
*/
#define MTM_COUNTER_SELECT_NONE 0
#define MTM_COUNTER_SELECT_BOOTSTRAP 1
#define MTM_COUNTER_SELECT_RIMPROTECT 2
#define MTM_COUNTER_SELECT_STORAGEPROTECT 3
#define MTM_COUNTER_SELECT_MAX 3
typedef struct MTM_COUNTER_REFERENCE_STRUCT {
BYTE counterSelection;
TPM_ACTUAL_COUNT counterValue;
} MTM_COUNTER_REFERENCE;
#define sizeof_MTM_COUNTER_REFERENCE(s) (1 + 4)
/*
* TPM_VERIFICATION_KEY_ID ([MTM], Section 5.3)
*/
typedef UINT32 TPM_VERIFICATION_KEY_ID;
#define TPM_VERIFICATION_KEY_ID_NONE 0xFFFFFFFF
#define TPM_VERIFICATION_KEY_ID_INTERNAL 0xFFFFFFFE
/*
* TPM_VERIFICATION_KEY_USAGE ([MTM], Section 5.3)
*/
#define TPM_VERIFICATION_KEY_USAGE_MTM_MASK 0x00ff
#define TPM_VERIFICATION_KEY_USAGE_AGENT_MASK 0x0f00
#define TPM_VERIFICATION_KEY_USAGE_VENDOR_MASK 0xf000
#define TPM_VERIFICATION_KEY_USAGE_SIGN_RIMCERT 0x0001
#define TPM_VERIFICATION_KEY_USAGE_SIGN_RIMAUTH 0x0002
#define TPM_VERIFICATION_KEY_USAGE_INCREMENT_BOOTSTRAP 0x0004
/*
* TPM_VERIFICATION_KEY_HANDLE ([MTM], Section 5.3)
* Handle used to refer to TPM_VERIFICATION_KEY structures
*/
typedef UINT32 TPM_VERIFICATION_KEY_HANDLE;
/*
* TPM_VERIFICATION_KEY ([MTM], Section 5.3)
* The TPM_VERIFICATION_KEY structure is used for representing keys in
* the authorization hierarchy used to authorize RIM_Certs for a MTM.
*/
#define TPM_TAG_VERIFICATION_KEY 0x0301
typedef struct TPM_VERIFICATION_KEY_STRUCT {
TPM_STRUCTURE_TAG tag;
UINT16 usageFlags;
TPM_VERIFICATION_KEY_ID parentId;
TPM_VERIFICATION_KEY_ID myId;
MTM_COUNTER_REFERENCE referenceCounter;
TPM_ALGORITHM_ID keyAlgorithm;
TPM_SIG_SCHEME keyScheme;
BYTE extensionDigestSize;
BYTE* extensionDigestData;
UINT32 keySize;
BYTE* keyData;
UINT32 integrityCheckSize;
BYTE* integrityCheckData;
} TPM_VERIFICATION_KEY;
#define sizeof_TPM_VERIFICATION_KEY(s) (2 + 2 + 4 + 4 \
+ sizeof_MTM_COUNTER_REFERENCE(s.referenceCounter) + 4 + 2 + 1 \
+ s.extensionDigestSize + 4 + s.keySize + 4 + s.integrityCheckSize)
#define free_TPM_VERIFICATION_KEY(s) { \
if (s.extensionDigestSize > 0) tpm_free(s.extensionDigestData); \
if (s.keySize > 0) tpm_free(s.keyData); \
if (s.integrityCheckSize > 0) tpm_free(s.integrityCheckData); }
/*
* TPM_RIM_CERTIFICATE ([MTM], Section 5.2)
* A RIM Certificate is a structure authorizing a measurement value
* that is extended using MTM_VerifyRIMCertAndExtend into a PCR
* defined in the RIM Certificate.
*/
#define TPM_TAG_RIM_CERTIFICATE 0x0302
typedef struct TPM_RIM_CERTIFICATE_STRUCT {
TPM_STRUCTURE_TAG tag;
BYTE label[8];
UINT32 rimVersion;
MTM_COUNTER_REFERENCE referenceCounter;
TPM_PCR_INFO_SHORT state;
UINT32 measurementPcrIndex;
TPM_PCRVALUE measurementValue;
TPM_VERIFICATION_KEY_ID parentId;
BYTE extensionDigestSize;
BYTE *extensionDigestData;
UINT32 integrityCheckSize;
BYTE *integrityCheckData;
} TPM_RIM_CERTIFICATE;
#define sizeof_TPM_RIM_CERTIFICATE(s) (2 + 8 + 4 \
+ sizeof_MTM_COUNTER_REFERENCE(s.referenceCounter) \
+ sizeof_TPM_PCR_INFO_SHORT(s.state) \
+ 4 + 20 + 4 + 1 + s.extensionDigestSize \
+ 4 + s.integrityCheckSize)
#define free_TPM_RIM_CERTIFICATE(s) { \
if (s.extensionDigestSize > 0) tpm_free(s.extensionDigestData); \
if (s.integrityCheckSize > 0) tpm_free(s.integrityCheckData); }
/*
* TPM_VERIFICATION_KEY_LOAD_METHODS ([MTM], Section 5.4)
* Methods to load a TPM_VERIFICATION_KEY
*/
typedef BYTE TPM_VERIFICATION_KEY_LOAD_METHODS;
#define TPM_VERIFICATION_KEY_ROOT_LOAD 0x01
#define TPM_VERIFICATION_KEY_INTEGRITY_CHECK_ROOT_DATA_LOAD 0x02
#define TPM_VERIFICATION_KEY_OWNER_AUTHORIZED_LOAD 0x04
#define TPM_VERIFICATION_KEY_CHAIN_AUTHORIZED_LOAD 0x08
/*
* MTM_KEY_DATA
* This structure contains the data for stored MTM verification keys.
*/
typedef struct MTM_KEY_DATA_STRUCT {
BOOL valid;
UINT16 usageFlags;
TPM_VERIFICATION_KEY_ID parentId;
TPM_VERIFICATION_KEY_ID myId;
TPM_ALGORITHM_ID keyAlgorithm;
TPM_SIG_SCHEME keyScheme;
tpm_rsa_public_key_t key;
} MTM_KEY_DATA;
#define sizeof_MTM_KEY_DATA(s) ( \
1 + 2 + 4 + 4 + 4 + 2 + sizeof_RSAPub(s.key))
#define free_MTM_KEY_DATA(s) { tpm_rsa_release_public_key(&s.key); }
/*
* MTM_PERMANENT_DATA ([MTM], Section 5.4)
* The MTM_PERMANENT_DATA structure contains the permanent data associated
* with a MTM that are used by the MTM commands. Note that there is an
* alternative where there is only AIK but no EK defined.
*/
#define MTM_TAG_PERMANENT_DATA 0x0303
#define MTM_MAX_KEYS 10
typedef struct MTM_PERMANENT_DATA_STRUCT {
TPM_STRUCTURE_TAG tag;
BYTE specMajor;
BYTE specMinor;
/* TPM_KEY aik; - not needed as the EK is always present */
TPM_PCR_SELECTION verifiedPCRs;
TPM_COUNT_ID counterRimProtectId;
TPM_COUNT_ID counterStorageProtectId;
TPM_VERIFICATION_KEY_LOAD_METHODS loadVerificationKeyMethods;
BOOL integrityCheckRootValid;
BYTE integrityCheckRootData[SHA1_DIGEST_LENGTH];
TPM_SECRET internalVerificationKey;
/* TPM_SECRET verificationAuth; - is a mirror of the ownerAuth */
MTM_KEY_DATA keys[MTM_MAX_KEYS];
} MTM_PERMANENT_DATA;
static inline int sizeof_MTM_PERMANENT_DATA(MTM_PERMANENT_DATA *s)
{
int i, size = 2 + 1 + 1 + 4 + 4 + 1 + 1 + 20;
size += sizeof_TPM_PCR_SELECTION(s->verifiedPCRs);
size += sizeof(s->integrityCheckRootData);
for (i = 0; i < MTM_MAX_KEYS; i++) {
if (s->keys[i].valid) {
size += sizeof_MTM_KEY_DATA(s->keys[i]);
} else {
size += 1;
}
}
return size;
}
static inline void free_MTM_PERMANENT_DATA(MTM_PERMANENT_DATA *s)
{
int i;
for (i = 0; i < MTM_MAX_KEYS; i++) {
if (s->keys[i].valid) free_MTM_KEY_DATA(s->keys[i]);
}
}
/*
* The MTM_STANY_FLAGS structure houses additional flags that are
* initialized by TPM_Init when the MTM boots.
*/
#define MTM_TAG_STANY_FLAGS 0x0304
typedef struct MTM_STANY_FLAGS_STRUCT {
TPM_TAG tag;
BOOL loadVerificationRootKeyEnabled;
} MTM_STANY_FLAGS;
#define sizeof_MTM_STANY_FLAGS(s) (2 + 1)
/*
* MTM_DATA
* Internal data of the MTM
*/
typedef struct tdMTM_DATA {
struct {
MTM_PERMANENT_DATA data;
} permanent;
// struct {
// } stclear;
struct {
MTM_STANY_FLAGS flags;
} stany;
} MTM_DATA;
#define sizeof_MTM_DATA(s) (sizeof_MTM_PERMANENT_DATA(&s.permanent.data) \
+ sizeof_MTM_STANY_FLAGS(s.stany.flags))
#define free_MTM_DATA(s) { free_MTM_PERMANENT_DATA(&s.permanent.data); }
#endif /* _MTM_STRUCTURES_H */
================================================
FILE: mtm/mtm_verification.c
================================================
/* Software-based Mobile Trusted Module (MTM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
* Copyright (C) 2007 Jan-Erik Ekberg <jan-erik.ekberg@nokia.com>,
* Nokia Corporation and/or its subsidiary(-ies)
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id$
*/
#include "mtm_structures.h"
#include "mtm_commands.h"
#include "tpm/tpm_commands.h"
#include "mtm_data.h"
#include "tpm/tpm_data.h"
#include "mtm_handles.h"
#include "mtm_marshalling.h"
#include "crypto/hmac.h"
#include "crypto/rsa.h"
#include "crypto/sha1.h"
static int copy_TPM_RIM_CERTIFICATE(TPM_RIM_CERTIFICATE* src, TPM_RIM_CERTIFICATE* dst)
{
memcpy(dst, src, sizeof(TPM_RIM_CERTIFICATE));
if (dst->extensionDigestSize > 0) {
dst->extensionDigestData = tpm_malloc(dst->extensionDigestSize);
if (dst->extensionDigestData == NULL) return -1;
memcpy(dst->extensionDigestData, src->extensionDigestData,
dst->extensionDigestSize);
} else {
dst->extensionDigestData = NULL;
}
if (dst->integrityCheckSize > 0) {
dst->integrityCheckData = tpm_malloc(dst->integrityCheckSize);
if (dst->integrityCheckData == NULL) {
tpm_free(dst->extensionDigestData);
return -1;
}
memcpy(dst->integrityCheckData, src->integrityCheckData,
dst->integrityCheckSize);
} else {
dst->integrityCheckData = NULL;
}
return 0;
}
static int compute_rim_certificate_digest(TPM_RIM_CERTIFICATE* rimCert, BYTE *digest)
{
tpm_sha1_ctx_t sha1_ctx;
BYTE *buf, *ptr;
UINT32 buf_len, len;
UINT32 integrityCheckSize;
/* marshal certificate */
integrityCheckSize = rimCert->integrityCheckSize;
rimCert->integrityCheckSize = 0;
buf_len = len = sizeof_TPM_RIM_CERTIFICATE((*rimCert));
buf = ptr = tpm_malloc(buf_len);
if (buf == NULL || tpm_marshal_TPM_RIM_CERTIFICATE(&ptr, &len, rimCert)) {
rimCert->integrityCheckSize = integrityCheckSize;
tpm_free(buf);
return -1;
}
rimCert->integrityCheckSize = integrityCheckSize;
/* compute hmac */
tpm_sha1_init(&sha1_ctx);
tpm_sha1_update(&sha1_ctx, buf, buf_len);
tpm_sha1_final(&sha1_ctx, digest);
tpm_free(buf);
return 0;
}
static int compute_rim_certificate_hmac(TPM_RIM_CERTIFICATE* rimCert, BYTE *digest)
{
tpm_hmac_ctx_t hmac_ctx;
BYTE *buf, *ptr;
UINT32 buf_len, len;
UINT32 integrityCheckSize;
/* marshal certificate */
integrityCheckSize = rimCert->integrityCheckSize;
rimCert->integrityCheckSize = 0;
buf_len = len = sizeof_TPM_RIM_CERTIFICATE((*rimCert));
buf = ptr = tpm_malloc(buf_len);
if (buf == NULL || tpm_marshal_TPM_RIM_CERTIFICATE(&ptr, &len, rimCert)) {
rimCert->integrityCheckSize = integrityCheckSize;
tpm_free(buf);
return -1;
}
rimCert->integrityCheckSize = integrityCheckSize;
/* compute hmac */
tpm_hmac_init(&hmac_ctx, mtmData.permanent.data.internalVerificationKey,
sizeof(TPM_SECRET));
tpm_hmac_update(&hmac_ctx, buf, buf_len);
tpm_hmac_final(&hmac_ctx, digest);
tpm_free(buf);
return 0;
}
static TPM_RESULT verify_rim_certificate(TPM_RIM_CERTIFICATE *rimCert)
{
/* check parrentID */
debug("parentId = %08x", rimCert->parentId);
if (rimCert->parentId == TPM_VERIFICATION_KEY_ID_NONE) return TPM_KEYNOTFOUND;
/* verify certificate with appropiate key */
if (rimCert->parentId == TPM_VERIFICATION_KEY_ID_INTERNAL) {
BYTE digest[SHA1_DIGEST_LENGTH];
debug("internal verification");
if (compute_rim_certificate_hmac(rimCert, digest) != 0) {
debug("compute_rim_certificate_hmac() failed");
return TPM_FAIL;
}
/* check hmac */
if (memcmp(digest, rimCert->integrityCheckData, SHA1_DIGEST_LENGTH) != 0) {
debug("verification failed");
return TPM_AUTHFAIL;
} else {
debug("verification succeeded");
return TPM_SUCCESS;
}
} else {
BYTE digest[SHA1_DIGEST_LENGTH];
/* get verification key */
MTM_KEY_DATA *key = mtm_get_key_by_id(rimCert->parentId);
if (key == NULL) {
return TPM_KEYNOTFOUND;
}
/* compute digest */
if (compute_rim_certificate_digest(rimCert, digest) != 0) {
debug("compute_rim_certificate_digest() failed");
return TPM_FAIL;
}
/* check key properties */
if (key->keyAlgorithm != TPM_ALG_RSA
|| key->keyScheme != TPM_SS_RSASSAPKCS1v15_SHA1) {
debug("invalid signature scheme");
return TPM_BAD_SCHEME;
}
/* verify signature */
if (tpm_rsa_verify(&key->key, RSA_SSA_PKCS1_SHA1_RAW, digest, sizeof(digest),
rimCert->integrityCheckData) != 0) {
debug("verification failed");
return TPM_AUTHFAIL;
} else {
debug("verification succeeded");
return TPM_SUCCESS;
}
}
}
static int compute_verification_key_digest(TPM_VERIFICATION_KEY *key, BYTE *digest)
{
tpm_sha1_ctx_t sha1_ctx;
BYTE *buf, *ptr;
UINT32 buf_len, len;
UINT32 integrityCheckSize;
/* marshal certificate */
integrityCheckSize = key->integrityCheckSize;
key->integrityCheckSize = 0;
buf_len = len = sizeof_TPM_VERIFICATION_KEY((*key));
buf = ptr = tpm_malloc(buf_len);
if (buf == NULL || tpm_marshal_TPM_VERIFICATION_KEY(&ptr, &len, key)) {
key->integrityCheckSize = integrityCheckSize;
tpm_free(buf);
return -1;
}
key->integrityCheckSize = integrityCheckSize;
/* compute sha1 */
tpm_sha1_init(&sha1_ctx);
tpm_sha1_update(&sha1_ctx, buf, buf_len);
tpm_sha1_final(&sha1_ctx, digest);
tpm_free(buf);
return 0;
}
static TPM_RESULT verify_verification_key(TPM_VERIFICATION_KEY *key, MTM_KEY_DATA *parentKey)
{
BYTE digest[SHA1_DIGEST_LENGTH];
/* compute digest */
if (compute_verification_key_digest(key, digest) != 0) {
debug("compute_verification_key_digest() failed");
return TPM_FAIL;
}
/* check key properties */
if (parentKey->keyAlgorithm != TPM_ALG_RSA
|| parentKey->keyScheme != TPM_SS_RSASSAPKCS1v15_SHA1) {
debug("invalid signature scheme");
return TPM_BAD_SCHEME;
}
/* verify signature */
if (tpm_rsa_verify(&parentKey->key, RSA_SSA_PKCS1_SHA1_RAW, digest, sizeof(digest),
key->integrityCheckData) != 0) {
debug("verification failed");
return TPM_AUTHFAIL;
} else {
debug("verification succeeded");
return TPM_SUCCESS;
}
}
static int store_verification_key(TPM_VERIFICATION_KEY *inKey, MTM_KEY_DATA *outKey)
{
outKey->usageFlags = inKey->usageFlags;
outKey->parentId = inKey->parentId;
outKey->myId = inKey->myId;
outKey->keyAlgorithm = inKey->keyAlgorithm;
outKey->keyScheme = inKey->keyScheme;
BYTE *ptr = inKey->keyData;
UINT32 len = inKey->keySize;
if (tpm_unmarshal_RSAPub(&ptr, &len, &outKey->key) != 0) return -1;
return 0;
}
TPM_RESULT MTM_InstallRIM(TPM_RIM_CERTIFICATE *rimCertIn, TPM_AUTH *auth1,
TPM_RIM_CERTIFICATE *rimCertOut)
{
TPM_RESULT res;
TPM_ACTUAL_COUNT cntProtect;
info("MTM_InstallRIM()");
/* 1 */
if (rimCertIn == NULL || rimCertIn->tag != TPM_TAG_RIM_CERTIFICATE)
return TPM_BAD_PARAMETER;
/* 2 */
res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, auth1->authHandle);
if (res != TPM_SUCCESS) return res;
/* 3 */
cntProtect = tpmData.permanent.data.counters[MTM_COUNTER_SELECT_RIMPROTECT].counter;
/* 5 */
rimCertIn->integrityCheckSize = SHA1_DIGEST_LENGTH;
if (copy_TPM_RIM_CERTIFICATE(rimCertIn, rimCertOut) != 0) {
debug("copy_TPM_RIM_CERTIFICATE() failed");
return TPM_FAIL;
}
/* 6, 7 */
if (rimCertIn->referenceCounter.counterSelection != MTM_COUNTER_SELECT_NONE) {
rimCertOut->referenceCounter.counterValue = cntProtect + 1;
rimCertOut->referenceCounter.counterSelection = MTM_COUNTER_SELECT_RIMPROTECT;
} else {
rimCertOut->referenceCounter.counterValue = 0;
}
/* 8 */
rimCertOut->parentId = TPM_VERIFICATION_KEY_ID_INTERNAL;
/* 10, 11, 12 */
if (compute_rim_certificate_hmac(rimCertOut, rimCertOut->integrityCheckData) != 0) {
debug("compute_rim_certificate_hmac() failed");
free_TPM_RIM_CERTIFICATE((*rimCertOut));
return TPM_FAIL;
}
/* 13 */
return TPM_SUCCESS;
}
static TPM_VERIFICATION_KEY_HANDLE mtm_get_free_key(void)
{
int i;
for (i = 0; i < TPM_MAX_KEYS; i++) {
if (!mtmData.permanent.data.keys[i].valid) {
mtmData.permanent.data.keys[i].valid = TRUE;
return INDEX_TO_KEY_HANDLE(i);
}
}
return TPM_INVALID_HANDLE;
}
TPM_RESULT MTM_LoadVerificationKey(TPM_VERIFICATION_KEY_HANDLE parentKeyHandle,
TPM_VERIFICATION_KEY *verificationKey, TPM_AUTH *auth1,
TPM_VERIFICATION_KEY_HANDLE *verificationKeyHandle,
BYTE *loadMethod)
{
TPM_RESULT res;
MTM_KEY_DATA *key;
/* 1 */
if (verificationKey == NULL || verificationKey->tag != TPM_TAG_VERIFICATION_KEY)
return TPM_BAD_PARAMETER;
/* 2 */
*verificationKeyHandle = mtm_get_free_key();
key = mtm_get_key(*verificationKeyHandle);
if (key == NULL) {
debug("no free key slot available");
return TPM_NOSPACE;
}
*loadMethod = 0;
/* 3 */
if (mtmData.stany.flags.loadVerificationRootKeyEnabled) {
debug("TPM_VERIFICATION_KEY_ROOT_LOAD");
/* set integrityCheckRootData */
if (!mtmData.permanent.data.integrityCheckRootValid) {
if (compute_verification_key_digest(verificationKey,
mtmData.permanent.data.integrityCheckRootData) != 0) {
debug("compute_verification_key_digest() failed");
memset(key, 0, sizeof(*key));
return TPM_FAIL;
}
mtmData.permanent.data.integrityCheckRootValid = TRUE;
}
*loadMethod = TPM_VERIFICATION_KEY_ROOT_LOAD;
}
/* 4 */
if (*loadMethod == 0
&& mtmData.permanent.data.integrityCheckRootValid) {
BYTE digest[SHA1_DIGEST_LENGTH];
if (compute_verification_key_digest(verificationKey, digest) != 0) {
debug("compute_verification_key_digest() failed");
memset(key, 0, sizeof(*key));
return TPM_FAIL;
}
if (memcmp(mtmData.permanent.data.integrityCheckRootData,
digest, SHA1_DIGEST_LENGTH) == 0) {
debug("TPM_VERIFICATION_KEY_INTEGRITY_CHECK_ROOT_DATA_LOAD");
*loadMethod = TPM_VERIFICATION_KEY_INTEGRITY_CHECK_ROOT_DATA_LOAD;
}
}
/* 5 */
if (*loadMethod == 0
&& tpmData.permanent.flags.owned && auth1->authHandle != TPM_INVALID_HANDLE) {
TPM_RESULT res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
if (res != TPM_SUCCESS) {
memset(key, 0, sizeof(*key));
return res;
}
debug("TPM_VERIFICATION_KEY_OWNER_AUTHORIZED_LOAD");
*loadMethod = TPM_VERIFICATION_KEY_OWNER_AUTHORIZED_LOAD;
}
/* 6 */
if (*loadMethod == 0) {
MTM_KEY_DATA *parentKey = mtm_get_key(parentKeyHandle);
if (parentKey == NULL) {
debug("invalid parent key handle %08x", parentKeyHandle);
memset(key, 0, sizeof(*key));
return TPM_KEYNOTFOUND;
}
/* 7a-c */
if (!(parentKey->usageFlags & TPM_VERIFICATION_KEY_USAGE_SIGN_RIMAUTH)) {
memset(key, 0, sizeof(*key));
return TPM_INVALID_KEYUSAGE;
}
if ((verificationKey->usageFlags & TPM_VERIFICATION_KEY_USAGE_INCREMENT_BOOTSTRAP)
&& !(parentKey->usageFlags & TPM_VERIFICATION_KEY_USAGE_INCREMENT_BOOTSTRAP)) {
memset(key, 0, sizeof(*key));
return TPM_INVALID_KEYUSAGE;
}
if (key->parentId != parentKey->myId) {
debug("id mismatch: parentId = %08x keyId = %08x", key->parentId, parentKey->myId);
memset(key, 0, sizeof(*key));
return TPM_AUTHFAIL;
}
/* 7d */
res = verify_verification_key(verificationKey, parentKey);
if (res != TPM_SUCCESS) {
memset(key, 0, sizeof(*key));
return res;
}
/* 7e-g */
if (verificationKey->referenceCounter.counterSelection > MTM_COUNTER_SELECT_MAX)
return TPM_BAD_COUNTER;
if (verificationKey->referenceCounter.counterSelection == MTM_COUNTER_SELECT_BOOTSTRAP) {
if (verificationKey->referenceCounter.counterValue
< tpmData.permanent.data.counters[MTM_COUNTER_SELECT_BOOTSTRAP].counter)
return TPM_BAD_COUNTER;
}
if (verificationKey->referenceCounter.counterSelection == MTM_COUNTER_SELECT_RIMPROTECT) {
if (verificationKey->referenceCounter.counterValue
< tpmData.permanent.data.counters[MTM_COUNTER_SELECT_RIMPROTECT].counter)
return TPM_BAD_COUNTER;
}
/* 7j */
debug("TPM_VERIFICATION_KEY_CHAIN_AUTHORIZED_LOAD");
*loadMethod = TPM_VERIFICATION_KEY_CHAIN_AUTHORIZED_LOAD;
}
/* store verification key */
if (store_verification_key(verificationKey, key) != 0) {
debug("store_verification_key() failed");
memset(key, 0, sizeof(*key));
return TPM_FAIL;
}
return TPM_SUCCESS;
}
TPM_RESULT MTM_LoadVerificationRootKeyDisable()
{
info("MTM_LoadVerificationRootKeyDisable()");
mtmData.stany.flags.loadVerificationRootKeyEnabled = FALSE;
mtmData.permanent.data.loadVerificationKeyMethods |= TPM_VERIFICATION_KEY_ROOT_LOAD;
return TPM_SUCCESS;
}
TPM_RESULT MTM_VerifyRIMCert(TPM_RIM_CERTIFICATE* rimCert,
TPM_VERIFICATION_KEY_HANDLE rimKeyHandle)
{
TPM_RESULT res;
info("MTM_VerifyRIMCert()");
debug("key handle = %08x", rimKeyHandle);
/* 1 */
if (rimCert == NULL || rimCert->tag != TPM_TAG_RIM_CERTIFICATE)
return TPM_BAD_PARAMETER;
/* 2 */
if (rimCert->parentId == TPM_VERIFICATION_KEY_ID_NONE)
return TPM_AUTHFAIL;
/* 3 */
if (rimCert->parentId == TPM_VERIFICATION_KEY_ID_INTERNAL) {
return verify_rim_certificate(rimCert);
} else {
/* 4 */
MTM_KEY_DATA *rimKey = mtm_get_key(rimKeyHandle);
if (rimKey == NULL) return TPM_KEYNOTFOUND;
if ((rimKey->usageFlags & TPM_VERIFICATION_KEY_USAGE_SIGN_RIMCERT) == 0)
return TPM_INVALID_KEYUSAGE;
if (rimCert->parentId != rimKey->myId) {
debug("id mismatch: parentId = %08x keyId = %08x", rimCert->parentId, rimKey->myId);
return TPM_AUTHFAIL;
}
res = verify_rim_certificate(rimCert);
if (res != TPM_SUCCESS) return res;
}
/* 5 */
if (rimCert->referenceCounter.counterSelection > MTM_COUNTER_SELECT_MAX)
return TPM_BAD_COUNTER;
/* 6 */
if (rimCert->referenceCounter.counterSelection == MTM_COUNTER_SELECT_BOOTSTRAP) {
if (rimCert->referenceCounter.counterValue
< tpmData.permanent.data.counters[MTM_COUNTER_SELECT_BOOTSTRAP].counter)
return TPM_BAD_COUNTER;
}
/* 7 */
if (rimCert->referenceCounter.counterSelection == MTM_COUNTER_SELECT_RIMPROTECT) {
if (rimCert->referenceCounter.counterValue
< tpmData.permanent.data.counters[MTM_COUNTER_SELECT_RIMPROTECT].counter)
return TPM_BAD_COUNTER;
}
return TPM_SUCCESS;
}
TPM_RESULT MTM_VerifyRIMCertAndExtend(TPM_RIM_CERTIFICATE *rimCert,
TPM_VERIFICATION_KEY_HANDLE rimKey,
TPM_PCRVALUE *outDigest)
{
int i;
TPM_RESULT res;
info("MTM_VerifyRIMCertAndExtend()");
/* 1-7 */
res = MTM_VerifyRIMCert(rimCert, rimKey);
if (res != TPM_SUCCESS) return res;
/* 8 */
for (i = 0; i < TPM_NUM_PCR / 8; i++) {
if (rimCert->state.pcrSelection.pcrSelect[i] != 0) break;
}
if (i < TPM_NUM_PCR / 8) {
TPM_COMPOSITE_HASH digest;
if (tpm_compute_pcr_digest(&rimCert->state.pcrSelection, &digest, NULL) != TPM_SUCCESS) {
debug("tpm_compute_pcr_digest() failed");
return TPM_FAIL;
}
if (memcmp(&digest, &rimCert->state.digestAtRelease, sizeof(TPM_COMPOSITE_HASH)) != 0)
return TPM_WRONGPCRVAL;
}
/* 9, 10 */
return TPM_Extend(rimCert->measurementPcrIndex, &rimCert->measurementValue, outDigest);
}
TPM_RESULT MTM_IncrementBootstrapCounter(TPM_RIM_CERTIFICATE *rimCert,
TPM_VERIFICATION_KEY_HANDLE rimKeyHandle)
{
TPM_RESULT res;
MTM_KEY_DATA* rimKey;
info("MTM_IncrementBootstrapCounter()");
/* 1 */
if (rimCert == NULL || rimCert->tag != TPM_TAG_RIM_CERTIFICATE)
return TPM_BAD_PARAMETER;
/* 2 */
debug("rimKeyHandle = %08x", rimKeyHandle);
rimKey = mtm_get_key(rimKeyHandle);
if (rimKey == NULL) return TPM_KEYNOTFOUND;
/* 3 */
if ((rimKey->usageFlags & TPM_VERIFICATION_KEY_USAGE_SIGN_RIMCERT) == 0
||(rimKey->usageFlags & TPM_VERIFICATION_KEY_USAGE_INCREMENT_BOOTSTRAP) == 0)
return TPM_INVALID_KEYUSAGE;
/* 4 */
if (rimCert->parentId != rimKey->myId) return TPM_AUTHFAIL;
/* 5 */
res = verify_rim_certificate(rimCert);
if (res != TPM_SUCCESS) return res;
/* 6 */
if (rimCert->referenceCounter.counterSelection > MTM_COUNTER_SELECT_MAX)
return TPM_BAD_COUNTER;
/* 7 */
if (rimCert->referenceCounter.counterSelection == MTM_COUNTER_SELECT_BOOTSTRAP) {
if (rimCert->referenceCounter.counterValue
< tpmData.permanent.data.counters[MTM_COUNTER_SELECT_BOOTSTRAP].counter)
return TPM_BAD_COUNTER;
tpmData.permanent.data.counters[MTM_COUNTER_SELECT_BOOTSTRAP].counter
= rimCert->referenceCounter.counterValue;
}
return TPM_SUCCESS;
}
TPM_RESULT MTM_SetVerifiedPCRSelection(TPM_PCR_SELECTION *verifiedSelection,
TPM_AUTH *auth1)
{
int i;
TPM_RESULT res;
info("MTM_SetVerifiedPCRSelection()");
/* verify permission */
if (tpmData.permanent.flags.owned) {
res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
} else {
res = FALSE;
}
if (!res && !mtmData.stany.flags.loadVerificationRootKeyEnabled) {
return TPM_FAIL;
}
/* echeck if a localityModifier is set */
for (i = 0; i < TPM_NUM_PCR; i++) {
if (verifiedSelection->pcrSelect[i >> 3] & (1 << (i & 7))) {
if (tpmData.permanent.data.pcrAttrib[i].pcrResetLocal) return TPM_FAIL;
}
}
/* copy selection */
memcpy(&mtmData.permanent.data.verifiedPCRs,
verifiedSelection, sizeof(TPM_PCR_SELECTION));
return TPM_SUCCESS;
}
================================================
FILE: tddl/CMakeLists.txt
================================================
# Software-based Trusted Platform Module (TPM) Emulator
# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
#
# $Id: CMakeLists.txt 455 2010-09-17 18:34:04Z mast $
set(tddl-tpm-emulator_SRCS "tddl.c" "tddl-tpm-emulator.h")
add_library(tddl-tpm-emulator SHARED ${tddl-tpm-emulator_SRCS})
add_library(tddl-tpm-emulator_static STATIC ${tddl-tpm-emulator_SRCS})
if(UNIX)
set_target_properties(tddl-tpm-emulator PROPERTIES SOVERSION "1.2"
VERSION "1.2.${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}")
set_target_properties(tddl-tpm-emulator_static PROPERTIES OUTPUT_NAME tddl-tpm-emulator)
elseif(WIN32)
set_target_properties(tddl-tpm-emulator PROPERTIES OUTPUT_NAME ifxtpm)
set_target_properties(tddl-tpm-emulator PROPERTIES PREFIX "")
endif()
install(TARGETS tddl-tpm-emulator DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS tddl-tpm-emulator_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES "tddl-tpm-emulator.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(test_tddl test_tddl.c)
target_link_libraries(test_tddl tddl-tpm-emulator_static)
================================================
FILE: tddl/tddl-tpm-emulator.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: tddl.h 364 2010-02-11 10:24:45Z mast $
*/
#ifndef _TDDL_H_
#define _TDDL_H_
#include <stdint.h>
/*
* The following types and functions are specified in the
* TCPA Software Stack (TSS) Specification [TSS_Spec].
*/
/*
* Basic Data Types
*/
typedef uint8_t BYTE;
typedef uint8_t TSS_BOOL;
typedef uint32_t UINT32;
typedef uint32_t TSS_RESULT;
/*
* TDDL Return Codes
*/
#define TSS_E_BASE 0x00000000
#define TDDL_SUCCESS (TSS_E_BASE + 0x00)
#define TDDL_E_FAIL (TSS_E_BASE + 0x02)
#define TDDL_E_BAD_PARAMETER (TSS_E_BASE + 0x03)
#define TDDL_E_NOTIMPL (TSS_E_BASE + 0x06)
#define TDDL_E_TIMEOUT (TSS_E_BASE + 0x12)
#define TDDL_E_ALREADY_OPENED (TSS_E_BASE + 0x81)
#define TDDL_E_ALREADY_CLOSED (TSS_E_BASE + 0x82)
#define TDDL_E_INSUFFICIENT_BUFFER (TSS_E_BASE + 0x83)
#define TDDL_E_COMMAND_COMPLETED (TSS_E_BASE + 0x84)
#define TDDL_E_COMMAND_ABORTED (TSS_E_BASE + 0x85)
#define TDDL_E_IOERROR (TSS_E_BASE + 0x87)
#define TDDL_E_BADTAG (TSS_E_BASE + 0x88)
#define TDDL_E_COMPONENT_NOT_FOUND (TSS_E_BASE + 0x89)
/*
* Capability Flag Definitions
*/
#define TDDL_CAP_VERSION 0x0100
#define TDDL_CAP_VER_DRV 0x0101
#define TDDL_CAP_VER_FW 0x0102
#define TDDL_CAP_VER_FW_DATE 0x0103
#define TDDL_CAP_PROPERTY 0x0200
#define TDDL_CAP_PROP_MANUFACTURER 0x0201
#define TDDL_CAP_PROP_MODULE_TYPE 0x0202
#define TDDL_CAP_PROP_GLOBAL_STATE 0x0203
/*
* Driver and Device Status Codes
*/
#define TDDL_DRIVER_STATUS 0x0010
#define TDDL_DRIVER_OK 0x0010
#define TDDL_DRIVER_FAILED 0x0011
#define TDDL_DRIVER_NOT_OPENED 0x0012
#define TDDL_DEVICE_STATUS 0x0020
#define TDDL_DEVICE_OK 0x0020
#define TDDL_DEVICE_UNRECOVERABLE 0x0021
#define TDDL_DEVICE_RECOVERABLE 0x0022
#define TDDL_DEVICE_NOT_FOUND 0x0023
/*
* TDDL Interface Functions
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Tddli_Open - establish a connection to the TPM device driver
*
* This function establishes a connection with the TPM device driver. The
* application utilizing the TPM DDL is guaranteed to have exclusive access
* to the TPM device. This function must be called before calling GetStatus,
* GetCapability, SetCapability, or TransmitData.
*/
TSS_RESULT Tddli_Open(void);
/**
* Tddli_Close - close a open connection to the TPM device driver
*
* This function closes a connection with the TPM device driver. Following
* a successful response to this function, the TPM device driver can clean
* up any resources used to maintain a connection with the TPM device driver
* library.
*/
TSS_RESULT Tddli_Close(void);
/**
* Tddli_Cancel - cancels the last outstanding TPM command
*
* This function cancels an outstanding TPM command. An application can call
* this function, in a separate context, to interrupt a TPM command that has
* not completed. The TPM device driver must acknowledge this function if
* it has not returned from a previous TPM command and return
* TDDL_COMMAND_ABORTED for the call in process.
*/
TSS_RESULT Tddli_Cancel(void);
/**
* Tddli_GetCapability - read the attributes returned by the TPM
*
* @CapArea: [in] Partition of capabilities to be interrogated.
* @SubCap: [in] Subcode of the requested capabilities.
* @pCapBuf: [out] Pointer to a buffer containing the received attribute data.
* @puntCapBufLen: [in] Size of the receive buffer in bytes.
[out] Number of written bytes.
*
* This function queries the TPM hardware, firmware and device driver
* attributes such as firmware version, driver version, etc.
*/
TSS_RESULT Tddli_GetCapability(UINT32 CapArea, UINT32 SubCap,
BYTE* pCapBuf, UINT32* puntCapBufLen);
/**
* Tddli_SetCapability - set parameters to the TPM
*
* @CapArea: [in] Partition of capabilities to be set.
* @SubCap: [in] Subcode of the capabilities to be set.
* @pCapBuf: [in] Pointer to a buffer containing the capability data to set.
* @puntCapBufLen: [in] Size of the request buffer in bytes.
*
* This function sets parameters in the TPM hardware, firmware and device
* driver attributes. An application can set TPM device driver and operating
* parameters that may be defined by the TPM vendor. For now, the parameter
* definitions are vendor-defined.
*/
TSS_RESULT Tddli_SetCapability(UINT32 CapArea, UINT32 SubCap,
BYTE* pCapBuf, UINT32* puntCapBufLen);
/**
* Tddli_GetStatus - get status of the TPM driver and device TDDLI
*
* @ReqStatusType: [in] Requested type of status information.
* @puntStatus: [out] Requested status.
*
* This function queries the status the TPM driver and device. An application
* can determine the health of the TPM subsystem by utilizing this function.
*/
TSS_RESULT Tddli_GetStatus(UINT32 ReqStatusType, UINT32* puntStatus);
/**
* Tddli_TransmitData - send any data to the TPM module TDDLI
*
* @pTransmitBuf: [in] Pointer to a buffer containing TPM transmit data.
* @TransmitBufLen: [in] Size of TPM transmit data in bytes.
* @pReceiveBuf: [out] Pointer to a buffer containing TPM receive data
* @puntReceiveBufLen: [in] Size of TPM receive buffer in bytes.
* [out] Number of written bytes.
*
* The function sends a TPM command directly to a TPM device driver, causing
* the TPM to perform the corresponding operation.
*/
TSS_RESULT Tddli_TransmitData(BYTE* pTransmitBuf, UINT32 TransmitBufLen,
BYTE* pReceiveBuf, UINT32* puntReceiveBufLen);
/**
* Tddli_SetPowerManagement - sets and queries the TPM's power states
*
* @SendSaveStateCommand: [in]
* @QuerySetNewTPMPowerState: [in]
* [out]
*
* This function sets and queries the TPM’s power states.
*/
TSS_RESULT Tddli_SetPowerManagement(TSS_BOOL SendSaveStateCommand,
UINT32 *QuerySetNewTPMPowerState);
/**
* Tddli_PowerManagementControl - gets and sets the power state management
*
* @SendPowerManager: [in]
* @DriverManagesPowerStates: [out]
*
* This command determines and sets which component, TCS or the Driver,
* receives and handles the platform’s OS power state management signals.
*/
TSS_RESULT Tddli_PowerManagementControl(TSS_BOOL SendPowerManager,
UINT32 DriverManagesPowerStates);
#ifdef __cplusplus
}
#endif
#endif /* _TDDL_H_ */
================================================
FILE: tddl/tddl.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: tddl.c 364 2010-02-11 10:24:45Z mast $
*/
#include <unistd.h>
#include <string.h>
#include <config.h>
#include "tddl-tpm-emulator.h"
/* device and socket names */
static const char *tpm_device_name = TPM_DEVICE_NAME;
static const char *tpmd_socket_name = TPM_SOCKET_NAME;
/* TPM device handle */
static int tddli_dh = -1;
/* status of the TPM device driver and the TPM itself */
static TSS_RESULT tddli_driver_status = TDDL_DRIVER_FAILED;
static TSS_RESULT tddli_device_status = TDDL_DEVICE_NOT_FOUND;
#if defined(_WIN32) || defined(_WIN64)
#include "tddl_windows.h"
#else
#include "tddl_unix.h"
#endif
TSS_RESULT Tddli_Open()
{
TSS_RESULT res;
tddli_mutex_lock(&tddli_lock);
if (tddli_dh != -1) {
res = TDDL_E_ALREADY_OPENED;
} else {
res = open_socket(tpmd_socket_name);
if (res != TDDL_SUCCESS) {
res = open_device(tpm_device_name);
}
}
tddli_mutex_unlock(&tddli_lock);
return res;
}
TSS_RESULT Tddli_Close()
{
TSS_RESULT res = TDDL_SUCCESS;
tddli_mutex_lock(&tddli_lock);
if (tddli_dh >= 0) {
close(tddli_dh);
tddli_dh = -1;
} else {
res = TDDL_E_ALREADY_CLOSED;
}
tddli_mutex_unlock(&tddli_lock);
return res;
}
TSS_RESULT Tddli_Cancel()
{
/* this is not supported by the TPM emulator */
return TDDL_E_NOTIMPL;
}
static TSS_RESULT send_to_tpm(BYTE* pTransmitBuf, UINT32 TransmitBufLen)
{
ssize_t res;
res = write(tddli_dh, pTransmitBuf, TransmitBufLen);
if (res < 0 || (UINT32)res != TransmitBufLen) return TDDL_E_IOERROR;
return TDDL_SUCCESS;
}
static TSS_RESULT receive_from_tpm(BYTE* pReceiveBuf, UINT32* puntReceiveBufLen)
{
ssize_t res;
uint32_t len;
if (*puntReceiveBufLen < 10) return TDDL_E_INSUFFICIENT_BUFFER;
res = read(tddli_dh, pReceiveBuf, *puntReceiveBufLen);
if (res < 10) return TDDL_E_IOERROR;
*puntReceiveBufLen = res;
len = ((uint32_t)pReceiveBuf[2] << 24) | ((uint32_t)pReceiveBuf[3] << 16)
| ((uint32_t)pReceiveBuf[4] << 8) | (uint32_t)pReceiveBuf[5];
if (len != *puntReceiveBufLen) return TDDL_E_INSUFFICIENT_BUFFER;
return TDDL_SUCCESS;
}
TSS_RESULT Tddli_TransmitData(BYTE* pTransmitBuf, UINT32 TransmitBufLen,
BYTE* pReceiveBuf, UINT32* puntReceiveBufLen)
{
TSS_RESULT res;
tddli_mutex_lock(&tddli_lock);
if (tddli_dh >= 0) {
res = send_to_tpm(pTransmitBuf, TransmitBufLen);
if (res == TDDL_SUCCESS)
res = receive_from_tpm(pReceiveBuf, puntReceiveBufLen);
} else {
res = TDDL_E_FAIL;
}
tddli_mutex_unlock(&tddli_lock);
return res;
}
static TSS_RESULT cap_version(UINT32 SubCap, BYTE* pCapBuf,
UINT32* puntCapBufLen)
{
TSS_RESULT res;
UINT32 len = 18;
BYTE buf[18];
switch (SubCap) {
case TDDL_CAP_VER_DRV:
if (*puntCapBufLen < 4) return TDDL_E_INSUFFICIENT_BUFFER;
*puntCapBufLen = 4;
memcpy(pCapBuf, "\x01\x05\x00\x00", 4);
return TDDL_SUCCESS;
case TDDL_CAP_VER_FW:
if (*puntCapBufLen < 4) return TDDL_E_INSUFFICIENT_BUFFER;
*puntCapBufLen = 4;
res = send_to_tpm((uint8_t*)"\x00\xc1\x00\x00\x00\x12\x00\x00\x00\x65"
"\x00\x00\x00\x06\x00\x00\x00\x00", 18);
if (res != TDDL_SUCCESS) return res;
res = receive_from_tpm(buf, &len);
if (res != TDDL_SUCCESS) return res;
if (len != 18 || (buf[6] | buf[7] | buf[8] | buf[9]) != 0) return TDDL_E_FAIL;
memcpy(pCapBuf, &buf[14], 4);
return TDDL_SUCCESS;
case TDDL_CAP_VER_FW_DATE:
/* this is not yet supported by the TPM emulator */
return TDDL_E_NOTIMPL;
default:
return TDDL_E_BAD_PARAMETER;
}
}
static TSS_RESULT cap_property(UINT32 SubCap, BYTE* pCapBuf,
UINT32* puntCapBufLen)
{
static const char *manufacturer = "Mario Strasser, ETH Zurich";
static const char *type = "Software-based TPM Emulator";
switch (SubCap) {
case TDDL_CAP_PROP_MANUFACTURER:
if (*puntCapBufLen < strlen(manufacturer))
return TDDL_E_INSUFFICIENT_BUFFER;
*puntCapBufLen = strlen(manufacturer);
memcpy(pCapBuf, manufacturer, *puntCapBufLen);
return TDDL_SUCCESS;
case TDDL_CAP_PROP_MODULE_TYPE:
if (*puntCapBufLen < strlen(type)) return TDDL_E_INSUFFICIENT_BUFFER;
*puntCapBufLen = strlen(type);
memcpy(pCapBuf, type, *puntCapBufLen);
return TDDL_SUCCESS;
default:
return TDDL_E_BAD_PARAMETER;
}
}
TSS_RESULT Tddli_GetCapability(UINT32 CapArea, UINT32 SubCap,
BYTE* pCapBuf, UINT32* puntCapBufLen)
{
TSS_RESULT res = TDDL_SUCCESS;
if (tddli_dh < 0) return TDDL_E_FAIL;
tddli_mutex_lock(&tddli_lock);
switch (CapArea) {
case TDDL_CAP_VERSION:
res = cap_version(SubCap, pCapBuf, puntCapBufLen);
break;
case TDDL_CAP_PROPERTY:
res = cap_property(SubCap, pCapBuf, puntCapBufLen);
break;
default:
res = TDDL_E_BAD_PARAMETER;
}
tddli_mutex_unlock(&tddli_lock);
return res;
}
TSS_RESULT Tddli_SetCapability(UINT32 CapArea, UINT32 SubCap,
BYTE* pCapBuf, UINT32* puntCapBufLen)
{
/* no vendor-specific capabilities available, yet */
return TDDL_E_BAD_PARAMETER;
}
TSS_RESULT Tddli_GetStatus(UINT32 ReqStatusType, UINT32* puntStatus)
{
TSS_RESULT res = TDDL_SUCCESS;
tddli_mutex_lock(&tddli_lock);
switch (ReqStatusType) {
case TDDL_DRIVER_STATUS:
*puntStatus = tddli_driver_status;
break;
case TDDL_DEVICE_STATUS:
*puntStatus = tddli_device_status;
break;
default:
res = TDDL_E_BAD_PARAMETER;
}
tddli_mutex_unlock(&tddli_lock);
return res;
}
TSS_RESULT Tddli_SetPowerManagement(TSS_BOOL SendSaveStateCommand,
UINT32 *QuerySetNewTPMPowerState)
{
return TDDL_E_NOTIMPL;
}
TSS_RESULT Tddli_PowerManagementControl(TSS_BOOL SendPowerManager,
UINT32 DriverManagesPowerStates)
{
return TDDL_E_NOTIMPL;
}
/*
* Export also TDDL_* function aliases as they are
* used by some non standard-conform applications.
*/
TSS_RESULT TDDL_Open()
{
return Tddli_Open();
}
TSS_RESULT TDDL_Close()
{
return Tddli_Close();
}
TSS_RESULT TDDL_Cancel()
{
return Tddli_Cancel();
}
TSS_RESULT TDDL_TransmitData(BYTE* pTransmitBuf, UINT32 TransmitBufLen,
BYTE* pReceiveBuf, UINT32* puntReceiveBufLen)
{
return Tddli_TransmitData(pTransmitBuf, TransmitBufLen,
pReceiveBuf, puntReceiveBufLen);
}
TSS_RESULT TDDL_GetCapability(UINT32 CapArea, UINT32 SubCap,
BYTE* pCapBuf, UINT32* puntCapBufLen)
{
return Tddli_GetCapability(CapArea, SubCap, pCapBuf, puntCapBufLen);
}
TSS_RESULT TDDL_SetCapability(UINT32 CapArea, UINT32 SubCap,
BYTE* pCapBuf, UINT32* puntCapBufLen)
{
return Tddli_SetCapability(CapArea, SubCap, pCapBuf, puntCapBufLen);
}
TSS_RESULT TDDL_GetStatus(UINT32 ReqStatusType, UINT32* puntStatus)
{
return Tddli_GetStatus(ReqStatusType, puntStatus);
}
TSS_RESULT TDDL_SetPowerManagement(TSS_BOOL SendSaveStateCommand,
UINT32 *QuerySetNewTPMPowerState)
{
return Tddli_SetPowerManagement(SendSaveStateCommand, QuerySetNewTPMPowerState);
}
TSS_RESULT TDDL_PowerManagementControl(TSS_BOOL SendPowerManager,
UINT32 DriverManagesPowerStates)
{
return Tddli_PowerManagementControl(SendPowerManager, DriverManagesPowerStates);
}
================================================
FILE: tddl/tddl_unix.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: tddl.c 364 2010-02-11 10:24:45Z mast $
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
/* library lock */
static pthread_mutex_t tddli_lock = PTHREAD_MUTEX_INITIALIZER;
#define tddli_mutex_lock(a) pthread_mutex_lock(a)
#define tddli_mutex_unlock(a) pthread_mutex_unlock(a)
static TSS_RESULT open_device(const char *device_name)
{
tddli_dh = open(device_name, O_RDWR);
if (tddli_dh < 0) {
if (errno == ENOENT || errno == ENXIO) {
tddli_driver_status = TDDL_DRIVER_FAILED;
tddli_device_status = TDDL_DEVICE_NOT_FOUND;
} else {
tddli_driver_status = TDDL_DRIVER_NOT_OPENED;
tddli_device_status = TDDL_DEVICE_RECOVERABLE;
}
return TDDL_E_FAIL;
} else {
tddli_driver_status = TDDL_DRIVER_OK;
tddli_device_status = TDDL_DEVICE_OK;
return TDDL_SUCCESS;
}
}
static TSS_RESULT open_socket(const char *socket_name)
{
struct sockaddr_un addr;
tddli_dh = socket(AF_UNIX, SOCK_STREAM, 0);
if (tddli_dh < 0) {
tddli_driver_status = TDDL_DRIVER_FAILED;
tddli_device_status = TDDL_DEVICE_NOT_FOUND;
return TDDL_E_FAIL;
}
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, socket_name, sizeof(addr.sun_path)-1);
if (connect(tddli_dh, (struct sockaddr*)&addr, sizeof(struct sockaddr_un)) < 0) {
tddli_driver_status = TDDL_DRIVER_FAILED;
tddli_device_status = TDDL_DEVICE_NOT_FOUND;
return TDDL_E_FAIL;
}
tddli_driver_status = TDDL_DRIVER_OK;
tddli_device_status = TDDL_DEVICE_OK;
return TDDL_SUCCESS;
}
================================================
FILE: tddl/tddl_windows.h
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: tddl.c 364 2010-02-11 10:24:45Z mast $
*/
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <windows.h>
#include <config.h>
#include "tddl.h"
/* library lock */
static CRITICAL_SECTION tddli_lock;
#define tddli_mutex_lock(a) EnterCriticalSection(a)
#define tddli_mutex_unlock(a) LeaveCriticalSection(a)
BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved)
{
switch(reason) {
case DLL_PROCESS_ATTACH:
InitializeCriticalSection(&tddli_lock);
break;
case DLL_PROCESS_DETACH:
DeleteCriticalSection(&tddli_lock);
break;
default:
break;
}
return TRUE;
}
static TSS_RESULT open_device(const char *device_name)
{
/* open the named pipe and generate a posix file handle */
DWORD mode = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE;
HANDLE ph = CreateFile(device_name, GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
SetNamedPipeHandleState(ph, &mode, NULL, NULL);
tddli_dh = _open_osfhandle((DWORD)ph, O_RDWR | O_BINARY);
if (tddli_dh < 0) {
if (errno == ENOENT || errno == ENXIO) {
tddli_driver_status = TDDL_DRIVER_FAILED;
tddli_device_status = TDDL_DEVICE_NOT_FOUND;
} else {
tddli_driver_status = TDDL_DRIVER_NOT_OPENED;
tddli_device_status = TDDL_DEVICE_RECOVERABLE;
}
return TDDL_E_FAIL;
} else {
tddli_driver_status = TDDL_DRIVER_OK;
tddli_device_status = TDDL_DEVICE_OK;
return TDDL_SUCCESS;
}
}
static TSS_RESULT open_socket(const char *socket_name)
{
return TDDL_E_FAIL;
}
================================================
FILE: tddl/test_tddl.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: test_tddl.c 364 2010-02-11 10:24:45Z mast $
*/
#include <stdio.h>
#include <tddl-tpm-emulator.h>
const char *get_error(TSS_RESULT res)
{
switch (res) {
case TDDL_SUCCESS:
return "success";
case TDDL_E_FAIL:
return "operation failed";
case TDDL_E_BAD_PARAMETER:
return "bad patameter";
case TDDL_E_TIMEOUT:
return "timeout";
case TDDL_E_ALREADY_OPENED:
return "already opened";
case TDDL_E_ALREADY_CLOSED:
return "already closed";
case TDDL_E_INSUFFICIENT_BUFFER:
return "insufficient buffer";
case TDDL_E_COMMAND_COMPLETED:
return "comand completed";
case TDDL_E_COMMAND_ABORTED:
return "command aborted";
case TDDL_E_IOERROR:
return "IO error";
case TDDL_E_BADTAG:
return "bad tag";
case TDDL_E_COMPONENT_NOT_FOUND:
return "component not found";
default:
return "unknown error";
}
}
const char *get_status(UINT32 status)
{
switch (status) {
case TDDL_DRIVER_OK: return "DRIVER OK";
case TDDL_DRIVER_FAILED: return "DRIVER FAILED";
case TDDL_DRIVER_NOT_OPENED: return "DRIVER NOT OPENED";
case TDDL_DEVICE_OK: return "DEVICE OK";
case TDDL_DEVICE_UNRECOVERABLE: return "DEVICE UNRECOVERABLE";
case TDDL_DEVICE_RECOVERABLE: return "DEVICE RECOVERABLE";
case TDDL_DEVICE_NOT_FOUND: return "DEVICE NOT FOUND";
default: return "";
}
}
int main()
{
TSS_RESULT res;
UINT32 status;
BYTE buf[256];
UINT32 buf_size = sizeof(buf);
BYTE reset[] = {0, 193, 0, 0, 0, 10, 0, 0, 0, 90};
unsigned int i;
res = Tddli_Open();
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_Open() failed: %s (%04x)\n", get_error(res), res);
return -1;
}
/* get driver and device status */
res = Tddli_GetStatus(TDDL_DRIVER_STATUS, &status);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_GetStatus() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
printf("Driver status: %s\n", get_status(status));
res = Tddli_GetStatus(TDDL_DEVICE_STATUS, &status);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_GetStatus() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
printf("Device status: %s\n", get_status(status));
/* get version */
buf_size = sizeof(buf);
res = Tddli_GetCapability(TDDL_CAP_VERSION, TDDL_CAP_VER_DRV, buf, &buf_size);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_GetCapability() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
printf("DRV version: %d.%d.%d.%d\n", buf[0], buf[1], buf[2], buf[3]);
buf_size = sizeof(buf);
res = Tddli_GetCapability(TDDL_CAP_VERSION, TDDL_CAP_VER_FW, buf, &buf_size);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_GetCapability() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
printf("TPM Version: %d.%d.%d.%d\n", buf[0], buf[1], buf[2], buf[3]);
/* get properties */
buf_size = sizeof(buf);
res = Tddli_GetCapability(TDDL_CAP_PROPERTY, TDDL_CAP_PROP_MANUFACTURER, buf, &buf_size);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_GetCapability() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
buf[buf_size] = 0;
printf("Manufacturer: %s\n", buf);
buf_size = sizeof(buf);
res = Tddli_GetCapability(TDDL_CAP_PROPERTY, TDDL_CAP_PROP_MODULE_TYPE, buf, &buf_size);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_GetCapability() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
buf[buf_size] = 0;
printf("Module type: %s\n", buf);
/* reset tpm */
printf("Transmit: ");
for (i = 0; i < sizeof(reset); i++) printf("%02x ", reset[i]);
printf("\n");
buf_size = sizeof(buf);
res = Tddli_TransmitData(reset, sizeof(reset), buf, &buf_size);
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_TransmitData() failed: %s (%04x)\n", get_error(res), res);
Tddli_Close();
return -1;
}
printf("Result: ");
for (i = 0; i < buf_size; i++) printf("%02x ", buf[i]);
printf("\n");
res = Tddli_Close();
if (res != TDDL_SUCCESS) {
printf("Error: Tddli_Close() failed: %s (%04x)\n", get_error(res), res);
return -1;
}
return 0;
}
================================================
FILE: tpm/CMakeLists.txt
================================================
# Software-based Trusted Platform Module (TPM) Emulator
# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
#
# $Id: CMakeLists.txt 364 2010-02-11 10:24:45Z mast $
file(GLOB tpm_SRCS "*.[h|c]")
add_library(tpm STATIC ${tpm_SRCS})
================================================
FILE: tpm/tpm_audit.c
================================================
/* Software-based Trusted Platform Module (TPM) Emulator
* Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* $Id: tpm_audit.c 385 2010-02-17 15:41:28Z mast $
*/
#include "tpm_emulator.h"
#include "tpm_commands.h"
#include "tpm_data.h"
#include "tpm_marshalling.h"
#include "tpm_handles.h"
#include <crypto/sha1.h>
/*
* Auditing ([TPM_Part3], Section 8)
* The TPM generates an audit event in response to the TPM executing a
* function that has the audit flag set to TRUE for that function. The
* TPM maintains an extended value for all audited operations.
*/
#define AUDIT_STATUS tpmData.permanent.data.ordinalAuditStatus
void tpm_audit_request(TPM_COMMAND_CODE ordinal, TPM_REQUEST *req)
{
tpm_sha1_ctx_t sha1_ctx;
BYTE buf[sizeof_TPM_AUDIT_EVENT_IN(x)], *ptr;
UINT32 len;
TPM_COMMAND_CODE ord = ordinal & TPM_ORD_INDEX_MASK;
if (ord < TPM_ORD_MAX
&& (AUDIT_STATUS[ord / 8] & (1 << (ord & 0x07)))) {
info("tpm_audit_request()");
/* is there already an audit session running? */
if (!tpmData.stany.data.auditSession) {
tpmData.stany.data.auditSession = TRUE;
tpmData.permanent.data.auditMonotonicCounter++;
}
/* update audit digest */
ptr = buf; len = sizeof(buf);
tpm_marshal_TPM_TAG(&ptr, &len, TPM_TAG_AUDIT_EVENT_IN);
tpm_marshal_TPM_COMMAND_CODE(&ptr, &len, ordinal);
tpm_sha1_init(&sha1_ctx);
tpm_sha1_update(&sha1_ctx, req->param, req->paramSize);
tpm_sha1_final(&sha1_ctx, ptr);
ptr += 20; len -= 20;
tpm_marshal_TPM_TAG(&ptr, &len, TPM_TAG_COUNTER_VALUE);
tpm_marshal_UINT32(&ptr, &len, 0);
tpm_marshal_UINT32(&ptr, &len, tpmData.permanent.data.auditMonotonicCounter);
tpm_sha1_init(&sha1_ctx);
tpm_sha1_update(&sha1_ctx, tpmData.stany.data.auditDigest.digest, sizeof(TPM_DIGEST));
tpm_sha1_update(&sha1_ctx, buf, sizeof(buf));
tpm_sha1_final(&sha1_ctx, tpmData.stany.data.auditDigest.digest);
}
}
void tpm_audit_response(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp)
{
tpm_sha1_ctx_t sha1_ctx;
BYTE buf[sizeof_TPM_AUDIT_EVENT_OUT(x)], *ptr;
UINT32 len;
TPM_COMMAND_CODE ord = ordinal & TPM_ORD_INDEX_MASK;
if (ord < TPM_ORD_MAX
&& (AUDIT_STATUS[ord / 8] & (1 << (ord & 0x07)))) {
info("tpm_audit_response()");
/* update audit digest */
ptr = buf; len = sizeof(buf);
tpm_marshal_TPM_TAG(&ptr, &len, TPM_TAG_AUDIT_EVENT_OUT);
tpm_marshal_TPM_COMMAND_CODE(&ptr, &len, ordinal);
tpm_sha1_init(&sha1_ctx);
tpm_sha1_update(&sha1_ctx, rsp->param, rsp->paramSize);
tpm_sha1_final(&sha1_ctx, ptr);
ptr += 20; len -= 20;
tpm_marshal_TPM_TAG(&ptr, &len, TPM_TAG_COUNTER_VALUE);
tpm_marshal_UINT32(&ptr, &len, 0);
tpm_marshal_UINT32(&ptr, &len, tpmData.permanent.data.auditMonotonicCounter);
tpm_marshal_TPM_RESULT(&ptr, &len, rsp->result);
tpm_sha1_init(&sha1_ctx);
tpm_sha1_update(&sha1_ctx, tpmData.stany.data.auditDigest.digest, sizeof(TPM_DIGEST));
tpm_sha1_update(&sha1_ctx, buf, sizeof(buf));
tpm_sha1_final(&sha1_ctx, tpmData.stany.data.auditDigest.digest);
}
}
/* number of bits to represent 0, 1, 2, 3 ... */
static uint8_t bits[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
TPM_RESULT TPM_GetAuditDigest(UINT32 startOrdinal,
TPM_COUNTER_VALUE *counterValue,
TPM_DIGEST *auditDigest, BOOL *more,
UINT32 *ordSize, UINT32 **ordList)
{
UINT32 i, j, len, *ptr;
info("TPM_GetAuditDigest()");
/* compute (maximal) size of the ordinal list */
for (len = 0, i = startOrdinal/8; i < TPM_ORD_MAX/8; i++) {
len += bits[AUDIT_STATUS[i] & 0x0f];
len += bits[(AUDIT_STATUS[i] >> 4) & 0x0f];
}
/* setup ordinal list */
ptr = *ordList = tpm_malloc(len);
if (ptr == NULL) return TPM_FAIL;
for (*ordSize = 0, i = startOrdinal/8; i < TPM_ORD_MAX/8; i++) {
if (AUDIT_STATUS[i]) for (j = 0; j < 8; j++) {
if ((AUDIT_STATUS[i] & (1 << j)) && i * 8 + j > startOrdinal) {
*ptr++ = i * 8 + j;
*ordSize += 4;
}
}
}
counterValue->tag = TPM_TAG_COUNTER_VALUE;
memset(counterValue->label, 0, sizeof(counterValue->label));
counterValue->counter = tpmData.permanent.data.auditMonotonicCounter;
memcpy(auditDigest, &tpmData.stany.data.auditDigest, sizeof(TPM_DIGEST));
if (more != NULL) *more = FALSE;
return TPM_SUCCESS;
}
TPM_RESULT TPM_GetAuditDigestSigned(TPM_KEY_HANDLE keyHandle,
BOOL closeAudit, TPM_NONCE *antiReplay,
TPM_AUTH *auth1,
TPM_COUNTER_VALUE *counterValue,
TPM_DIGEST *auditDigest,
TPM_DIGEST *ordinalDigest,
UINT32 *sigSize, BYTE **sig)
{
TPM_RESULT res;
TPM_KEY_DATA *key;
UINT32 ordSize;
UINT32 *ordList;
BYTE buf[TPM_ORD_MAX * 4];
BYTE *ptr;
UINT32 len;
tpm_sha1_ctx_t ctx;
info("TPM_GetAuditDigestSigned()");
/* get key */
key = tpm_get_key(keyHandle);
if (key == NULL) return TPM_INVALID_KEYHANDLE;
if (key->keyUsage != TPM_KEY_SIGNING && key->keyUsage != TPM_KEY_IDENTITY
&& key->keyUsage != TPM_KEY_LEGACY) return TPM_INVALID_KEYUSAGE;
/* verify authorization */
if (auth1->authHandle != TPM_INVALID_HANDLE
|| key->authDataUsage != TPM_AUTH_NEVER) {
res = tpm_verify_auth(auth1, key->usageAuth, keyHandle);
if (res != TPM_SUCCESS) return res;
}
/* get audit digest */
res = TPM_GetAuditDigest(0, counterValue, auditDigest, NULL,
&ordSize, &ordList);
if (res != TPM_SUCCESS) return res;
/* allocate buffer memory */
len = sizeof(buf);
ptr = buf;
if (tpm_marshal_UINT32_ARRAY(&ptr, &len, ordList, ordSize/4) != 0) {
debug("tpm_marshal_UINT32_ARRAY() failed.");
tpm_free(ordList);
return TPM_FAIL;
}
tpm_free(ordList);
/* compute ordinal digest */
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, buf, ordSize);
tpm_sha1_final(&ctx, ordinalDigest->digest);
/* setup a TPM_SIGN_INFO structure */
memset(buf, 0, sizeof(buf));
memcpy(&buf[0], "\x00\x05", 2);
memcpy(&buf[2], "ADIG", 4);
memcpy(&buf[6], antiReplay->nonce, 20);
len = sizeof(buf) - 26;
ptr = &buf[26];
if (tpm_marshal_UINT32(&ptr, &len,
20 + sizeof_TPM_COUNTER_VALUE((*counterValue)) + 20) != 0) {
debug("tpm_marshal_UINT32() failed.");
return TPM_FAIL;
}
memcpy(ptr, auditDigest->digest, 20);
len -= 20;
ptr += 20;
if (tpm_marshal_TPM_COUNTER_VALUE(&ptr, &len, counterValue) != 0) {
debug("tpm_marshal_TPM_COUNTER_VALUE() failed.");
return TPM_FAIL;
}
memcpy(ptr, ordinalDigest->digest, 20);
/* check key usage */
if (closeAudit) {
if (key->keyUsage == TPM_KEY_IDENTITY) {
memset(&tpmData.stany.data.auditDigest, 0, sizeof(TPM_DIGEST));
} else {
return TPM_INVALID_KEYUSAGE;
}
}
/* sign data */
if (key->sigScheme == TPM_SS_RSASSAPKCS1v15_SHA1) {
debug("TPM_SS_RSASSAPKCS1v15_SHA1");
len = 30 + 20 + sizeof_TPM_COUNTER_VALUE((*counterValue)) + 20;
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, buf, len);
tpm_sha1_final(&ctx, buf);
res = tpm_sign(key, auth1, FALSE, buf, SHA1_DIGEST_LENGTH, sig, sigSize);
} else if (key->sigScheme == TPM_SS_RSASSAPKCS1v15_INFO) {
debug("TPM_SS_RSASSAPKCS1v15_INFO");
res = tpm_sign(key, auth1, TRUE, buf, sizeof(buf), sig, sigSize);
} else {
debug("unsupported signature scheme: %02x", key->sigScheme);
res = TPM_INVALID_KEYUSAGE;
}
return res;
}
TPM_RESULT TPM_SetOrdinalAuditStatus(TPM_COMMAND_CODE ordinalToAudit,
BOOL auditState, TPM_AUTH *auth1)
{
TPM_RESULT res;
info("TPM_SetOrdinalAuditStatus()");
/* verify authorization */
res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
if (res != TPM_SUCCESS) return r
gitextract_w5yjmm2s/
├── .gitignore
├── .travis.yml
├── AUTHORS
├── CMakeLists.txt
├── ChangeLog
├── LICENSE
├── README
├── build.bat
├── build.sh
├── config.h.in
├── crypto/
│ ├── CMakeLists.txt
│ ├── bn.h
│ ├── bn_gmp.c
│ ├── bn_openssl.c
│ ├── hmac.c
│ ├── hmac.h
│ ├── rc4.c
│ ├── rc4.h
│ ├── rsa.c
│ ├── rsa.h
│ ├── sha1.c
│ └── sha1.h
├── mtm/
│ ├── CMakeLists.txt
│ ├── mtm_capability.c
│ ├── mtm_cmd_handler.c
│ ├── mtm_commands.h
│ ├── mtm_counter.c
│ ├── mtm_data.c
│ ├── mtm_data.h
│ ├── mtm_eviction.c
│ ├── mtm_handles.c
│ ├── mtm_handles.h
│ ├── mtm_integrity.c
│ ├── mtm_marshalling.c
│ ├── mtm_marshalling.h
│ ├── mtm_structures.h
│ └── mtm_verification.c
├── tddl/
│ ├── CMakeLists.txt
│ ├── tddl-tpm-emulator.h
│ ├── tddl.c
│ ├── tddl_unix.h
│ ├── tddl_windows.h
│ └── test_tddl.c
├── tpm/
│ ├── CMakeLists.txt
│ ├── tpm_audit.c
│ ├── tpm_authorization.c
│ ├── tpm_capability.c
│ ├── tpm_cmd_handler.c
│ ├── tpm_commands.h
│ ├── tpm_context.c
│ ├── tpm_counter.c
│ ├── tpm_credentials.c
│ ├── tpm_crypto.c
│ ├── tpm_daa.c
│ ├── tpm_data.c
│ ├── tpm_data.h
│ ├── tpm_delegation.c
│ ├── tpm_deprecated.c
│ ├── tpm_emulator.h
│ ├── tpm_emulator_extern.c
│ ├── tpm_emulator_extern.h
│ ├── tpm_error.c
│ ├── tpm_eviction.c
│ ├── tpm_handles.c
│ ├── tpm_handles.h
│ ├── tpm_identity.c
│ ├── tpm_integrity.c
│ ├── tpm_maintenance.c
│ ├── tpm_management.c
│ ├── tpm_marshalling.c
│ ├── tpm_marshalling.h
│ ├── tpm_migration.c
│ ├── tpm_nv_storage.c
│ ├── tpm_owner.c
│ ├── tpm_startup.c
│ ├── tpm_storage.c
│ ├── tpm_structures.h
│ ├── tpm_testing.c
│ ├── tpm_ticks.c
│ └── tpm_transport.c
├── tpmd/
│ ├── CMakeLists.txt
│ ├── unix/
│ │ ├── CMakeLists.txt
│ │ └── tpmd.c
│ └── windows/
│ ├── CMakeLists.txt
│ ├── control_tpmd.bat
│ └── tpmd.c
└── tpmd_dev/
├── CMakeLists.txt
├── darwin/
│ ├── English.lproj/
│ │ └── InfoPlist.strings
│ ├── Info.plist
│ ├── Makefile
│ ├── tpm_bridge.c
│ └── tpm_bridge.xcodeproj/
│ ├── TemplateIcon.tiff
│ ├── project.pbxproj
│ ├── project.xcworkspace/
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata/
│ │ └── admin.xcuserdatad/
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata/
│ └── admin.xcuserdatad/
│ └── xcschemes/
│ ├── tpm_bridge.xcscheme
│ └── xcschememanagement.plist
├── linux/
│ ├── Makefile
│ ├── tpmd_dev.c
│ └── tpmd_dev.rules.in
└── openbsd/
├── Makefile
├── tpmd_dev.c
└── tpmd_dev.h
SYMBOL INDEX (973 symbols across 62 files)
FILE: crypto/bn.h
type BIGNUM (line 25) | typedef BIGNUM tpm_bn_t[1];
type mpz_t (line 28) | typedef mpz_t tpm_bn_t;
FILE: crypto/bn_gmp.c
function tpm_bn_init (line 19) | void tpm_bn_init(tpm_bn_t a)
function tpm_bn_init2 (line 24) | void tpm_bn_init2(tpm_bn_t a, size_t nbits)
function tpm_bn_init_set (line 29) | void tpm_bn_init_set(tpm_bn_t a, tpm_bn_t val)
function tpm_bn_init_set_ui (line 34) | void tpm_bn_init_set_ui(tpm_bn_t a, uint32_t val)
function tpm_bn_set_ui (line 39) | void tpm_bn_set_ui(tpm_bn_t a, uint32_t val)
function tpm_bn_clear (line 44) | void tpm_bn_clear(tpm_bn_t a)
function tpm_bn_swap (line 49) | void tpm_bn_swap(tpm_bn_t a, tpm_bn_t b)
function tpm_bn_bitsize (line 54) | uint32_t tpm_bn_bitsize(tpm_bn_t a)
function tpm_bn_import (line 59) | void tpm_bn_import(tpm_bn_t out, size_t count, int order, const void *in)
function tpm_bn_export (line 64) | void tpm_bn_export(void *out, size_t *count, int order, tpm_bn_t in)
function tpm_bn_cmp (line 71) | int tpm_bn_cmp(tpm_bn_t a, tpm_bn_t b)
function tpm_bn_cmp_ui (line 76) | int tpm_bn_cmp_ui(tpm_bn_t a, uint32_t b)
function tpm_bn_sgn (line 81) | int tpm_bn_sgn(tpm_bn_t a)
function tpm_bn_setbit (line 86) | void tpm_bn_setbit(tpm_bn_t res, uint32_t bit)
function tpm_bn_add (line 91) | void tpm_bn_add(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_add_ui (line 96) | void tpm_bn_add_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
function tpm_bn_sub (line 101) | void tpm_bn_sub(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_sub_ui (line 106) | void tpm_bn_sub_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
function tpm_bn_mul (line 111) | void tpm_bn_mul(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_mod (line 116) | void tpm_bn_mod(tpm_bn_t res, tpm_bn_t a, tpm_bn_t mod)
function tpm_bn_powm (line 121) | void tpm_bn_powm(tpm_bn_t res, tpm_bn_t base, tpm_bn_t exp, tpm_bn_t mod)
function tpm_bn_ui_pow_ui (line 126) | void tpm_bn_ui_pow_ui(tpm_bn_t res, uint32_t base, uint32_t exp)
function tpm_bn_fdiv_q_2exp (line 131) | void tpm_bn_fdiv_q_2exp(tpm_bn_t res, tpm_bn_t n, uint32_t b)
function tpm_bn_tdiv_q (line 136) | void tpm_bn_tdiv_q(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_gcd (line 141) | void tpm_bn_gcd(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_invert (line 146) | void tpm_bn_invert(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_nextprime (line 151) | void tpm_bn_nextprime(tpm_bn_t res, tpm_bn_t a)
FILE: crypto/bn_openssl.c
function tpm_bn_init (line 21) | void tpm_bn_init(tpm_bn_t a)
function tpm_bn_init2 (line 27) | void tpm_bn_init2(tpm_bn_t a, size_t nbits)
function tpm_bn_init_set (line 34) | void tpm_bn_init_set(tpm_bn_t a, tpm_bn_t val)
function tpm_bn_init_set_ui (line 40) | void tpm_bn_init_set_ui(tpm_bn_t a, uint32_t val)
function tpm_bn_set_ui (line 46) | void tpm_bn_set_ui(tpm_bn_t a, uint32_t val)
function tpm_bn_clear (line 51) | void tpm_bn_clear(tpm_bn_t a)
function tpm_bn_swap (line 56) | void tpm_bn_swap(tpm_bn_t a, tpm_bn_t b)
function tpm_bn_bitsize (line 61) | uint32_t tpm_bn_bitsize(tpm_bn_t a)
function tpm_bn_import (line 66) | void tpm_bn_import(tpm_bn_t out, size_t count, int order, const void *in)
function tpm_bn_export (line 72) | void tpm_bn_export(void *out, size_t *count, int order, tpm_bn_t in)
function tpm_bn_cmp (line 79) | int tpm_bn_cmp(tpm_bn_t a, tpm_bn_t b)
function tpm_bn_cmp_ui (line 84) | int tpm_bn_cmp_ui(tpm_bn_t a, uint32_t b)
function tpm_bn_sgn (line 93) | int tpm_bn_sgn(tpm_bn_t a)
function tpm_bn_setbit (line 99) | void tpm_bn_setbit(tpm_bn_t res, uint32_t bit)
function tpm_bn_add (line 104) | void tpm_bn_add(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_add_ui (line 109) | void tpm_bn_add_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
function tpm_bn_sub (line 115) | void tpm_bn_sub(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_sub_ui (line 120) | void tpm_bn_sub_ui(tpm_bn_t res, tpm_bn_t a, uint32_t b)
function tpm_bn_mul (line 126) | void tpm_bn_mul(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_mod (line 131) | void tpm_bn_mod(tpm_bn_t res, tpm_bn_t a, tpm_bn_t mod)
function tpm_bn_powm (line 136) | void tpm_bn_powm(tpm_bn_t res, tpm_bn_t base, tpm_bn_t exp, tpm_bn_t mod)
function tpm_bn_ui_pow_ui (line 141) | void tpm_bn_ui_pow_ui(tpm_bn_t res, uint32_t base, uint32_t exp)
function tpm_bn_fdiv_q_2exp (line 154) | void tpm_bn_fdiv_q_2exp(tpm_bn_t res, tpm_bn_t n, uint32_t b)
function tpm_bn_tdiv_q (line 159) | void tpm_bn_tdiv_q(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_gcd (line 164) | void tpm_bn_gcd(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_invert (line 169) | void tpm_bn_invert(tpm_bn_t res, tpm_bn_t a, tpm_bn_t b)
function tpm_bn_nextprime (line 174) | void tpm_bn_nextprime(tpm_bn_t res, tpm_bn_t a)
FILE: crypto/hmac.c
function tpm_hmac_init (line 20) | void tpm_hmac_init(tpm_hmac_ctx_t *ctx, const uint8_t *key, size_t key_len)
function tpm_hmac_update (line 49) | void tpm_hmac_update(tpm_hmac_ctx_t *ctx, const uint8_t *data, size_t le...
function tpm_hmac_final (line 55) | void tpm_hmac_final(tpm_hmac_ctx_t *ctx, uint8_t *digest)
FILE: crypto/hmac.h
type tpm_hmac_ctx_t (line 26) | typedef struct {
FILE: crypto/rc4.c
function tpm_rc4_init (line 19) | void tpm_rc4_init(tpm_rc4_ctx_t *ctx, uint8_t *key, size_t key_len)
function tpm_rc4_crypt (line 43) | void tpm_rc4_crypt(tpm_rc4_ctx_t *ctx, uint8_t *in, uint8_t *out, size_t...
FILE: crypto/rc4.h
type tpm_rc4_ctx_t (line 23) | typedef struct {
FILE: crypto/rsa.c
function rsa_public (line 21) | static int rsa_public(tpm_rsa_public_key_t *key,
function rsa_private (line 46) | static int rsa_private(tpm_rsa_private_key_t *key,
function rsa_test_key (line 97) | static int rsa_test_key(tpm_rsa_private_key_t *key)
function tpm_rsa_import_key (line 118) | int tpm_rsa_import_key(tpm_rsa_private_key_t *key, int endian,
function tpm_rsa_copy_key (line 167) | void tpm_rsa_copy_key(tpm_rsa_private_key_t *dst, tpm_rsa_private_key_t ...
function tpm_rsa_import_public_key (line 178) | int tpm_rsa_import_public_key(tpm_rsa_public_key_t *key, int endian,
function rsa_tpm_bn_random (line 197) | static void rsa_tpm_bn_random(tpm_bn_t a, size_t nbits)
function tpm_rsa_generate_key (line 205) | int tpm_rsa_generate_key(tpm_rsa_private_key_t *key, uint16_t key_size)
function tpm_rsa_release_private_key (line 277) | void tpm_rsa_release_private_key(tpm_rsa_private_key_t *key)
function tpm_rsa_release_public_key (line 288) | void tpm_rsa_release_public_key(tpm_rsa_public_key_t *key)
function tpm_rsa_export_modulus (line 295) | void tpm_rsa_export_modulus(tpm_rsa_private_key_t *key,
function tpm_rsa_export_exponent (line 301) | void tpm_rsa_export_exponent(tpm_rsa_private_key_t *key,
function tpm_rsa_export_prime1 (line 307) | void tpm_rsa_export_prime1(tpm_rsa_private_key_t *key,
function tpm_rsa_export_prime2 (line 313) | void tpm_rsa_export_prime2(tpm_rsa_private_key_t *key,
function tpm_rsa_export_public_modulus (line 319) | void tpm_rsa_export_public_modulus(tpm_rsa_public_key_t *key,
function tpm_rsa_export_public_exponent (line 325) | void tpm_rsa_export_public_exponent(tpm_rsa_public_key_t *key,
function tpm_rsa_modulus_length (line 331) | size_t tpm_rsa_modulus_length(tpm_rsa_private_key_t *key)
function tpm_rsa_exponent_length (line 336) | size_t tpm_rsa_exponent_length(tpm_rsa_private_key_t *key)
function tpm_rsa_prime1_length (line 341) | size_t tpm_rsa_prime1_length(tpm_rsa_private_key_t *key)
function tpm_rsa_prime2_length (line 346) | size_t tpm_rsa_prime2_length(tpm_rsa_private_key_t *key)
function tpm_rsa_public_modulus_length (line 351) | size_t tpm_rsa_public_modulus_length(tpm_rsa_public_key_t *key)
function tpm_rsa_public_exponent_length (line 356) | size_t tpm_rsa_public_exponent_length(tpm_rsa_public_key_t *key)
function tpm_rsa_mask_generation (line 361) | void tpm_rsa_mask_generation(const uint8_t *seed, size_t seed_len,
function encode_message (line 380) | static int encode_message(int type, const uint8_t *data, size_t data_len,
function decode_message (line 461) | static int decode_message(int type, uint8_t *msg, size_t msg_len,
function tpm_rsa_sign (line 512) | int tpm_rsa_sign(tpm_rsa_private_key_t *key, int type,
function tpm_rsa_verify (line 524) | int tpm_rsa_verify(tpm_rsa_public_key_t *key, int type,
function tpm_rsa_decrypt (line 539) | int tpm_rsa_decrypt(tpm_rsa_private_key_t *key, int type,
function tpm_rsa_encrypt (line 552) | int tpm_rsa_encrypt(tpm_rsa_public_key_t *key, int type,
FILE: crypto/rsa.h
type tpm_rsa_private_key_t (line 24) | typedef struct {
type tpm_rsa_public_key_t (line 34) | typedef struct {
FILE: crypto/sha1.c
function tpm_sha1_transform (line 44) | static void tpm_sha1_transform(uint32_t h[5], const uint8_t data[64])
function tpm_sha1_init (line 89) | void tpm_sha1_init(tpm_sha1_ctx_t *ctx)
function tpm_sha1_update (line 100) | void tpm_sha1_update(tpm_sha1_ctx_t *ctx, const uint8_t *data, size_t le...
function tpm_sha1_update_be32 (line 124) | void tpm_sha1_update_be32(tpm_sha1_ctx_t *ctx, uint32_t data)
function tpm_sha1_final (line 135) | void tpm_sha1_final(tpm_sha1_ctx_t *ctx, uint8_t digest[SHA1_DIGEST_LENG...
FILE: crypto/sha1.h
type tpm_sha1_ctx_t (line 25) | typedef struct {
FILE: mtm/mtm_capability.c
function TPM_RESULT (line 23) | static inline TPM_RESULT return_UINT32(UINT32 *respSize, BYTE **resp, UI...
function TPM_RESULT (line 34) | static inline TPM_RESULT return_BOOL(UINT32 *respSize, BYTE **resp, BOOL...
function TPM_RESULT (line 47) | static TPM_RESULT cap_ord(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 67) | static TPM_RESULT cap_mtm_permanent_data(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 119) | TPM_RESULT MTM_GetCapability(TPM_CAPABILITY_AREA capArea, UINT32 subCapS...
FILE: mtm/mtm_cmd_handler.c
function TPM_RESULT (line 24) | static TPM_RESULT execute_MTM_InstallRIM(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 56) | static TPM_RESULT execute_MTM_LoadVerificationKey(TPM_REQUEST *req, TPM_...
function TPM_RESULT (line 91) | static TPM_RESULT execute_MTM_LoadVerificationRootKeyDisable(TPM_REQUEST...
function TPM_RESULT (line 104) | static TPM_RESULT execute_MTM_VerifyRIMCert(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 129) | static TPM_RESULT execute_MTM_VerifyRIMCertAndExtend(TPM_REQUEST *req, T...
function TPM_RESULT (line 160) | static TPM_RESULT execute_MTM_IncrementBootstrapCounter(TPM_REQUEST *req...
function TPM_RESULT (line 185) | static TPM_RESULT execute_MTM_SetVerifiedPCRSelection(TPM_REQUEST *req, ...
function TPM_RESULT (line 207) | TPM_RESULT mtm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp)
FILE: mtm/mtm_counter.c
function TPM_RESULT (line 21) | TPM_RESULT MTM_ReleaseCounter(TPM_COUNT_ID countID, TPM_AUTH *auth1)
function TPM_RESULT (line 34) | TPM_RESULT MTM_ReleaseCounterOwner(TPM_COUNT_ID countID, TPM_AUTH *auth1)
FILE: mtm/mtm_data.c
function set_counter (line 22) | static void set_counter(unsigned int num, const char *label)
function mtm_init_data (line 32) | void mtm_init_data(void)
FILE: mtm/mtm_eviction.c
function TPM_RESULT (line 21) | TPM_RESULT MTM_FlushSpecific(TPM_HANDLE handle,
FILE: mtm/mtm_handles.c
function MTM_KEY_DATA (line 20) | MTM_KEY_DATA *mtm_get_key_slot(TPM_VERIFICATION_KEY_HANDLE handle)
function MTM_KEY_DATA (line 30) | MTM_KEY_DATA *mtm_get_key(TPM_VERIFICATION_KEY_HANDLE handle)
function MTM_KEY_DATA (line 42) | MTM_KEY_DATA *mtm_get_key_by_id(TPM_VERIFICATION_KEY_ID id)
FILE: mtm/mtm_integrity.c
function TPM_RESULT (line 21) | TPM_RESULT MTM_Extend(TPM_PCRINDEX pcrNum, TPM_DIGEST *inDigest,
function TPM_RESULT (line 31) | TPM_RESULT MTM_PCR_Reset(TPM_PCR_SELECTION *pcrSelection)
FILE: mtm/mtm_marshalling.c
function tpm_marshal_MTM_PERMANENT_DATA (line 19) | int tpm_marshal_MTM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, MTM_PERMA...
function tpm_unmarshal_MTM_PERMANENT_DATA (line 39) | int tpm_unmarshal_MTM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, MTM_PER...
function tpm_marshal_MTM_STANY_FLAGS (line 59) | int tpm_marshal_MTM_STANY_FLAGS(BYTE **ptr, UINT32 *length, MTM_STANY_FL...
function tpm_unmarshal_MTM_STANY_FLAGS (line 66) | int tpm_unmarshal_MTM_STANY_FLAGS(BYTE **ptr, UINT32 *length, MTM_STANY_...
function tpm_marshal_MTM_COUNTER_REFERENCE (line 73) | int tpm_marshal_MTM_COUNTER_REFERENCE(BYTE **ptr, UINT32 *length, MTM_CO...
function tpm_unmarshal_MTM_COUNTER_REFERENCE (line 80) | int tpm_unmarshal_MTM_COUNTER_REFERENCE(BYTE **ptr, UINT32 *length, MTM_...
function tpm_marshal_TPM_RIM_CERTIFICATE (line 87) | int tpm_marshal_TPM_RIM_CERTIFICATE(BYTE **ptr, UINT32 *length, TPM_RIM_...
function tpm_unmarshal_TPM_RIM_CERTIFICATE (line 106) | int tpm_unmarshal_TPM_RIM_CERTIFICATE(BYTE **ptr, UINT32 *length, TPM_RI...
function tpm_marshal_TPM_VERIFICATION_KEY (line 125) | int tpm_marshal_TPM_VERIFICATION_KEY(BYTE **ptr, UINT32 *length, TPM_VER...
function tpm_unmarshal_TPM_VERIFICATION_KEY (line 145) | int tpm_unmarshal_TPM_VERIFICATION_KEY(BYTE **ptr, UINT32 *length, TPM_V...
function tpm_marshal_MTM_KEY_DATA (line 165) | int tpm_marshal_MTM_KEY_DATA(BYTE **ptr, UINT32 *length, MTM_KEY_DATA *v)
function tpm_unmarshal_MTM_KEY_DATA (line 179) | int tpm_unmarshal_MTM_KEY_DATA(BYTE **ptr, UINT32 *length, MTM_KEY_DATA *v)
function tpm_marshal_MTM_DATA (line 193) | int tpm_marshal_MTM_DATA(BYTE **ptr, UINT32 *length, MTM_DATA *v)
function tpm_unmarshal_MTM_DATA (line 200) | int tpm_unmarshal_MTM_DATA(BYTE **ptr, UINT32 *length, MTM_DATA *v)
FILE: mtm/mtm_structures.h
type MTM_COUNTER_REFERENCE (line 49) | typedef struct MTM_COUNTER_REFERENCE_STRUCT {
type UINT32 (line 58) | typedef UINT32 TPM_VERIFICATION_KEY_ID;
type UINT32 (line 76) | typedef UINT32 TPM_VERIFICATION_KEY_HANDLE;
type TPM_VERIFICATION_KEY (line 84) | typedef struct TPM_VERIFICATION_KEY_STRUCT {
type TPM_RIM_CERTIFICATE (line 114) | typedef struct TPM_RIM_CERTIFICATE_STRUCT {
type BYTE (line 141) | typedef BYTE TPM_VERIFICATION_KEY_LOAD_METHODS;
type MTM_KEY_DATA (line 151) | typedef struct MTM_KEY_DATA_STRUCT {
type MTM_PERMANENT_DATA (line 172) | typedef struct MTM_PERMANENT_DATA_STRUCT {
function sizeof_MTM_PERMANENT_DATA (line 188) | static inline int sizeof_MTM_PERMANENT_DATA(MTM_PERMANENT_DATA *s)
function free_MTM_PERMANENT_DATA (line 203) | static inline void free_MTM_PERMANENT_DATA(MTM_PERMANENT_DATA *s)
type MTM_STANY_FLAGS (line 216) | typedef struct MTM_STANY_FLAGS_STRUCT {
type MTM_DATA (line 226) | typedef struct tdMTM_DATA {
FILE: mtm/mtm_verification.c
function copy_TPM_RIM_CERTIFICATE (line 30) | static int copy_TPM_RIM_CERTIFICATE(TPM_RIM_CERTIFICATE* src, TPM_RIM_CE...
function compute_rim_certificate_digest (line 55) | static int compute_rim_certificate_digest(TPM_RIM_CERTIFICATE* rimCert, ...
function compute_rim_certificate_hmac (line 81) | static int compute_rim_certificate_hmac(TPM_RIM_CERTIFICATE* rimCert, BY...
function TPM_RESULT (line 108) | static TPM_RESULT verify_rim_certificate(TPM_RIM_CERTIFICATE *rimCert)
function compute_verification_key_digest (line 159) | static int compute_verification_key_digest(TPM_VERIFICATION_KEY *key, BY...
function TPM_RESULT (line 186) | static TPM_RESULT verify_verification_key(TPM_VERIFICATION_KEY *key, MTM...
function store_verification_key (line 212) | static int store_verification_key(TPM_VERIFICATION_KEY *inKey, MTM_KEY_D...
function TPM_RESULT (line 225) | TPM_RESULT MTM_InstallRIM(TPM_RIM_CERTIFICATE *rimCertIn, TPM_AUTH *auth1,
function TPM_VERIFICATION_KEY_HANDLE (line 265) | static TPM_VERIFICATION_KEY_HANDLE mtm_get_free_key(void)
function TPM_RESULT (line 278) | TPM_RESULT MTM_LoadVerificationKey(TPM_VERIFICATION_KEY_HANDLE parentKey...
function TPM_RESULT (line 393) | TPM_RESULT MTM_LoadVerificationRootKeyDisable()
function TPM_RESULT (line 401) | TPM_RESULT MTM_VerifyRIMCert(TPM_RIM_CERTIFICATE* rimCert,
function TPM_RESULT (line 448) | TPM_RESULT MTM_VerifyRIMCertAndExtend(TPM_RIM_CERTIFICATE *rimCert,
function TPM_RESULT (line 476) | TPM_RESULT MTM_IncrementBootstrapCounter(TPM_RIM_CERTIFICATE *rimCert,
function TPM_RESULT (line 513) | TPM_RESULT MTM_SetVerifiedPCRSelection(TPM_PCR_SELECTION *verifiedSelect...
FILE: tddl/tddl-tpm-emulator.h
type BYTE (line 30) | typedef uint8_t BYTE;
type TSS_BOOL (line 31) | typedef uint8_t TSS_BOOL;
type UINT32 (line 32) | typedef uint32_t UINT32;
type TSS_RESULT (line 33) | typedef uint32_t TSS_RESULT;
FILE: tddl/tddl.c
function TSS_RESULT (line 39) | TSS_RESULT Tddli_Open()
function TSS_RESULT (line 55) | TSS_RESULT Tddli_Close()
function TSS_RESULT (line 69) | TSS_RESULT Tddli_Cancel()
function TSS_RESULT (line 75) | static TSS_RESULT send_to_tpm(BYTE* pTransmitBuf, UINT32 TransmitBufLen)
function TSS_RESULT (line 83) | static TSS_RESULT receive_from_tpm(BYTE* pReceiveBuf, UINT32* puntReceiv...
function TSS_RESULT (line 97) | TSS_RESULT Tddli_TransmitData(BYTE* pTransmitBuf, UINT32 TransmitBufLen,
function TSS_RESULT (line 113) | static TSS_RESULT cap_version(UINT32 SubCap, BYTE* pCapBuf,
function TSS_RESULT (line 148) | static TSS_RESULT cap_property(UINT32 SubCap, BYTE* pCapBuf,
function TSS_RESULT (line 173) | TSS_RESULT Tddli_GetCapability(UINT32 CapArea, UINT32 SubCap,
function TSS_RESULT (line 193) | TSS_RESULT Tddli_SetCapability(UINT32 CapArea, UINT32 SubCap,
function TSS_RESULT (line 200) | TSS_RESULT Tddli_GetStatus(UINT32 ReqStatusType, UINT32* puntStatus)
function TSS_RESULT (line 218) | TSS_RESULT Tddli_SetPowerManagement(TSS_BOOL SendSaveStateCommand,
function TSS_RESULT (line 224) | TSS_RESULT Tddli_PowerManagementControl(TSS_BOOL SendPowerManager,
function TSS_RESULT (line 235) | TSS_RESULT TDDL_Open()
function TSS_RESULT (line 241) | TSS_RESULT TDDL_Close()
function TSS_RESULT (line 246) | TSS_RESULT TDDL_Cancel()
function TSS_RESULT (line 251) | TSS_RESULT TDDL_TransmitData(BYTE* pTransmitBuf, UINT32 TransmitBufLen,
function TSS_RESULT (line 258) | TSS_RESULT TDDL_GetCapability(UINT32 CapArea, UINT32 SubCap,
function TSS_RESULT (line 264) | TSS_RESULT TDDL_SetCapability(UINT32 CapArea, UINT32 SubCap,
function TSS_RESULT (line 270) | TSS_RESULT TDDL_GetStatus(UINT32 ReqStatusType, UINT32* puntStatus)
function TSS_RESULT (line 275) | TSS_RESULT TDDL_SetPowerManagement(TSS_BOOL SendSaveStateCommand,
function TSS_RESULT (line 281) | TSS_RESULT TDDL_PowerManagementControl(TSS_BOOL SendPowerManager,
FILE: tddl/tddl_unix.h
function TSS_RESULT (line 32) | static TSS_RESULT open_device(const char *device_name)
function TSS_RESULT (line 51) | static TSS_RESULT open_socket(const char *socket_name)
FILE: tddl/tddl_windows.h
function BOOL (line 30) | BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved)
function TSS_RESULT (line 45) | static TSS_RESULT open_device(const char *device_name)
function TSS_RESULT (line 70) | static TSS_RESULT open_socket(const char *socket_name)
FILE: tddl/test_tddl.c
function main (line 66) | int main()
FILE: tpm/tpm_audit.c
function tpm_audit_request (line 33) | void tpm_audit_request(TPM_COMMAND_CODE ordinal, TPM_REQUEST *req)
function tpm_audit_response (line 65) | void tpm_audit_response(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp)
function TPM_RESULT (line 96) | TPM_RESULT TPM_GetAuditDigest(UINT32 startOrdinal,
function TPM_RESULT (line 127) | TPM_RESULT TPM_GetAuditDigestSigned(TPM_KEY_HANDLE keyHandle,
function TPM_RESULT (line 218) | TPM_RESULT TPM_SetOrdinalAuditStatus(TPM_COMMAND_CODE ordinalToAudit,
FILE: tpm/tpm_authorization.c
function TPM_RESULT (line 29) | TPM_RESULT TPM_ChangeAuth(TPM_KEY_HANDLE parentHandle,
function TPM_RESULT (line 103) | TPM_RESULT TPM_ChangeAuthOwner(TPM_PROTOCOL_ID protocolID,
function TPM_RESULT (line 153) | TPM_RESULT TPM_OIAP(TPM_AUTHHANDLE *authHandle, TPM_NONCE *nonceEven)
function TPM_RESULT (line 168) | TPM_RESULT TPM_OSAP(TPM_ENTITY_TYPE entityType, UINT32 entityValue,
function TPM_RESULT (line 242) | TPM_RESULT TPM_DSAP(TPM_ENTITY_TYPE entityType, TPM_KEY_HANDLE keyHandle,
function TPM_RESULT (line 377) | TPM_RESULT TPM_SetOwnerPointer(TPM_ENTITY_TYPE entityType, UINT32 entity...
function BOOL (line 385) | static BOOL is_owner_delegation_permitted(TPM_COMMAND_CODE ordinal,
function BOOL (line 455) | static BOOL is_key_delegation_permitted(TPM_COMMAND_CODE ordinal,
function TPM_RESULT (line 519) | TPM_RESULT tpm_verify_auth(TPM_AUTH *auth, TPM_SECRET secret,
function tpm_decrypt_auth_secret (line 580) | void tpm_decrypt_auth_secret(TPM_ENCAUTH encAuth, TPM_SECRET secret,
FILE: tpm/tpm_capability.c
function TPM_RESULT (line 31) | static inline TPM_RESULT return_UINT32(UINT32 *respSize, BYTE **resp, UI...
function TPM_RESULT (line 42) | static inline TPM_RESULT return_UINT32_array(UINT32 *respSize, BYTE **resp,
function TPM_RESULT (line 54) | static inline TPM_RESULT return_BOOL(UINT32 *respSize, BYTE **resp, BOOL...
function TPM_RESULT (line 65) | static TPM_RESULT cap_property(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 222) | static TPM_RESULT cap_version(UINT32 *respSize, BYTE **resp)
function TPM_RESULT (line 237) | static TPM_RESULT cap_mfr(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 259) | static TPM_RESULT cap_nv_list(UINT32 *respSize, BYTE **resp)
function TPM_RESULT (line 281) | static TPM_RESULT cap_nv_index(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 304) | static TPM_RESULT cap_handle(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 372) | static TPM_RESULT cap_ord(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 506) | static TPM_RESULT cap_alg(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 520) | static TPM_RESULT cap_pid(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 540) | static TPM_RESULT cap_flag(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 572) | static TPM_RESULT cap_loaded(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 590) | static TPM_RESULT cap_auth_encrypt(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 604) | static TPM_RESULT cap_sym_mode(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 618) | static TPM_RESULT cap_key_status(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 631) | static TPM_RESULT cap_trans_alg(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 645) | static TPM_RESULT cap_trans_es(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 660) | static TPM_RESULT cap_select_size(UINT32 subCapSize, BYTE *subCap,
function TPM_RESULT (line 669) | static TPM_RESULT cap_version_val(UINT32 *respSize, BYTE **resp)
function TPM_RESULT (line 694) | TPM_RESULT TPM_GetCapability(TPM_CAPABILITY_AREA capArea, UINT32 subCapS...
function TPM_RESULT (line 786) | static TPM_RESULT set_perm_flags(UINT32 subCap, BOOL flag, BOOL ownerAuth,
function TPM_RESULT (line 854) | static TPM_RESULT set_stclear_flags(UINT32 subCap, BOOL flag, BOOL owner...
function TPM_RESULT (line 868) | static TPM_RESULT set_stany_flags(UINT32 subCap, BOOL flag, BOOL ownerAuth,
function TPM_RESULT (line 884) | static TPM_RESULT set_perm_data(UINT32 subCap, BYTE *setValue,
function TPM_RESULT (line 922) | static TPM_RESULT set_stclear_data(UINT32 subCap, BYTE *setValue,
function TPM_RESULT (line 941) | static TPM_RESULT set_stany_data(UINT32 subCap, BYTE *setValue,
function TPM_RESULT (line 948) | static TPM_RESULT set_vendor(UINT32 subCap, BYTE *setValue,
function TPM_RESULT (line 1012) | TPM_RESULT TPM_SetCapability(TPM_CAPABILITY_AREA capArea, UINT32 subCapS...
function TPM_RESULT (line 1070) | TPM_RESULT TPM_GetCapabilityOwner(TPM_AUTH *auth1, TPM_VERSION *version,
FILE: tpm/tpm_cmd_handler.c
function UINT32 (line 28) | UINT32 tpm_get_in_param_offset(TPM_COMMAND_CODE ordinal)
function UINT32 (line 79) | UINT32 tpm_get_out_param_offset(TPM_COMMAND_CODE ordinal)
function tpm_compute_in_param_digest (line 98) | void tpm_compute_in_param_digest(TPM_REQUEST *req)
function tpm_compute_out_param_digest (line 114) | void tpm_compute_out_param_digest(TPM_COMMAND_CODE ordinal, TPM_RESPONSE...
function TPM_RESULT (line 129) | static TPM_RESULT execute_TPM_Startup(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 143) | static TPM_RESULT execute_TPM_SaveState(TPM_REQUEST *req, TPM_RESPONSE *...
function TPM_RESULT (line 149) | static TPM_RESULT execute_TPM_SelfTestFull(TPM_REQUEST *req, TPM_RESPONS...
function TPM_RESULT (line 155) | static TPM_RESULT execute_TPM_ContinueSelfTest(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 161) | static TPM_RESULT execute_TPM_GetTestResult(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 184) | static TPM_RESULT execute_TPM_SetOwnerInstall(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 198) | static TPM_RESULT execute_TPM_OwnerSetDisable(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 214) | static TPM_RESULT execute_TPM_PhysicalEnable(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 220) | static TPM_RESULT execute_TPM_PhysicalDisable(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 226) | static TPM_RESULT execute_TPM_PhysicalSetDeactivated(TPM_REQUEST *req, T...
function TPM_RESULT (line 240) | static TPM_RESULT execute_TPM_SetTempDeactivated(TPM_REQUEST *req, TPM_R...
function TPM_RESULT (line 248) | static TPM_RESULT execute_TPM_SetOperatorAuth(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 262) | static TPM_RESULT execute_TPM_TakeOwnership(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 302) | static TPM_RESULT execute_TPM_OwnerClear(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 310) | static TPM_RESULT execute_TPM_ForceClear(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 316) | static TPM_RESULT execute_TPM_DisableOwnerClear(TPM_REQUEST *req, TPM_RE...
function TPM_RESULT (line 324) | static TPM_RESULT execute_TPM_DisableForceClear(TPM_REQUEST *req, TPM_RE...
function TPM_RESULT (line 330) | static TPM_RESULT execute_TSC_PhysicalPresence(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 344) | static TPM_RESULT execute_TSC_ResetEstablishmentBit(TPM_REQUEST *req, TP...
function TPM_RESULT (line 350) | static TPM_RESULT execute_TPM_GetCapability(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 387) | static TPM_RESULT execute_TPM_SetCapability(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 409) | static TPM_RESULT execute_TPM_GetCapabilityOwner(TPM_REQUEST *req, TPM_R...
function TPM_RESULT (line 436) | static TPM_RESULT execute_TPM_GetAuditDigest(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 471) | static TPM_RESULT execute_TPM_GetAuditDigestSigned(TPM_REQUEST *req, TPM...
function TPM_RESULT (line 513) | static TPM_RESULT execute_TPM_SetOrdinalAuditStatus(TPM_REQUEST *req, TP...
function TPM_RESULT (line 531) | static TPM_RESULT execute_TPM_FieldUpgrade(TPM_REQUEST *req, TPM_RESPONS...
function TPM_RESULT (line 537) | static TPM_RESULT execute_TPM_SetRedirection(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 559) | static TPM_RESULT execute_TPM_ResetLockValue(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 567) | static TPM_RESULT execute_TPM_Seal(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 608) | static TPM_RESULT execute_TPM_Unseal(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 641) | static TPM_RESULT execute_TPM_UnBind(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 676) | static TPM_RESULT execute_TPM_CreateWrapKey(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 712) | static TPM_RESULT execute_TPM_LoadKey(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 742) | static TPM_RESULT execute_TPM_LoadKey2(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 772) | static TPM_RESULT execute_TPM_GetPubKey(TPM_REQUEST *req, TPM_RESPONSE *...
function TPM_RESULT (line 801) | static TPM_RESULT execute_TPM_Sealx(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 842) | static TPM_RESULT execute_TPM_CreateMigrationBlob(TPM_REQUEST *req, TPM_...
function TPM_RESULT (line 887) | static TPM_RESULT execute_TPM_ConvertMigrationBlob(TPM_REQUEST *req, TPM...
function TPM_RESULT (line 927) | static TPM_RESULT execute_TPM_AuthorizeMigrationKey(TPM_REQUEST *req, TP...
function TPM_RESULT (line 958) | static TPM_RESULT execute_TPM_MigrateKey(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 996) | static TPM_RESULT execute_TPM_CMK_SetRestrictions(TPM_REQUEST *req, TPM_...
function TPM_RESULT (line 1012) | static TPM_RESULT execute_TPM_CMK_ApproveMA(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 1040) | static TPM_RESULT execute_TPM_CMK_CreateKey(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 1078) | static TPM_RESULT execute_TPM_CMK_CreateTicket(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 1113) | static TPM_RESULT execute_TPM_CMK_CreateBlob(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 1177) | static TPM_RESULT execute_TPM_CMK_ConvertMigration(TPM_REQUEST *req, TPM...
function TPM_RESULT (line 1224) | static TPM_RESULT execute_TPM_CreateMaintenanceArchive(TPM_REQUEST *req,...
function TPM_RESULT (line 1261) | static TPM_RESULT execute_TPM_LoadMaintenanceArchive(TPM_REQUEST *req, T...
function TPM_RESULT (line 1288) | static TPM_RESULT execute_TPM_KillMaintenanceFeature(TPM_REQUEST *req, T...
function TPM_RESULT (line 1296) | static TPM_RESULT execute_TPM_LoadManuMaintPub(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 1324) | static TPM_RESULT execute_TPM_ReadManuMaintPub(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 1350) | static TPM_RESULT execute_TPM_SHA1Start(TPM_REQUEST *req, TPM_RESPONSE *...
function TPM_RESULT (line 1370) | static TPM_RESULT execute_TPM_SHA1Update(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 1386) | static TPM_RESULT execute_TPM_SHA1Complete(TPM_REQUEST *req, TPM_RESPONS...
function TPM_RESULT (line 1414) | static TPM_RESULT execute_TPM_SHA1CompleteExtend(TPM_REQUEST *req, TPM_R...
function TPM_RESULT (line 1446) | static TPM_RESULT execute_TPM_Sign(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 1481) | static TPM_RESULT execute_TPM_GetRandom(TPM_REQUEST *req, TPM_RESPONSE *...
function TPM_RESULT (line 1510) | static TPM_RESULT execute_TPM_StirRandom(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 1526) | static TPM_RESULT execute_TPM_CertifyKey(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 1565) | static TPM_RESULT execute_TPM_CertifyKey2(TPM_REQUEST *req, TPM_RESPONSE...
function TPM_RESULT (line 1606) | static TPM_RESULT execute_TPM_CreateEndorsementKeyPair(TPM_REQUEST *req,...
function TPM_RESULT (line 1637) | static TPM_RESULT execute_TPM_CreateRevocableEK(TPM_REQUEST *req, TPM_RE...
function TPM_RESULT (line 1675) | static TPM_RESULT execute_TPM_RevokeTrust(TPM_REQUEST *req, TPM_RESPONSE...
function TPM_RESULT (line 1689) | static TPM_RESULT execute_TPM_ReadPubek(TPM_REQUEST *req, TPM_RESPONSE *...
function TPM_RESULT (line 1718) | static TPM_RESULT execute_TPM_DisablePubekRead(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 1726) | static TPM_RESULT execute_TPM_OwnerReadInternalPub(TPM_REQUEST *req, TPM...
function TPM_RESULT (line 1755) | static TPM_RESULT execute_TPM_MakeIdentity(TPM_REQUEST *req, TPM_RESPONS...
function TPM_RESULT (line 1794) | static TPM_RESULT execute_TPM_ActivateIdentity(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 1837) | static TPM_RESULT execute_TPM_Extend(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 1869) | static TPM_RESULT execute_TPM_PCRRead(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 1895) | static TPM_RESULT execute_TPM_Quote(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 1932) | static TPM_RESULT execute_TPM_PCR_Reset(TPM_REQUEST *req, TPM_RESPONSE *...
function TPM_RESULT (line 1950) | static TPM_RESULT execute_TPM_Quote2(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 1996) | static TPM_RESULT execute_TPM_ChangeAuth(TPM_REQUEST *req, TPM_RESPONSE ...
function TPM_RESULT (line 2038) | static TPM_RESULT execute_TPM_ChangeAuthOwner(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 2058) | static TPM_RESULT execute_TPM_OIAP(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 2080) | static TPM_RESULT execute_TPM_OSAP(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 2115) | static TPM_RESULT execute_TPM_DSAP(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 2154) | static TPM_RESULT execute_TPM_SetOwnerPointer(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 2170) | static TPM_RESULT execute_TPM_Delegate_Manage(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 2208) | static TPM_RESULT execute_TPM_Delegate_CreateKeyDelegation(TPM_REQUEST *...
function TPM_RESULT (line 2245) | static TPM_RESULT execute_TPM_Delegate_CreateOwnerDelegation(TPM_REQUEST...
function TPM_RESULT (line 2282) | static TPM_RESULT execute_TPM_Delegate_LoadOwnerDelegation(TPM_REQUEST *...
function TPM_RESULT (line 2302) | static TPM_RESULT execute_TPM_Delegate_ReadTable(TPM_REQUEST *req, TPM_R...
function TPM_RESULT (line 2330) | static TPM_RESULT execute_TPM_Delegate_UpdateVerification(TPM_REQUEST *r...
function TPM_RESULT (line 2364) | static TPM_RESULT execute_TPM_Delegate_VerifyDelegation(TPM_REQUEST *req...
function TPM_RESULT (line 2380) | static TPM_RESULT execute_TPM_NV_DefineSpace(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 2398) | static TPM_RESULT execute_TPM_NV_WriteValue(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 2420) | static TPM_RESULT execute_TPM_NV_WriteValueAuth(TPM_REQUEST *req, TPM_RE...
function TPM_RESULT (line 2442) | static TPM_RESULT execute_TPM_NV_ReadValue(TPM_REQUEST *req, TPM_RESPONS...
function TPM_RESULT (line 2477) | static TPM_RESULT execute_TPM_NV_ReadValueAuth(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 2512) | static TPM_RESULT execute_TPM_KeyControlOwner(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 2534) | static TPM_RESULT execute_TPM_SaveContext(TPM_REQUEST *req, TPM_RESPONSE...
function TPM_RESULT (line 2567) | static TPM_RESULT execute_TPM_LoadContext(TPM_REQUEST *req, TPM_RESPONSE...
function TPM_RESULT (line 2599) | static TPM_RESULT execute_TPM_FlushSpecific(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 2619) | static TPM_RESULT execute_TPM_GetTicks(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 2639) | static TPM_RESULT execute_TPM_TickStampBlob(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 2677) | static TPM_RESULT execute_TPM_EstablishTransport(TPM_REQUEST *req, TPM_R...
function TPM_RESULT (line 2718) | static TPM_RESULT execute_TPM_ExecuteTransport(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 2756) | static TPM_RESULT execute_TPM_ReleaseTransportSigned(TPM_REQUEST *req, T...
function TPM_RESULT (line 2794) | static TPM_RESULT execute_TPM_CreateCounter(TPM_REQUEST *req, TPM_RESPON...
function TPM_RESULT (line 2826) | static TPM_RESULT execute_TPM_IncrementCounter(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 2854) | static TPM_RESULT execute_TPM_ReadCounter(TPM_REQUEST *req, TPM_RESPONSE...
function TPM_RESULT (line 2880) | static TPM_RESULT execute_TPM_ReleaseCounter(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 2900) | static TPM_RESULT execute_TPM_ReleaseCounterOwner(TPM_REQUEST *req, TPM_...
function TPM_RESULT (line 2920) | static TPM_RESULT execute_TPM_DAA_Join(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 2963) | static TPM_RESULT execute_TPM_DAA_Sign(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 3006) | static TPM_RESULT execute_TPM_EvictKey(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 3020) | static TPM_RESULT execute_TPM_Terminate_Handle(TPM_REQUEST *req, TPM_RES...
function TPM_RESULT (line 3034) | static TPM_RESULT execute_TPM_SaveKeyContext(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 3063) | static TPM_RESULT execute_TPM_LoadKeyContext(TPM_REQUEST *req, TPM_RESPO...
function TPM_RESULT (line 3091) | static TPM_RESULT execute_TPM_SaveAuthContext(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 3120) | static TPM_RESULT execute_TPM_LoadAuthContext(TPM_REQUEST *req, TPM_RESP...
function TPM_RESULT (line 3148) | static TPM_RESULT execute_TPM_DirWriteAuth(TPM_REQUEST *req, TPM_RESPONS...
function TPM_RESULT (line 3166) | static TPM_RESULT execute_TPM_DirRead(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 3192) | static TPM_RESULT execute_TPM_ChangeAuthAsymStart(TPM_REQUEST *req, TPM_...
function TPM_RESULT (line 3235) | static TPM_RESULT execute_TPM_ChangeAuthAsymFinish(TPM_REQUEST *req, TPM...
function TPM_RESULT (line 3286) | static TPM_RESULT execute_TPM_Reset(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function TPM_RESULT (line 3292) | static TPM_RESULT execute_TPM_OwnerReadPubek(TPM_REQUEST *req, TPM_RESPO...
function tpm_setup_rsp_auth (line 3315) | static void tpm_setup_rsp_auth(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp)
function tpm_setup_error_response (line 3347) | static void tpm_setup_error_response(TPM_RESULT res, TPM_RESPONSE *rsp)
function TPM_RESULT (line 3356) | static TPM_RESULT tpm_check_status_and_mode(TPM_REQUEST *req)
function tpm_execute_command (line 3428) | void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp)
function tpm_emulator_init (line 4109) | int tpm_emulator_init(uint32_t startup, uint32_t conf)
function tpm_emulator_shutdown (line 4125) | void tpm_emulator_shutdown()
function tpm_handle_command (line 4136) | int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **ou...
FILE: tpm/tpm_context.c
function UINT32 (line 29) | UINT32 tpm_get_free_session(BYTE type)
function tpm_invalidate_sessions (line 42) | void tpm_invalidate_sessions(TPM_HANDLE handle)
function TPM_RESULT (line 56) | TPM_RESULT TPM_KeyControlOwner(TPM_KEY_HANDLE keyHandle, TPM_PUBKEY pubKey,
function encrypt_context (line 110) | static int encrypt_context(BYTE *iv, UINT32 iv_size, TPM_CONTEXT_SENSITI...
function decrypt_context (line 133) | static int decrypt_context(BYTE *iv, UINT32 iv_size, BYTE *enc, UINT32 e...
function compute_context_digest (line 156) | static int compute_context_digest(TPM_CONTEXT_BLOB *contextBlob, TPM_DIG...
function TPM_RESULT (line 177) | TPM_RESULT TPM_SaveContext(TPM_HANDLE handle, TPM_RESOURCE_TYPE resource...
function TPM_RESULT (line 282) | TPM_RESULT TPM_LoadContext(TPM_HANDLE entityHandle, BOOL keepHandle,
FILE: tpm/tpm_counter.c
function TPM_ACTUAL_COUNT (line 26) | static TPM_ACTUAL_COUNT get_max_counter_value(void)
function TPM_COUNT_ID (line 38) | static TPM_COUNT_ID get_free_counter(void)
function TPM_RESULT (line 50) | TPM_RESULT TPM_CreateCounter(TPM_ENCAUTH *authData, BYTE label[4],
function TPM_RESULT (line 80) | TPM_RESULT TPM_IncrementCounter(TPM_COUNT_ID countID, TPM_AUTH *auth1,
function TPM_RESULT (line 101) | TPM_RESULT TPM_ReadCounter(TPM_COUNT_ID countID, TPM_COUNTER_VALUE *count)
function TPM_RESULT (line 112) | TPM_RESULT TPM_ReleaseCounter(TPM_COUNT_ID countID, TPM_AUTH *auth1)
function TPM_RESULT (line 130) | TPM_RESULT TPM_ReleaseCounterOwner(TPM_COUNT_ID countID, TPM_AUTH *auth1)
FILE: tpm/tpm_credentials.c
function TPM_RESULT (line 30) | TPM_RESULT tpm_get_pubek(TPM_PUBKEY *pubEndorsementKey)
function TPM_RESULT (line 52) | TPM_RESULT TPM_CreateEndorsementKeyPair(TPM_NONCE *antiReplay,
function TPM_RESULT (line 61) | TPM_RESULT TPM_CreateRevocableEK(TPM_NONCE *antiReplay, TPM_KEY_PARMS *k...
function TPM_RESULT (line 110) | TPM_RESULT TPM_RevokeTrust(TPM_NONCE *ekReset)
function TPM_RESULT (line 126) | TPM_RESULT TPM_ReadPubek(TPM_NONCE *antiReplay, TPM_PUBKEY *pubEndorseme...
function TPM_RESULT (line 143) | TPM_RESULT TPM_DisablePubekRead(TPM_AUTH *auth1)
function TPM_RESULT (line 154) | TPM_RESULT TPM_OwnerReadInternalPub(TPM_KEY_HANDLE keyHandle, TPM_AUTH *...
FILE: tpm/tpm_crypto.c
function TPM_RESULT (line 33) | TPM_RESULT TPM_SHA1Start(UINT32 *maxNumBytes)
function TPM_RESULT (line 43) | TPM_RESULT TPM_SHA1Update(UINT32 numBytes, BYTE *hashData)
function TPM_RESULT (line 51) | TPM_RESULT TPM_SHA1Complete(UINT32 hashDataSize, BYTE *hashData,
function TPM_RESULT (line 62) | TPM_RESULT TPM_SHA1CompleteExtend(TPM_PCRINDEX pcrNum, UINT32 hashDataSize,
function TPM_RESULT (line 73) | TPM_RESULT tpm_verify(TPM_PUBKEY_DATA *key, TPM_AUTH *auth, BOOL isInfo,
function TPM_RESULT (line 115) | TPM_RESULT tpm_sign(TPM_KEY_DATA *key, TPM_AUTH *auth, BOOL isInfo,
function TPM_RESULT (line 179) | TPM_RESULT TPM_Sign(TPM_KEY_HANDLE keyHandle, UINT32 areaToSignSize,
function tpm_get_random_bytes (line 201) | void tpm_get_random_bytes(void *buf, size_t nbytes)
function TPM_RESULT (line 215) | TPM_RESULT TPM_GetRandom(UINT32 bytesRequested, UINT32 *randomBytesSize,
function TPM_RESULT (line 226) | TPM_RESULT TPM_StirRandom(UINT32 dataSize, BYTE *inData)
function TPM_RESULT (line 242) | TPM_RESULT TPM_CertifyKey(TPM_KEY_HANDLE certHandle, TPM_KEY_HANDLE keyH...
function TPM_RESULT (line 351) | TPM_RESULT TPM_CertifyKey2(TPM_KEY_HANDLE keyHandle, TPM_KEY_HANDLE cert...
FILE: tpm/tpm_daa.c
function UINT32 (line 34) | UINT32 tpm_get_free_daa_session(void)
function TPM_RESULT (line 50) | static TPM_RESULT tpm_daa_verify_digestContext(TPM_DAA_SESSION_DATA *ses...
function tpm_daa_update_digestContext (line 91) | static void tpm_daa_update_digestContext(TPM_DAA_SESSION_DATA *session,
function TPM_RESULT (line 130) | static TPM_RESULT tpm_daa_verify_digestContext_sign(TPM_DAA_SESSION_DATA...
function tpm_daa_update_digestContext_sign (line 158) | static void tpm_daa_update_digestContext_sign(TPM_DAA_SESSION_DATA *sess...
function TPM_RESULT (line 183) | static TPM_RESULT tpm_daa_verify_digestIssuer(TPM_DAA_SESSION_DATA *sess...
function tpm_daa_update_digestIssuer (line 211) | static void tpm_daa_update_digestIssuer(TPM_DAA_SESSION_DATA *session,
function TPM_RESULT (line 236) | static TPM_RESULT tpm_daa_verify_generic(TPM_DIGEST digest, BYTE *input,
function encrypt_daa (line 248) | static int encrypt_daa(BYTE *iv, UINT32 iv_size, TPM_DAA_SENSITIVE *sens...
function decrypt_daa (line 275) | static int decrypt_daa(BYTE *iv, UINT32 iv_size, BYTE *enc, UINT32 enc_s...
function compute_daa_digest (line 302) | static int compute_daa_digest(TPM_DAA_BLOB *daaBlob, TPM_DIGEST *digest)
function TPM_RESULT (line 333) | TPM_RESULT TPM_DAA_Join(TPM_HANDLE handle, BYTE stage, UINT32 inputSize0,
function TPM_RESULT (line 2359) | TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handle, BYTE stage, UINT32 inputSize0,
FILE: tpm/tpm_data.c
function BOOL (line 33) | BOOL tpm_get_physical_presence(void)
function init_pcr_attr (line 38) | static inline void init_pcr_attr(int pcr, BOOL reset, BYTE rl, BYTE el)
function init_nv_storage (line 45) | static void init_nv_storage(void)
function init_timeouts (line 67) | static void init_timeouts(void)
function tpm_init_data (line 79) | void tpm_init_data(void)
function tpm_release_data (line 187) | void tpm_release_data(void)
function tpm_store_permanent_data (line 195) | int tpm_store_permanent_data(void)
FILE: tpm/tpm_delegation.c
function TPM_FAMILY_TABLE_ENTRY (line 29) | TPM_FAMILY_TABLE_ENTRY *tpm_get_family_row(TPM_FAMILY_ID id)
function TPM_DELEGATE_TABLE_ROW (line 40) | TPM_DELEGATE_TABLE_ROW *tpm_get_delegate_row(UINT32 row)
function tpm_compute_owner_blob_digest (line 48) | void tpm_compute_owner_blob_digest(TPM_DELEGATE_OWNER_BLOB *blob,
function tpm_compute_key_blob_digest (line 63) | void tpm_compute_key_blob_digest(TPM_DELEGATE_KEY_BLOB *blob,
function tpm_encrypt_sensitive (line 78) | int tpm_encrypt_sensitive(BYTE *iv, UINT32 iv_size,
function tpm_decrypt_sensitive (line 102) | int tpm_decrypt_sensitive(BYTE *iv, UINT32 iv_size, BYTE *enc, UINT32 en...
function TPM_FAMILY_TABLE_ENTRY (line 125) | static TPM_FAMILY_TABLE_ENTRY *tpm_get_free_family_row(void) {
function TPM_RESULT (line 136) | TPM_RESULT TPM_Delegate_Manage(TPM_FAMILY_ID familyID,
function TPM_RESULT (line 239) | TPM_RESULT TPM_Delegate_CreateKeyDelegation(TPM_KEY_HANDLE keyHandle,
function TPM_RESULT (line 323) | TPM_RESULT TPM_Delegate_CreateOwnerDelegation(BOOL increment,
function TPM_RESULT (line 403) | TPM_RESULT TPM_Delegate_LoadOwnerDelegation(TPM_DELEGATE_INDEX index,
function TPM_RESULT (line 487) | TPM_RESULT TPM_Delegate_ReadTable(UINT32 *familyTableSize, BYTE **family...
function TPM_RESULT (line 556) | TPM_RESULT TPM_Delegate_UpdateVerification(UINT32 inputSize, BYTE *input...
function TPM_RESULT (line 682) | TPM_RESULT TPM_Delegate_VerifyDelegation(UINT32 delegateSize, BYTE *dele...
FILE: tpm/tpm_deprecated.c
function TPM_RESULT (line 39) | TPM_RESULT TPM_EvictKey(TPM_KEY_HANDLE evictHandle)
function TPM_RESULT (line 45) | TPM_RESULT TPM_Terminate_Handle(TPM_AUTHHANDLE handle)
function TPM_RESULT (line 51) | TPM_RESULT TPM_SaveKeyContext(TPM_KEY_HANDLE keyHandle,
function TPM_RESULT (line 71) | TPM_RESULT TPM_LoadKeyContext(UINT32 keyContextSize,
function TPM_RESULT (line 83) | TPM_RESULT TPM_SaveAuthContext(TPM_AUTHHANDLE authHandle,
function TPM_RESULT (line 103) | TPM_RESULT TPM_LoadAuthContext(UINT32 authContextSize, BYTE *authContext...
function TPM_RESULT (line 115) | TPM_RESULT TPM_DirWriteAuth(TPM_DIRINDEX dirIndex,
function TPM_RESULT (line 129) | TPM_RESULT TPM_DirRead(TPM_DIRINDEX dirIndex, TPM_DIRVALUE *dirContents)
function TPM_RESULT (line 139) | TPM_RESULT TPM_ChangeAuthAsymStart(TPM_KEY_HANDLE idHandle,
function TPM_RESULT (line 341) | TPM_RESULT TPM_ChangeAuthAsymFinish(TPM_KEY_HANDLE parentHandle,
function TPM_RESULT (line 486) | TPM_RESULT TPM_Reset()
function TPM_RESULT (line 499) | TPM_RESULT TPM_CertifySelfTest(TPM_KEY_HANDLE keyHandle, TPM_NONCE *anti...
function TPM_RESULT (line 530) | TPM_RESULT TPM_OwnerReadPubek(TPM_AUTH *auth1, TPM_PUBKEY *pubEndorsemen...
FILE: tpm/tpm_emulator_extern.c
function _tpm_extern_init (line 64) | static int _tpm_extern_init()
function _tpm_extern_release (line 84) | void _tpm_extern_release()
function _tpm_get_extern_random_bytes (line 90) | void _tpm_get_extern_random_bytes(void *buf, size_t nbytes)
function _tpm_extern_init (line 99) | static int _tpm_extern_init()
function _tpm_extern_release (line 113) | static void _tpm_extern_release()
function _tpm_get_extern_random_bytes (line 119) | static void _tpm_get_extern_random_bytes(void *buf, size_t nbytes)
function _tpm_free (line 139) | static void _tpm_free(/*const*/ void *ptr)
function _tpm_log (line 144) | static void _tpm_log(int priority, const char *fmt, ...)
function _tpm_get_ticks (line 168) | static uint64_t _tpm_get_ticks(void)
function _tpm_write_to_storage (line 180) | static int _tpm_write_to_storage(uint8_t *data, size_t data_length)
function _tpm_read_from_storage (line 204) | static int _tpm_read_from_storage(uint8_t **data, size_t *data_length)
FILE: tpm/tpm_eviction.c
function dump_sessions (line 33) | static void dump_sessions(void)
function TPM_RESULT (line 43) | TPM_RESULT TPM_FlushSpecific(TPM_HANDLE handle,
FILE: tpm/tpm_handles.c
function TPM_KEY_DATA (line 21) | TPM_KEY_DATA *tpm_get_key_slot(TPM_KEY_HANDLE handle)
function TPM_SESSION_DATA (line 29) | TPM_SESSION_DATA *tpm_get_session_slot(TPM_HANDLE handle)
function TPM_DAA_SESSION_DATA (line 37) | TPM_DAA_SESSION_DATA *tpm_get_daa_slot(TPM_HANDLE handle)
function TPM_KEY_DATA (line 45) | TPM_KEY_DATA *tpm_get_key(TPM_KEY_HANDLE handle)
function TPM_SESSION_DATA (line 69) | TPM_SESSION_DATA *tpm_get_auth(TPM_AUTHHANDLE handle)
function TPM_SESSION_DATA (line 81) | TPM_SESSION_DATA *tpm_get_transport(TPM_TRANSHANDLE handle)
function TPM_COUNTER_VALUE (line 91) | TPM_COUNTER_VALUE *tpm_get_counter(TPM_COUNT_ID handle)
function TPM_DAA_SESSION_DATA (line 101) | TPM_DAA_SESSION_DATA *tpm_get_daa(TPM_DAAHANDLE handle)
FILE: tpm/tpm_identity.c
function TPM_RESULT (line 32) | TPM_RESULT TPM_MakeIdentity(
function TPM_RESULT (line 368) | TPM_RESULT TPM_ActivateIdentity(
FILE: tpm/tpm_integrity.c
function TPM_RESULT (line 34) | TPM_RESULT TPM_Extend(TPM_PCRINDEX pcrNum, TPM_DIGEST *inDigest,
function TPM_RESULT (line 56) | TPM_RESULT TPM_PCRRead(TPM_PCRINDEX pcrIndex, TPM_PCRVALUE *outDigest)
function TPM_RESULT (line 64) | TPM_RESULT TPM_Quote(TPM_KEY_HANDLE keyHandle, TPM_NONCE *extrnalData,
function TPM_RESULT (line 105) | TPM_RESULT TPM_PCR_Reset(TPM_PCR_SELECTION *pcrSelection)
function TPM_RESULT (line 130) | TPM_RESULT tpm_compute_pcr_digest(TPM_PCR_SELECTION *pcrSelection,
function TPM_RESULT (line 174) | TPM_RESULT tpm_verify_pcr(TPM_KEY_DATA *key, BOOL atrelease, BOOL atcrea...
function TPM_RESULT (line 204) | TPM_RESULT TPM_Quote2(TPM_KEY_HANDLE keyHandle, TPM_NONCE *externalData,
FILE: tpm/tpm_maintenance.c
function tpm_setup_privkey (line 27) | static int tpm_setup_privkey(TPM_KEY_DATA *key, TPM_KEY *privkey)
function TPM_RESULT (line 52) | TPM_RESULT TPM_CreateMaintenanceArchive(BOOL generateRandom, TPM_AUTH *a...
function TPM_RESULT (line 148) | TPM_RESULT TPM_LoadMaintenanceArchive(UINT32 archiveSize, BYTE *archive,
function TPM_RESULT (line 247) | TPM_RESULT TPM_KillMaintenanceFeature(TPM_AUTH *auth1)
function TPM_RESULT (line 258) | TPM_RESULT TPM_LoadManuMaintPub(TPM_NONCE *antiReplay, TPM_PUBKEY *pubKey,
function tpm_setup_pubkey (line 282) | static int tpm_setup_pubkey(TPM_PUBKEY_DATA *key, TPM_PUBKEY *pubkey)
function TPM_RESULT (line 310) | TPM_RESULT TPM_ReadManuMaintPub(TPM_NONCE *antiReplay, TPM_DIGEST *check...
FILE: tpm/tpm_management.c
function TPM_RESULT (line 25) | TPM_RESULT TPM_FieldUpgrade()
function TPM_RESULT (line 32) | TPM_RESULT TPM_SetRedirection(TPM_KEY_HANDLE keyHandle,
function TPM_RESULT (line 41) | TPM_RESULT TPM_ResetLockValue(TPM_AUTH *auth1)
FILE: tpm/tpm_marshalling.c
function tpm_marshal_UINT32_ARRAY (line 22) | int tpm_marshal_UINT32_ARRAY(BYTE **ptr, UINT32 *length,
function tpm_unmarshal_UINT32_ARRAY (line 32) | int tpm_unmarshal_UINT32_ARRAY(BYTE **ptr, UINT32 *length,
function tpm_marshal_TPM_STRUCT_VER (line 42) | int tpm_marshal_TPM_STRUCT_VER(BYTE **ptr, UINT32 *length, TPM_STRUCT_VE...
function tpm_unmarshal_TPM_STRUCT_VER (line 51) | int tpm_unmarshal_TPM_STRUCT_VER(BYTE **ptr, UINT32 *length, TPM_STRUCT_...
function tpm_marshal_TPM_VERSION (line 60) | int tpm_marshal_TPM_VERSION(BYTE **ptr, UINT32 *length, TPM_VERSION *v)
function tpm_unmarshal_TPM_VERSION (line 69) | int tpm_unmarshal_TPM_VERSION(BYTE **ptr, UINT32 *length, TPM_VERSION *v)
function tpm_marshal_TPM_DIGEST (line 78) | int tpm_marshal_TPM_DIGEST(BYTE **ptr, UINT32 *length, TPM_DIGEST *v)
function tpm_unmarshal_TPM_DIGEST (line 84) | int tpm_unmarshal_TPM_DIGEST(BYTE **ptr, UINT32 *length, TPM_DIGEST *v)
function tpm_marshal_TPM_PCRVALUE_ARRAY (line 90) | int tpm_marshal_TPM_PCRVALUE_ARRAY(BYTE **ptr, UINT32 *length,
function tpm_unmarshal_TPM_PCRVALUE_ARRAY (line 100) | int tpm_unmarshal_TPM_PCRVALUE_ARRAY(BYTE **ptr, UINT32 *length,
function tpm_marshal_TPM_NONCE (line 110) | int tpm_marshal_TPM_NONCE(BYTE **ptr, UINT32 *length, TPM_NONCE *v)
function tpm_unmarshal_TPM_NONCE (line 116) | int tpm_unmarshal_TPM_NONCE(BYTE **ptr, UINT32 *length, TPM_NONCE *v)
function tpm_marshal_TPM_AUTHDATA (line 122) | int tpm_marshal_TPM_AUTHDATA(BYTE **ptr, UINT32 *length, TPM_AUTHDATA *v)
function tpm_unmarshal_TPM_AUTHDATA (line 130) | int tpm_unmarshal_TPM_AUTHDATA(BYTE **ptr, UINT32 *length, TPM_AUTHDATA *v)
function tpm_marshal_TPM_AUTH (line 138) | int tpm_marshal_TPM_AUTH(BYTE **ptr, UINT32 *length, TPM_AUTH *v)
function tpm_unmarshal_TPM_AUTH (line 146) | int tpm_unmarshal_TPM_AUTH(BYTE **ptr, UINT32 *length, TPM_AUTH *v)
function tpm_marshal_TPM_KEY_HANDLE_LIST (line 155) | int tpm_marshal_TPM_KEY_HANDLE_LIST(BYTE **ptr, UINT32 *length, TPM_KEY_...
function tpm_marshal_TPM_CHANGEAUTH_VALIDATE (line 162) | int tpm_marshal_TPM_CHANGEAUTH_VALIDATE(BYTE **ptr, UINT32 *length, TPM_...
function tpm_unmarshal_TPM_CHANGEAUTH_VALIDATE (line 169) | int tpm_unmarshal_TPM_CHANGEAUTH_VALIDATE(BYTE **ptr, UINT32 *length, TP...
function tpm_marshal_TPM_COUNTER_VALUE (line 176) | int tpm_marshal_TPM_COUNTER_VALUE(BYTE **ptr, UINT32 *length, TPM_COUNTE...
function tpm_unmarshal_TPM_COUNTER_VALUE (line 184) | int tpm_unmarshal_TPM_COUNTER_VALUE(BYTE **ptr, UINT32 *length, TPM_COUN...
function tpm_marshal_TPM_PCR_SELECTION (line 192) | int tpm_marshal_TPM_PCR_SELECTION(BYTE **ptr, UINT32 *length, TPM_PCR_SE...
function tpm_unmarshal_TPM_PCR_SELECTION (line 200) | int tpm_unmarshal_TPM_PCR_SELECTION(BYTE **ptr, UINT32 *length, TPM_PCR_...
function tpm_marshal_TPM_PCR_COMPOSITE (line 208) | int tpm_marshal_TPM_PCR_COMPOSITE(BYTE **ptr, UINT32 *length, TPM_PCR_CO...
function tpm_unmarshal_TPM_PCR_COMPOSITE (line 218) | int tpm_unmarshal_TPM_PCR_COMPOSITE(BYTE **ptr, UINT32 *length, TPM_PCR_...
function tpm_marshal_TPM_PCR_INFO (line 228) | int tpm_marshal_TPM_PCR_INFO(BYTE **ptr, UINT32 *length, TPM_PCR_INFO *v)
function tpm_unmarshal_TPM_PCR_INFO (line 246) | int tpm_unmarshal_TPM_PCR_INFO(BYTE **ptr, UINT32 *length, TPM_PCR_INFO *v)
function tpm_marshal_TPM_PCR_INFO_SHORT (line 268) | int tpm_marshal_TPM_PCR_INFO_SHORT(BYTE **ptr, UINT32 *length, TPM_PCR_I...
function tpm_unmarshal_TPM_PCR_INFO_SHORT (line 276) | int tpm_unmarshal_TPM_PCR_INFO_SHORT(BYTE **ptr, UINT32 *length, TPM_PCR...
function tpm_marshal_TPM_PCR_ATTRIBUTES (line 284) | int tpm_marshal_TPM_PCR_ATTRIBUTES(BYTE **ptr, UINT32 *length, TPM_PCR_A...
function tpm_unmarshal_TPM_PCR_ATTRIBUTES (line 292) | int tpm_unmarshal_TPM_PCR_ATTRIBUTES(BYTE **ptr, UINT32 *length, TPM_PCR...
function tpm_marshal_TPM_STORED_DATA (line 300) | int tpm_marshal_TPM_STORED_DATA(BYTE **ptr, UINT32 *length, TPM_STORED_D...
function tpm_unmarshal_TPM_STORED_DATA (line 312) | int tpm_unmarshal_TPM_STORED_DATA(BYTE **ptr, UINT32 *length, TPM_STORED...
function tpm_marshal_TPM_SEALED_DATA (line 324) | int tpm_marshal_TPM_SEALED_DATA(BYTE **ptr, UINT32 *length, TPM_SEALED_D...
function tpm_unmarshal_TPM_SEALED_DATA (line 335) | int tpm_unmarshal_TPM_SEALED_DATA(BYTE **ptr, UINT32 *length, TPM_SEALED...
function tpm_marshal_TPM_SYMMETRIC_KEY (line 346) | int tpm_marshal_TPM_SYMMETRIC_KEY(BYTE **ptr, UINT32 *length, TPM_SYMMET...
function tpm_unmarshal_TPM_SYMMETRIC_KEY (line 355) | int tpm_unmarshal_TPM_SYMMETRIC_KEY(BYTE **ptr, UINT32 *length, TPM_SYMM...
function tpm_marshal_TPM_SYMMETRIC_KEY_PARMS (line 364) | int tpm_marshal_TPM_SYMMETRIC_KEY_PARMS(BYTE **ptr, UINT32 *length, TPM_...
function tpm_unmarshal_TPM_SYMMETRIC_KEY_PARMS (line 373) | int tpm_unmarshal_TPM_SYMMETRIC_KEY_PARMS(BYTE **ptr, UINT32 *length, TP...
function tpm_marshal_TPM_RSA_KEY_PARMS (line 382) | int tpm_marshal_TPM_RSA_KEY_PARMS(BYTE **ptr, UINT32 *length, TPM_RSA_KE...
function tpm_unmarshal_TPM_RSA_KEY_PARMS (line 391) | int tpm_unmarshal_TPM_RSA_KEY_PARMS(BYTE **ptr, UINT32 *length, TPM_RSA_...
function tpm_marshal_TPM_KEY_PARMS (line 400) | int tpm_marshal_TPM_KEY_PARMS(BYTE **ptr, UINT32 *length, TPM_KEY_PARMS *v)
function tpm_unmarshal_TPM_KEY_PARMS (line 419) | int tpm_unmarshal_TPM_KEY_PARMS(BYTE **ptr, UINT32 *length, TPM_KEY_PARM...
function tpm_marshal_TPM_STORE_PUBKEY (line 438) | int tpm_marshal_TPM_STORE_PUBKEY(BYTE **ptr, UINT32 *length, TPM_STORE_P...
function tpm_unmarshal_TPM_STORE_PUBKEY (line 445) | int tpm_unmarshal_TPM_STORE_PUBKEY(BYTE **ptr, UINT32 *length, TPM_STORE...
function tpm_marshal_TPM_KEY (line 452) | int tpm_marshal_TPM_KEY(BYTE **ptr, UINT32 *length, TPM_KEY *v)
function tpm_unmarshal_TPM_KEY (line 469) | int tpm_unmarshal_TPM_KEY(BYTE **ptr, UINT32 *length, TPM_KEY *v)
function tpm_marshal_TPM_PUBKEY (line 486) | int tpm_marshal_TPM_PUBKEY(BYTE **ptr, UINT32 *length, TPM_PUBKEY *v)
function tpm_unmarshal_TPM_PUBKEY (line 493) | int tpm_unmarshal_TPM_PUBKEY(BYTE **ptr, UINT32 *length, TPM_PUBKEY *v)
function tpm_marshal_TPM_STORE_PRIVKEY (line 500) | int tpm_marshal_TPM_STORE_PRIVKEY(BYTE **ptr, UINT32 *length, TPM_STORE_...
function tpm_unmarshal_TPM_STORE_PRIVKEY (line 507) | int tpm_unmarshal_TPM_STORE_PRIVKEY(BYTE **ptr, UINT32 *length, TPM_STOR...
function tpm_marshal_TPM_STORE_ASYMKEY (line 514) | int tpm_marshal_TPM_STORE_ASYMKEY(BYTE **ptr, UINT32 *length, TPM_STORE_...
function tpm_unmarshal_TPM_STORE_ASYMKEY (line 524) | int tpm_unmarshal_TPM_STORE_ASYMKEY(BYTE **ptr, UINT32 *length, TPM_STOR...
function tpm_marshal_TPM_MIGRATIONKEYAUTH (line 534) | int tpm_marshal_TPM_MIGRATIONKEYAUTH(BYTE **ptr, UINT32 *length, TPM_MIG...
function tpm_unmarshal_TPM_MIGRATIONKEYAUTH (line 542) | int tpm_unmarshal_TPM_MIGRATIONKEYAUTH(BYTE **ptr, UINT32 *length, TPM_M...
function tpm_marshal_TPM_CERTIFY_INFO (line 550) | int tpm_marshal_TPM_CERTIFY_INFO(BYTE **ptr, UINT32 *length, TPM_CERTIFY...
function tpm_unmarshal_TPM_CERTIFY_INFO (line 573) | int tpm_unmarshal_TPM_CERTIFY_INFO(BYTE **ptr, UINT32 *length, TPM_CERTI...
function tpm_marshal_TPM_IDENTITY_CONTENTS (line 596) | int tpm_marshal_TPM_IDENTITY_CONTENTS(BYTE **ptr, UINT32 *length, TPM_ID...
function tpm_unmarshal_TPM_IDENTITY_CONTENTS (line 605) | int tpm_unmarshal_TPM_IDENTITY_CONTENTS(BYTE **ptr, UINT32 *length, TPM_...
function tpm_marshal_TPM_CURRENT_TICKS (line 614) | int tpm_marshal_TPM_CURRENT_TICKS(BYTE **ptr, UINT32 *length, TPM_CURREN...
function tpm_unmarshal_TPM_CURRENT_TICKS (line 623) | int tpm_unmarshal_TPM_CURRENT_TICKS(BYTE **ptr, UINT32 *length, TPM_CURR...
function tpm_marshal_TPM_TRANSPORT_PUBLIC (line 632) | int tpm_marshal_TPM_TRANSPORT_PUBLIC(BYTE **ptr, UINT32 *length, TPM_TRA...
function tpm_unmarshal_TPM_TRANSPORT_PUBLIC (line 641) | int tpm_unmarshal_TPM_TRANSPORT_PUBLIC(BYTE **ptr, UINT32 *length, TPM_T...
function tpm_marshal_TPM_TRANSPORT_INTERNAL (line 650) | int tpm_marshal_TPM_TRANSPORT_INTERNAL(BYTE **ptr, UINT32 *length, TPM_T...
function tpm_unmarshal_TPM_TRANSPORT_INTERNAL (line 661) | int tpm_unmarshal_TPM_TRANSPORT_INTERNAL(BYTE **ptr, UINT32 *length, TPM...
function tpm_marshal_TPM_CONTEXT_BLOB (line 672) | int tpm_marshal_TPM_CONTEXT_BLOB(BYTE **ptr, UINT32 *length, TPM_CONTEXT...
function tpm_unmarshal_TPM_CONTEXT_BLOB (line 687) | int tpm_unmarshal_TPM_CONTEXT_BLOB(BYTE **ptr, UINT32 *length, TPM_CONTE...
function tpm_marshal_TPM_CONTEXT_SENSITIVE (line 702) | int tpm_marshal_TPM_CONTEXT_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_CO...
function tpm_unmarshal_TPM_CONTEXT_SENSITIVE (line 729) | int tpm_unmarshal_TPM_CONTEXT_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_...
function tpm_marshal_TPM_DAA_BLOB (line 756) | int tpm_marshal_TPM_DAA_BLOB(BYTE **ptr, UINT32 *length, TPM_DAA_BLOB *v)
function tpm_unmarshal_TPM_DAA_BLOB (line 770) | int tpm_unmarshal_TPM_DAA_BLOB(BYTE **ptr, UINT32 *length, TPM_DAA_BLOB *v)
function tpm_marshal_TPM_DAA_SENSITIVE (line 784) | int tpm_marshal_TPM_DAA_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_DAA_SE...
function tpm_unmarshal_TPM_DAA_SENSITIVE (line 793) | int tpm_unmarshal_TPM_DAA_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_DAA_...
function tpm_marshal_TPM_DAA_ISSUER (line 802) | int tpm_marshal_TPM_DAA_ISSUER(BYTE **ptr, UINT32 *length, TPM_DAA_ISSUE...
function tpm_unmarshal_TPM_DAA_ISSUER (line 816) | int tpm_unmarshal_TPM_DAA_ISSUER(BYTE **ptr, UINT32 *length, TPM_DAA_ISS...
function tpm_marshal_TPM_DAA_TPM (line 830) | int tpm_marshal_TPM_DAA_TPM(BYTE **ptr, UINT32 *length, TPM_DAA_TPM *v)
function tpm_unmarshal_TPM_DAA_TPM (line 842) | int tpm_unmarshal_TPM_DAA_TPM(BYTE **ptr, UINT32 *length, TPM_DAA_TPM *v)
function tpm_marshal_TPM_DAA_CONTEXT (line 854) | int tpm_marshal_TPM_DAA_CONTEXT(BYTE **ptr, UINT32 *length, TPM_DAA_CONT...
function tpm_unmarshal_TPM_DAA_CONTEXT (line 866) | int tpm_unmarshal_TPM_DAA_CONTEXT(BYTE **ptr, UINT32 *length, TPM_DAA_CO...
function tpm_marshal_TPM_DAA_JOINDATA (line 878) | int tpm_marshal_TPM_DAA_JOINDATA(BYTE **ptr, UINT32 *length, TPM_DAA_JOI...
function tpm_unmarshal_TPM_DAA_JOINDATA (line 887) | int tpm_unmarshal_TPM_DAA_JOINDATA(BYTE **ptr, UINT32 *length, TPM_DAA_J...
function tpm_marshal_TPM_DAA_SESSION_DATA (line 896) | int tpm_marshal_TPM_DAA_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_DAA...
function tpm_unmarshal_TPM_DAA_SESSION_DATA (line 907) | int tpm_unmarshal_TPM_DAA_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_D...
function tpm_marshal_TPM_MSA_COMPOSITE (line 918) | int tpm_marshal_TPM_MSA_COMPOSITE(BYTE **ptr, UINT32 *length, TPM_MSA_CO...
function tpm_unmarshal_TPM_MSA_COMPOSITE (line 929) | int tpm_unmarshal_TPM_MSA_COMPOSITE(BYTE **ptr, UINT32 *length, TPM_MSA_...
function tpm_marshal_TPM_CMK_AUTH (line 941) | int tpm_marshal_TPM_CMK_AUTH(BYTE **ptr, UINT32 *length, TPM_CMK_AUTH *v)
function tpm_unmarshal_TPM_CMK_AUTH (line 950) | int tpm_unmarshal_TPM_CMK_AUTH(BYTE **ptr, UINT32 *length, TPM_CMK_AUTH *v)
function tpm_marshal_TPM_SELECT_SIZE (line 959) | int tpm_marshal_TPM_SELECT_SIZE(BYTE **ptr, UINT32 *length, TPM_SELECT_S...
function tpm_unmarshal_TPM_SELECT_SIZE (line 967) | int tpm_unmarshal_TPM_SELECT_SIZE(BYTE **ptr, UINT32 *length, TPM_SELECT...
function tpm_marshal_TPM_CAP_VERSION_INFO (line 975) | int tpm_marshal_TPM_CAP_VERSION_INFO(BYTE **ptr, UINT32 *length, TPM_CAP...
function tpm_unmarshal_TPM_CAP_VERSION_INFO (line 991) | int tpm_unmarshal_TPM_CAP_VERSION_INFO(BYTE **ptr, UINT32 *length, TPM_C...
function tpm_marshal_TPM_ASYM_CA_CONTENTS (line 1007) | int tpm_marshal_TPM_ASYM_CA_CONTENTS(BYTE **ptr, UINT32 *length, TPM_ASY...
function tpm_unmarshal_TPM_ASYM_CA_CONTENTS (line 1015) | int tpm_unmarshal_TPM_ASYM_CA_CONTENTS(BYTE **ptr, UINT32 *length, TPM_A...
function tpm_marshal_TPM_QUOTE_INFO2 (line 1023) | int tpm_marshal_TPM_QUOTE_INFO2(BYTE **ptr, UINT32 *length, TPM_QUOTE_IN...
function tpm_unmarshal_TPM_QUOTE_INFO2 (line 1036) | int tpm_unmarshal_TPM_QUOTE_INFO2(BYTE **ptr, UINT32 *length, TPM_QUOTE_...
function tpm_marshal_TPM_EK_BLOB (line 1049) | int tpm_marshal_TPM_EK_BLOB(BYTE **ptr, UINT32 *length, TPM_EK_BLOB *v)
function tpm_unmarshal_TPM_EK_BLOB (line 1059) | int tpm_unmarshal_TPM_EK_BLOB(BYTE **ptr, UINT32 *length, TPM_EK_BLOB *v)
function tpm_marshal_TPM_EK_BLOB_ACTIVATE (line 1069) | int tpm_marshal_TPM_EK_BLOB_ACTIVATE(BYTE **ptr, UINT32 *length, TPM_EK_...
function tpm_unmarshal_TPM_EK_BLOB_ACTIVATE (line 1079) | int tpm_unmarshal_TPM_EK_BLOB_ACTIVATE(BYTE **ptr, UINT32 *length, TPM_E...
function tpm_marshal_TPM_NV_ATTRIBUTES (line 1089) | int tpm_marshal_TPM_NV_ATTRIBUTES(BYTE **ptr, UINT32 *length, TPM_NV_ATT...
function tpm_unmarshal_TPM_NV_ATTRIBUTES (line 1096) | int tpm_unmarshal_TPM_NV_ATTRIBUTES(BYTE **ptr, UINT32 *length, TPM_NV_A...
function tpm_marshal_TPM_NV_DATA_PUBLIC (line 1103) | int tpm_marshal_TPM_NV_DATA_PUBLIC(BYTE **ptr, UINT32 *length, TPM_NV_DA...
function tpm_unmarshal_TPM_NV_DATA_PUBLIC (line 1117) | int tpm_unmarshal_TPM_NV_DATA_PUBLIC(BYTE **ptr, UINT32 *length, TPM_NV_...
function tpm_marshal_TPM_NV_DATA_SENSITIVE (line 1131) | int tpm_marshal_TPM_NV_DATA_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_NV...
function tpm_unmarshal_TPM_NV_DATA_SENSITIVE (line 1140) | int tpm_unmarshal_TPM_NV_DATA_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_...
function tpm_marshal_TPM_DELEGATIONS (line 1149) | int tpm_marshal_TPM_DELEGATIONS(BYTE **ptr, UINT32 *length, TPM_DELEGATI...
function tpm_unmarshal_TPM_DELEGATIONS (line 1158) | int tpm_unmarshal_TPM_DELEGATIONS(BYTE **ptr, UINT32 *length, TPM_DELEGA...
function tpm_marshal_TPM_FAMILY_LABEL (line 1167) | int tpm_marshal_TPM_FAMILY_LABEL(BYTE **ptr, UINT32 *length, TPM_FAMILY_...
function tpm_unmarshal_TPM_FAMILY_LABEL (line 1173) | int tpm_unmarshal_TPM_FAMILY_LABEL(BYTE **ptr, UINT32 *length, TPM_FAMIL...
function tpm_marshal_TPM_FAMILY_TABLE_ENTRY (line 1179) | int tpm_marshal_TPM_FAMILY_TABLE_ENTRY(BYTE **ptr, UINT32 *length, TPM_F...
function tpm_unmarshal_TPM_FAMILY_TABLE_ENTRY (line 1189) | int tpm_unmarshal_TPM_FAMILY_TABLE_ENTRY(BYTE **ptr, UINT32 *length, TPM...
function tpm_marshal_TPM_DELEGATE_LABEL (line 1199) | int tpm_marshal_TPM_DELEGATE_LABEL(BYTE **ptr, UINT32 *length, TPM_DELEG...
function tpm_unmarshal_TPM_DELEGATE_LABEL (line 1205) | int tpm_unmarshal_TPM_DELEGATE_LABEL(BYTE **ptr, UINT32 *length, TPM_DEL...
function tpm_marshal_TPM_DELEGATE_PUBLIC (line 1211) | int tpm_marshal_TPM_DELEGATE_PUBLIC(BYTE **ptr, UINT32 *length, TPM_DELE...
function tpm_unmarshal_TPM_DELEGATE_PUBLIC (line 1222) | int tpm_unmarshal_TPM_DELEGATE_PUBLIC(BYTE **ptr, UINT32 *length, TPM_DE...
function tpm_marshal_TPM_DELEGATE_PUBLIC_ARRAY (line 1233) | int tpm_marshal_TPM_DELEGATE_PUBLIC_ARRAY(BYTE **ptr, UINT32 *length,
function tpm_unmarshal_TPM_DELEGATE_PUBLIC_ARRAY (line 1243) | int tpm_unmarshal_TPM_DELEGATE_PUBLIC_ARRAY(BYTE **ptr, UINT32 *length,
function tpm_marshal_TPM_DELEGATE_TABLE_ROW (line 1253) | int tpm_marshal_TPM_DELEGATE_TABLE_ROW(BYTE **ptr, UINT32 *length, TPM_D...
function tpm_unmarshal_TPM_DELEGATE_TABLE_ROW (line 1261) | int tpm_unmarshal_TPM_DELEGATE_TABLE_ROW(BYTE **ptr, UINT32 *length, TPM...
function tpm_marshal_TPM_DELEGATE_SENSITIVE (line 1269) | int tpm_marshal_TPM_DELEGATE_SENSITIVE(BYTE **ptr, UINT32 *length, TPM_D...
function tpm_unmarshal_TPM_DELEGATE_SENSITIVE (line 1276) | int tpm_unmarshal_TPM_DELEGATE_SENSITIVE(BYTE **ptr, UINT32 *length, TPM...
function tpm_marshal_TPM_DELEGATE_OWNER_BLOB (line 1283) | int tpm_marshal_TPM_DELEGATE_OWNER_BLOB(BYTE **ptr, UINT32 *length, TPM_...
function tpm_unmarshal_TPM_DELEGATE_OWNER_BLOB (line 1295) | int tpm_unmarshal_TPM_DELEGATE_OWNER_BLOB(BYTE **ptr, UINT32 *length, TP...
function tpm_marshal_TPM_DELEGATE_KEY_BLOB (line 1307) | int tpm_marshal_TPM_DELEGATE_KEY_BLOB(BYTE **ptr, UINT32 *length, TPM_DE...
function tpm_unmarshal_TPM_DELEGATE_KEY_BLOB (line 1320) | int tpm_unmarshal_TPM_DELEGATE_KEY_BLOB(BYTE **ptr, UINT32 *length, TPM_...
function tpm_marshal_TPM_PERMANENT_FLAGS (line 1333) | int tpm_marshal_TPM_PERMANENT_FLAGS(BYTE **ptr, UINT32 *length, TPM_PERM...
function tpm_unmarshal_TPM_PERMANENT_FLAGS (line 1359) | int tpm_unmarshal_TPM_PERMANENT_FLAGS(BYTE **ptr, UINT32 *length, TPM_PE...
function tpm_marshal_TPM_STCLEAR_FLAGS (line 1385) | int tpm_marshal_TPM_STCLEAR_FLAGS(BYTE **ptr, UINT32 *length, TPM_STCLEA...
function tpm_unmarshal_TPM_STCLEAR_FLAGS (line 1396) | int tpm_unmarshal_TPM_STCLEAR_FLAGS(BYTE **ptr, UINT32 *length, TPM_STCL...
function tpm_marshal_TPM_STANY_FLAGS (line 1407) | int tpm_marshal_TPM_STANY_FLAGS(BYTE **ptr, UINT32 *length, TPM_STANY_FL...
function tpm_unmarshal_TPM_STANY_FLAGS (line 1417) | int tpm_unmarshal_TPM_STANY_FLAGS(BYTE **ptr, UINT32 *length, TPM_STANY_...
function tpm_marshal_RSA (line 1427) | int tpm_marshal_RSA(BYTE **ptr, UINT32 *length, tpm_rsa_private_key_t *v)
function tpm_unmarshal_RSA (line 1448) | int tpm_unmarshal_RSA(BYTE **ptr, UINT32 *length, tpm_rsa_private_key_t *v)
function tpm_marshal_RSAPub (line 1469) | int tpm_marshal_RSAPub(BYTE **ptr, UINT32 *length, tpm_rsa_public_key_t *v)
function tpm_unmarshal_RSAPub (line 1487) | int tpm_unmarshal_RSAPub(BYTE **ptr, UINT32 *length, tpm_rsa_public_key_...
function tpm_marshal_TPM_KEY_DATA (line 1504) | int tpm_marshal_TPM_KEY_DATA(BYTE **ptr, UINT32 *length, TPM_KEY_DATA *v)
function tpm_unmarshal_TPM_KEY_DATA (line 1524) | int tpm_unmarshal_TPM_KEY_DATA(BYTE **ptr, UINT32 *length, TPM_KEY_DATA *v)
function tpm_marshal_TPM_PUBKEY_DATA (line 1544) | int tpm_marshal_TPM_PUBKEY_DATA(BYTE **ptr, UINT32 *length, TPM_PUBKEY_D...
function tpm_unmarshal_TPM_PUBKEY_DATA (line 1555) | int tpm_unmarshal_TPM_PUBKEY_DATA(BYTE **ptr, UINT32 *length, TPM_PUBKEY...
function tpm_marshal_TPM_PERMANENT_DATA (line 1566) | int tpm_marshal_TPM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, TPM_PERMA...
function tpm_unmarshal_TPM_PERMANENT_DATA (line 1629) | int tpm_unmarshal_TPM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, TPM_PER...
function tpm_marshal_TPM_STCLEAR_DATA (line 1692) | int tpm_marshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR...
function tpm_unmarshal_TPM_STCLEAR_DATA (line 1703) | int tpm_unmarshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLE...
function tpm_marshal_TPM_SESSION_DATA (line 1714) | int tpm_marshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION...
function tpm_unmarshal_TPM_SESSION_DATA (line 1730) | int tpm_unmarshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSI...
function tpm_marshal_TPM_STANY_DATA (line 1746) | int tpm_marshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DAT...
function tpm_unmarshal_TPM_STANY_DATA (line 1767) | int tpm_unmarshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_D...
function tpm_marshal_TPM_DATA (line 1788) | int tpm_marshal_TPM_DATA(BYTE **ptr, UINT32 *length, TPM_DATA *v)
function tpm_unmarshal_TPM_DATA (line 1800) | int tpm_unmarshal_TPM_DATA(BYTE **ptr, UINT32 *length, TPM_DATA *v)
function tpm_marshal_TPM_RESPONSE (line 1812) | int tpm_marshal_TPM_RESPONSE(BYTE **ptr, UINT32 *length, TPM_RESPONSE *v)
function tpm_unmarshal_TPM_REQUEST (line 1827) | int tpm_unmarshal_TPM_REQUEST(BYTE **ptr, UINT32 *length, TPM_REQUEST *v)
FILE: tpm/tpm_marshalling.h
function tpm_marshal_BYTE (line 58) | static inline int tpm_marshal_BYTE(BYTE **ptr, UINT32 *length, BYTE v)
function tpm_unmarshal_BYTE (line 66) | static inline int tpm_unmarshal_BYTE(BYTE **ptr, UINT32 *length, BYTE *v)
function tpm_marshal_UINT16 (line 74) | static inline int tpm_marshal_UINT16(BYTE **ptr, UINT32 *length, UINT16 v)
function tpm_unmarshal_UINT16 (line 83) | static inline int tpm_unmarshal_UINT16(BYTE **ptr, UINT32 *length, UINT1...
function tpm_marshal_UINT32 (line 91) | static inline int tpm_marshal_UINT32(BYTE **ptr, UINT32 *length, UINT32 v)
function tpm_unmarshal_UINT32 (line 100) | static inline int tpm_unmarshal_UINT32(BYTE **ptr, UINT32 *length, UINT3...
function tpm_marshal_UINT64 (line 109) | static inline int tpm_marshal_UINT64(BYTE **ptr, UINT32 *length, UINT64 v)
function tpm_unmarshal_UINT64 (line 120) | static inline int tpm_unmarshal_UINT64(BYTE **ptr, UINT32 *length, UINT6...
function tpm_marshal_BLOB (line 131) | static inline int tpm_marshal_BLOB(BYTE **ptr, UINT32 *ptr_length,
function tpm_unmarshal_BLOB (line 140) | static inline int tpm_unmarshal_BLOB(BYTE **ptr, UINT32 *ptr_length,
function tpm_marshal_BYTE_ARRAY (line 149) | static inline int tpm_marshal_BYTE_ARRAY(BYTE **ptr, UINT32 *ptr_length,
function tpm_unmarshal_BYTE_ARRAY (line 158) | static inline int tpm_unmarshal_BYTE_ARRAY(BYTE **ptr, UINT32 *ptr_length,
function tpm_marshal_BOOL (line 167) | static inline int tpm_marshal_BOOL(BYTE **ptr, UINT32 *length, BOOL v)
function tpm_unmarshal_BOOL (line 175) | static inline int tpm_unmarshal_BOOL(BYTE **ptr, UINT32 *length, BOOL *v)
FILE: tpm/tpm_migration.c
function tpm_compute_migration_digest (line 29) | static int tpm_compute_migration_digest(TPM_PUBKEY *migrationKey,
function tpm_verify_migration_digest (line 54) | static int tpm_verify_migration_digest(TPM_MIGRATIONKEYAUTH *migrationKe...
function TPM_RESULT (line 63) | TPM_RESULT TPM_CreateMigrationBlob(TPM_KEY_HANDLE parentHandle,
function TPM_RESULT (line 205) | TPM_RESULT TPM_ConvertMigrationBlob(TPM_KEY_HANDLE parentHandle,
function tpm_copy_pubkey (line 289) | static int tpm_copy_pubkey(TPM_PUBKEY *in, TPM_PUBKEY *out)
function TPM_RESULT (line 307) | TPM_RESULT TPM_AuthorizeMigrationKey(TPM_MIGRATE_SCHEME migrateScheme,
function TPM_RESULT (line 337) | TPM_RESULT TPM_MigrateKey(TPM_KEY_HANDLE maKeyHandle, TPM_PUBKEY *pubKey,
function TPM_RESULT (line 390) | TPM_RESULT TPM_CMK_SetRestrictions(TPM_CMK_DELEGATE restriction,
function TPM_RESULT (line 404) | TPM_RESULT TPM_CMK_ApproveMA(TPM_DIGEST *migrationAuthorityDigest,
function TPM_RESULT (line 425) | TPM_RESULT TPM_CMK_CreateKey(TPM_KEY_HANDLE parentHandle,
function TPM_RESULT (line 558) | TPM_RESULT TPM_CMK_CreateTicket(TPM_PUBKEY *verificationKey,
function TPM_RESULT (line 601) | TPM_RESULT TPM_CMK_CreateBlob(TPM_KEY_HANDLE parentHandle,
function TPM_RESULT (line 812) | TPM_RESULT TPM_CMK_ConvertMigration(TPM_KEY_HANDLE parentHandle,
FILE: tpm/tpm_nv_storage.c
function TPM_NV_DATA_SENSITIVE (line 27) | TPM_NV_DATA_SENSITIVE *tpm_get_nvs(TPM_NV_INDEX index)
function TPM_NV_DATA_SENSITIVE (line 39) | static TPM_NV_DATA_SENSITIVE *tpm_get_free_nvs(void)
function tpm_nv_remove_data (line 50) | void tpm_nv_remove_data(TPM_NV_DATA_SENSITIVE *nv)
function TPM_RESULT (line 70) | TPM_RESULT TPM_NV_DefineSpace(TPM_NV_DATA_PUBLIC *pubInfo,
function TPM_RESULT (line 177) | static TPM_RESULT nv_write(TPM_NV_DATA_SENSITIVE *nv, UINT32 offset,
function TPM_RESULT (line 219) | TPM_RESULT TPM_NV_WriteValue(TPM_NV_INDEX nvIndex, UINT32 offset,
function TPM_RESULT (line 260) | TPM_RESULT TPM_NV_WriteValueAuth(TPM_NV_INDEX nvIndex, UINT32 offset,
function TPM_RESULT (line 281) | TPM_RESULT nv_read(TPM_NV_DATA_SENSITIVE *nv, UINT32 offset,
function TPM_RESULT (line 322) | TPM_RESULT TPM_NV_ReadValue(TPM_NV_INDEX nvIndex, UINT32 offset,
function TPM_RESULT (line 355) | TPM_RESULT TPM_NV_ReadValueAuth(TPM_NV_INDEX nvIndex, UINT32 offset,
FILE: tpm/tpm_owner.c
function TPM_RESULT (line 28) | TPM_RESULT TPM_SetOwnerInstall(BOOL state)
function TPM_RESULT (line 37) | TPM_RESULT TPM_OwnerSetDisable(BOOL disableState, TPM_AUTH *auth1)
function TPM_RESULT (line 47) | TPM_RESULT TPM_PhysicalEnable()
function TPM_RESULT (line 55) | TPM_RESULT TPM_PhysicalDisable()
function TPM_RESULT (line 63) | TPM_RESULT TPM_PhysicalSetDeactivated(BOOL state)
function TPM_RESULT (line 71) | TPM_RESULT TPM_SetTempDeactivated(TPM_AUTH *auth1)
function TPM_RESULT (line 86) | TPM_RESULT TPM_SetOperatorAuth(TPM_SECRET *operatorAuth)
function TPM_RESULT (line 100) | TPM_RESULT TPM_TakeOwnership(TPM_PROTOCOL_ID protocolID,
function tpm_owner_clear (line 185) | void tpm_owner_clear()
function TPM_RESULT (line 250) | TPM_RESULT TPM_OwnerClear(TPM_AUTH *auth1)
function TPM_RESULT (line 261) | TPM_RESULT TPM_ForceClear()
function TPM_RESULT (line 270) | TPM_RESULT TPM_DisableOwnerClear(TPM_AUTH *auth1)
function TPM_RESULT (line 280) | TPM_RESULT TPM_DisableForceClear()
function TPM_RESULT (line 287) | TPM_RESULT TSC_PhysicalPresence(TPM_PHYSICAL_PRESENCE physicalPresence)
function TPM_RESULT (line 314) | TPM_RESULT TSC_ResetEstablishmentBit()
FILE: tpm/tpm_startup.c
function TPM_Init (line 27) | void TPM_Init(TPM_STARTUP_TYPE startupType)
function TPM_RESULT (line 40) | TPM_RESULT TPM_Startup(TPM_STARTUP_TYPE startupType)
function TPM_RESULT (line 104) | TPM_RESULT TPM_SaveState()
FILE: tpm/tpm_storage.c
function TPM_KEY_HANDLE (line 29) | TPM_KEY_HANDLE tpm_get_free_key(void)
function tpm_encrypt_public (line 41) | int tpm_encrypt_public(TPM_PUBKEY_DATA *key, BYTE *in, UINT32 in_size,
function tpm_encrypt_private (line 61) | int tpm_encrypt_private(TPM_KEY_DATA *key, BYTE *in, UINT32 in_size,
function tpm_decrypt (line 73) | int tpm_decrypt(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size,
function tpm_encrypt_sealed_data (line 93) | int tpm_encrypt_sealed_data(TPM_KEY_DATA *key, TPM_SEALED_DATA *seal,
function tpm_decrypt_sealed_data (line 110) | int tpm_decrypt_sealed_data(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size,
function tpm_encrypt_private_key (line 124) | int tpm_encrypt_private_key(TPM_KEY_DATA *key, TPM_STORE_ASYMKEY *store,
function tpm_decrypt_private_key (line 141) | int tpm_decrypt_private_key(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size,
function tpm_xor_encrypt (line 160) | static void tpm_xor_encrypt(TPM_SESSION_DATA *session, TPM_NONCE *nonceOdd,
function tpm_compute_key_digest (line 178) | int tpm_compute_key_digest(TPM_KEY *key, TPM_DIGEST *digest)
function tpm_compute_key_data_digest (line 197) | int tpm_compute_key_data_digest(TPM_KEY_DATA *key, TPM_DIGEST *digest)
function tpm_verify_key_digest (line 220) | static int tpm_verify_key_digest(TPM_KEY *key, TPM_DIGEST *digest)
function tpm_compute_pubkey_checksum (line 227) | int tpm_compute_pubkey_checksum(TPM_NONCE *antiReplay, TPM_PUBKEY *pubKey,
function tpm_compute_pubkey_digest (line 243) | int tpm_compute_pubkey_digest(TPM_PUBKEY *key, TPM_DIGEST *digest)
function tpm_setup_key_parms (line 262) | int tpm_setup_key_parms(TPM_KEY_DATA *key, TPM_KEY_PARMS *parms)
function tpm_setup_pubkey_data (line 284) | int tpm_setup_pubkey_data(TPM_PUBKEY *in, TPM_PUBKEY_DATA *out)
function tpm_extract_pubkey (line 297) | int tpm_extract_pubkey(TPM_KEY_DATA *key, TPM_PUBKEY *pubKey)
function tpm_extract_store_pubkey (line 314) | int tpm_extract_store_pubkey(TPM_KEY_DATA *key, TPM_STORE_PUBKEY *pubKey)
function compute_store_digest (line 326) | static int compute_store_digest(TPM_STORED_DATA *store, TPM_DIGEST *digest)
function verify_store_digest (line 345) | static int verify_store_digest(TPM_STORED_DATA *store, TPM_DIGEST *digest)
function TPM_RESULT (line 353) | TPM_RESULT TPM_Seal(TPM_KEY_HANDLE keyHandle, TPM_ENCAUTH *encAuth,
function TPM_RESULT (line 423) | TPM_RESULT TPM_Sealx(TPM_KEY_HANDLE keyHandle, TPM_ENCAUTH *encAuth,
function TPM_RESULT (line 493) | TPM_RESULT TPM_Unseal(TPM_KEY_HANDLE parentHandle, TPM_STORED_DATA *inData,
function TPM_RESULT (line 572) | TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE keyHandle, UINT32 inDataSize,
function TPM_RESULT (line 623) | TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HANDLE parentHandle,
function TPM_RESULT (line 737) | TPM_RESULT TPM_LoadKey(TPM_KEY_HANDLE parentHandle, TPM_KEY *inKey,
function TPM_RESULT (line 841) | TPM_RESULT TPM_LoadKey2(TPM_KEY_HANDLE parentHandle, TPM_KEY *inKey,
function TPM_RESULT (line 848) | TPM_RESULT internal_TPM_LoadKey(TPM_KEY *inKey, TPM_KEY_HANDLE *inkeyHan...
function TPM_RESULT (line 905) | TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE keyHandle, TPM_AUTH *auth1,
FILE: tpm/tpm_structures.h
type BYTE (line 32) | typedef uint8_t BYTE;
type UINT16 (line 33) | typedef uint16_t UINT16;
type UINT32 (line 34) | typedef uint32_t UINT32;
type UINT64 (line 35) | typedef uint64_t UINT64;
type BYTE (line 36) | typedef BYTE BOOL;
type BYTE (line 43) | typedef BYTE TPM_AUTH_DATA_USAGE;
type BYTE (line 44) | typedef BYTE TPM_PAYLOAD_TYPE;
type BYTE (line 45) | typedef BYTE TPM_VERSION_BYTE;
type BYTE (line 46) | typedef BYTE TPM_DA_STATE;
type UINT16 (line 47) | typedef UINT16 TPM_TAG;
type UINT16 (line 48) | typedef UINT16 TPM_PROTOCOL_ID;
type UINT16 (line 49) | typedef UINT16 TPM_STARTUP_TYPE;
type UINT16 (line 50) | typedef UINT16 TPM_ENC_SCHEME;
type UINT16 (line 51) | typedef UINT16 TPM_SIG_SCHEME;
type UINT16 (line 52) | typedef UINT16 TPM_MIGRATE_SCHEME;
type UINT16 (line 53) | typedef UINT16 TPM_PHYSICAL_PRESENCE;
type UINT16 (line 54) | typedef UINT16 TPM_ENTITY_TYPE;
type UINT16 (line 55) | typedef UINT16 TPM_KEY_USAGE;
type UINT16 (line 56) | typedef UINT16 TPM_EK_TYPE;
type UINT16 (line 57) | typedef UINT16 TPM_STRUCTURE_TAG;
type UINT16 (line 58) | typedef UINT16 TPM_PLATFORM_SPECIFIC;
type UINT32 (line 59) | typedef UINT32 TPM_COMMAND_CODE;
type UINT32 (line 60) | typedef UINT32 TPM_CAPABILITY_AREA;
type UINT32 (line 61) | typedef UINT32 TPM_KEY_FLAGS;
type UINT32 (line 62) | typedef UINT32 TPM_ALGORITHM_ID;
type UINT32 (line 63) | typedef UINT32 TPM_MODIFIER_INDICATOR;
type UINT32 (line 64) | typedef UINT32 TPM_ACTUAL_COUNT;
type UINT32 (line 65) | typedef UINT32 TPM_TRANSPORT_ATTRIBUTES;
type UINT32 (line 66) | typedef UINT32 TPM_AUTHHANDLE;
type UINT32 (line 67) | typedef UINT32 TPM_DIRINDEX;
type UINT32 (line 68) | typedef UINT32 TPM_KEY_HANDLE;
type UINT32 (line 69) | typedef UINT32 TPM_PCRINDEX;
type UINT32 (line 70) | typedef UINT32 TPM_RESULT;
type UINT32 (line 71) | typedef UINT32 TPM_RESOURCE_TYPE;
type UINT32 (line 72) | typedef UINT32 TPM_KEY_CONTROL;
type UINT32 (line 73) | typedef UINT32 TPM_NV_INDEX;
type UINT32 (line 74) | typedef UINT32 TPM_FAMILY_ID;
type UINT32 (line 75) | typedef UINT32 TPM_FAMILY_VERIFICATION;
type UINT32 (line 76) | typedef UINT32 TPM_STARTUP_EFFECTS;
type UINT32 (line 77) | typedef UINT32 TPM_SYM_MODE;
type UINT32 (line 78) | typedef UINT32 TPM_FAMILY_FLAGS;
type UINT32 (line 79) | typedef UINT32 TPM_DELEGATE_INDEX;
type UINT32 (line 80) | typedef UINT32 TPM_CMK_DELEGATE;
type UINT32 (line 81) | typedef UINT32 TPM_COUNT_ID;
type UINT32 (line 82) | typedef UINT32 TPM_REDIT_COMMAND;
type UINT32 (line 83) | typedef UINT32 TPM_TRANSHANDLE;
type UINT32 (line 84) | typedef UINT32 TPM_HANDLE;
type UINT32 (line 85) | typedef UINT32 TPM_FAMILY_OPERATION;
type TPM_STRUCT_VER (line 270) | typedef struct tdTPM_STRUCT_VER {
type TPM_VERSION (line 283) | typedef struct tdTPM_VERSION {
type TPM_DIGEST (line 296) | typedef struct tdTPM_DIGEST {
type TPM_DIGEST (line 301) | typedef TPM_DIGEST TPM_CHOSENID_HASH;
type TPM_DIGEST (line 302) | typedef TPM_DIGEST TPM_COMPOSITE_HASH;
type TPM_DIGEST (line 303) | typedef TPM_DIGEST TPM_DIRVALUE;
type TPM_DIGEST (line 304) | typedef TPM_DIGEST TPM_HMAC;
type TPM_DIGEST (line 305) | typedef TPM_DIGEST TPM_PCRVALUE;
type TPM_DIGEST (line 306) | typedef TPM_DIGEST TPM_AUDITDIGEST;
type TPM_NONCE (line 312) | typedef struct tdTPM_NONCE{
type TPM_NONCE (line 317) | typedef TPM_NONCE TPM_DAA_TPM_SEED;
type TPM_NONCE (line 318) | typedef TPM_NONCE TPM_DAA_CONTEXT_SEED;
type BYTE (line 325) | typedef BYTE TPM_AUTHDATA[20];
type TPM_AUTHDATA (line 328) | typedef TPM_AUTHDATA TPM_SECRET;
type TPM_AUTHDATA (line 329) | typedef TPM_AUTHDATA TPM_ENCAUTH;
type TPM_KEY_HANDLE_LIST (line 336) | typedef struct tdTPM_KEY_HANDLE_LIST {
type TPM_CHANGEAUTH_VALIDATE (line 395) | typedef struct tdTPM_CHANGEAUTH_VALIDATE {
type TPM_COUNTER_VALUE (line 407) | typedef struct tdTPM_COUNTER_VALUE {
type TPM_SIGN_INFO (line 423) | typedef struct tdTPM_SIGN_INFO {
type TPM_MSA_COMPOSITE (line 438) | typedef struct tdTPM_MSA_COMPOSITE {
type TPM_CMK_AUTH (line 447) | typedef struct tdTPM_CMK_AUTH {
type TPM_SELECT_SIZE (line 470) | typedef struct tdTPM_SELECT_SIZE {
type TPM_CMK_MIGAUTH (line 481) | typedef struct tdTPM_CMK_MIGAUTH {
type TPM_CMK_SIGTICKET (line 492) | typedef struct tdTPM_CMK_SIGTICKET {
type TPM_CMK_MA_APPROVAL (line 503) | typedef struct tdTPM_CMK_MA_APPROVAL {
type TPM_PCR_SELECTION (line 686) | typedef struct tdTPM_PCR_SELECTION {
type TPM_PCR_COMPOSITE (line 697) | typedef struct tdTPM_PCR_COMPOSITE {
type BYTE (line 712) | typedef BYTE TPM_LOCALITY_SELECTION;
type TPM_PCR_INFO (line 730) | typedef struct tdTPM_PCR_INFO {
type TPM_PCR_INFO_SHORT (line 748) | typedef struct tdTPM_PCR_INFO_SHORT {
type TPM_PCR_ATTRIBUTES (line 760) | typedef struct tdTPM_PCR_ATTRIBUTES {
type TPM_STORED_DATA (line 778) | typedef struct tdTPM_STORED_DATA {
type TPM_SEALED_DATA (line 796) | typedef struct tdTPM_SEALED_DATA {
type TPM_SYMMETRIC_KEY (line 811) | typedef struct tdTPM_SYMMETRIC_KEY {
type TPM_BOUND_DATA (line 824) | typedef struct tdTPM_BOUND_DATA {
type TPM_RSA_KEY_PARMS (line 841) | typedef struct tdTPM_RSA_KEY_PARMS {
type TPM_SYMMETRIC_KEY_PARMS (line 855) | typedef struct tdTPM_SYMMETRIC_KEY_PARMS {
type TPM_KEY_PARMS (line 869) | typedef struct tdTPM_KEY_PARMS {
type TPM_STORE_PUBKEY (line 894) | typedef struct tdTPM_STORE_PUBKEY {
type TPM_KEY (line 910) | typedef struct tdTPM_KEY {
type TPM_PUBKEY (line 934) | typedef struct tdTPM_PUBKEY {
type TPM_STORE_PRIVKEY (line 948) | typedef struct tdTPM_STORE_PRIVKEY {
type TPM_STORE_ASYMKEY (line 960) | typedef struct tdTPM_STORE_ASYMKEY {
type TPM_MIGRATE_ASYMKEY (line 976) | typedef struct tdTPM_MIGRATE_ASYMKEY {
type TPM_MIGRATIONKEYAUTH (line 991) | typedef struct tdTPM_MIGRATIONKEYAUTH {
type TPM_AUTH (line 1015) | typedef struct tdTPM_AUTH {
type TPM_CERTIFY_INFO (line 1034) | typedef struct tdTPM_CERTIFY_INFO {
type TPM_QUOTE_INFO (line 1062) | typedef struct tdTPM_QUOTE_INFO {
type TPM_QUOTE_INFO2 (line 1075) | typedef struct tdTPM_QUOTE_INFO2 {
type TPM_EK_BLOB (line 1094) | typedef struct tdTPM_EK_BLOB {
type TPM_EK_BLOB_ACTIVATE (line 1107) | typedef struct tdTPM_EK_BLOB_ACTIVATE {
type TPM_EK_BLOB_AUTH (line 1120) | typedef struct tdTPM_EK_BLOB_AUTH {
type TPM_IDENTITY_CONTENTS (line 1130) | typedef struct tdTPM_IDENTITY_CONTENTS {
type TPM_ASYM_CA_CONTENTS (line 1154) | typedef struct tdTPM_ASYM_CA_CONTENTS {
type TPM_CURRENT_TICKS (line 1174) | typedef struct tdTPM_CURRENT_TICKS {
type TPM_TRANSPORT_PUBLIC (line 1191) | typedef struct tdTPM_TRANSPORT_PUBLIC {
type TPM_TRANSPORT_INTERNAL (line 1209) | typedef struct tdTPM_TRANSPORT_INTERNAL {
type TPM_TRANSPORT_LOG_IN (line 1225) | typedef struct tdTPM_TRANSPORT_LOG_IN {
type TPM_TRANSPORT_LOG_OUT (line 1238) | typedef struct tdTPM_TRANSPORT_LOG_OUT {
type TPM_TRANSPORT_AUTH (line 1252) | typedef struct tdTPM_TRANSPORT_AUTH {
type TPM_AUDIT_EVENT_IN (line 1268) | typedef struct tdTPM_AUDIT_EVENT_IN {
type TPM_AUDIT_EVENT_OUT (line 1282) | typedef struct tdTPM_AUDIT_EVENT_OUT {
type TPM_NV_ATTRIBUTES (line 1436) | typedef struct tdTPM_NV_ATTRIBUTES {
type TPM_NV_DATA_PUBLIC (line 1460) | typedef struct tdTPM_NV_DATA_PUBLIC {
type TPM_NV_DATA_SENSITIVE (line 1481) | typedef struct tdTPM_NV_DATA_SENSITIVE {
type TPM_DELEGATIONS (line 1515) | typedef struct tdTPM_DELEGATIONS {
type TPM_FAMILY_LABEL (line 1616) | typedef struct tdTPM_FAMILY_LABEL {
type TPM_FAMILY_TABLE_ENTRY (line 1626) | typedef struct tdTPM_FAMILY_TABLE_ENTRY {
type TPM_FAMILY_TABLE (line 1644) | typedef struct tdTPM_FAMILY_TABLE {
type TPM_DELEGATE_LABEL (line 1653) | typedef struct tdTPM_DELEGATE_LABEL {
type TPM_DELEGATE_PUBLIC (line 1664) | typedef struct tdTPM_DELEGATE_PUBLIC {
type TPM_DELEGATE_TABLE_ROW (line 1681) | typedef struct tdTPM_DELEGATE_TABLE_ROW {
type TPM_DELEGATE_TABLE (line 1697) | typedef struct tdTPM_DELEGATE_TABLE {
type TPM_DELEGATE_SENSITIVE (line 1707) | typedef struct tdTPM_DELEGATE_SENSITIVE {
type TPM_DELEGATE_OWNER_BLOB (line 1719) | typedef struct tdTPM_DELEGATE_OWNER_BLOB {
type TPM_DELEGATE_KEY_BLOB (line 1741) | typedef struct tdTPM_DELEGATE_KEY_BLOB {
type TPM_CAP_VERSION_INFO (line 1842) | typedef struct tdTPM_CAP_VERSION_INFO {
type TPM_DA_ACTION_TYPE (line 1860) | typedef struct tdTPM_DA_ACTION_TYPE {
type TPM_DA_INFO (line 1876) | typedef struct tdTPM_DA_INFO {
type TPM_DA_INFO_LIMITED (line 1896) | typedef struct tdTPM_DA_INFO_LIMITED {
type TPM_DAA_ISSUER (line 1944) | typedef struct tdTPM_DAA_ISSUER {
type TPM_DAA_TPM (line 1962) | typedef struct tdTPM_DAA_TPM {
type TPM_DAA_CONTEXT (line 1977) | typedef struct tdTPM_DAA_CONTEXT {
type TPM_DAA_JOINDATA (line 1992) | typedef struct tdTPM_DAA_JOINDATA {
type TPM_DAA_BLOB (line 2004) | typedef struct tdTPM_DAA_BLOB {
type TPM_DAA_SENSITIVE (line 2023) | typedef struct tdTPM_DAA_SENSITIVE {
type UINT32 (line 2039) | typedef UINT32 TPM_REDIR_COMMAND;
type TPM_PERMANENT_FLAGS (line 2051) | typedef struct tdTPM_PERMANENT_FLAGS {
type TPM_STCLEAR_FLAGS (line 2086) | typedef struct tdTPM_STCLEAR_FLAGS {
type TPM_STANY_FLAGS (line 2101) | typedef struct tdTPM_STANY_FLAGS {
type TPM_KEY_DATA (line 2114) | typedef struct tdTPM_KEY_DATA {
type TPM_PUBKEY_DATA (line 2139) | typedef struct tdTPM_PUBKEY_DATA {
type TPM_PERMANENT_DATA (line 2167) | typedef struct tdTPM_PERMANENT_DATA {
function sizeof_TPM_PERMANENT_DATA (line 2203) | static inline int sizeof_TPM_PERMANENT_DATA(TPM_PERMANENT_DATA *s) {
function free_TPM_PERMANENT_DATA (line 2240) | static inline void free_TPM_PERMANENT_DATA(TPM_PERMANENT_DATA *s)
type TPM_STCLEAR_DATA (line 2258) | typedef struct tdTPM_STCLEAR_DATA {
type TPM_SESSION_DATA (line 2278) | typedef struct tdTPM_SESSION_DATA {
type UINT32 (line 2299) | typedef UINT32 TPM_DAAHANDLE;
type TPM_DAA_SESSION_DATA (line 2300) | typedef struct tdTPM_DAA_SESSION_DATA {
type TPM_STANY_DATA (line 2324) | typedef struct tdTPM_STANY_DATA {
type TPM_DATA (line 2348) | typedef struct tdTPM_DATA {
type TPM_CONTEXT_BLOB (line 2380) | typedef struct tdTPM_CONTEXT_BLOB {
type TPM_CONTEXT_SENSITIVE (line 2405) | typedef struct tdTPM_CONTEXT_SENSITIVE {
type TPM_REQUEST (line 2426) | typedef struct tdTPM_REQUEST {
type TPM_RESPONSE (line 2440) | typedef struct tdTPM_RESPONSE {
FILE: tpm/tpm_testing.c
function tpm_test_prng (line 25) | static int tpm_test_prng(void)
function tpm_test_sha1 (line 89) | static int tpm_test_sha1(void)
function tpm_test_hmac (line 122) | static int tpm_test_hmac(void)
function tpm_test_rsa_EK (line 175) | static int tpm_test_rsa_EK(void)
function TPM_RESULT (line 241) | TPM_RESULT TPM_SelfTestFull(void)
function TPM_RESULT (line 268) | TPM_RESULT TPM_ContinueSelfTest(void)
function TPM_RESULT (line 275) | TPM_RESULT TPM_GetTestResult(UINT32 *outDataSize, BYTE **outData)
FILE: tpm/tpm_ticks.c
function TPM_RESULT (line 30) | TPM_RESULT TPM_GetTicks(TPM_CURRENT_TICKS *currentTime)
function TPM_RESULT (line 38) | TPM_RESULT TPM_TickStampBlob(TPM_KEY_HANDLE keyHandle, TPM_NONCE *antiRe...
function tpm_update_ticks (line 90) | void tpm_update_ticks(void)
FILE: tpm/tpm_transport.c
function debug_buf (line 34) | static void debug_buf(const char *str, uint8_t *buf, size_t buf_len)
function decrypt_transport_auth (line 48) | static int decrypt_transport_auth(TPM_KEY_DATA *key, BYTE *enc, UINT32 e...
function transport_log_in (line 73) | static void transport_log_in(BYTE *params, BYTE *pubKeyHash,
function transport_log_out (line 91) | static void transport_log_out(BYTE *params, TPM_DIGEST *transDigest)
function TPM_RESULT (line 109) | TPM_RESULT TPM_EstablishTransport(TPM_KEY_HANDLE encHandle,
function decrypt_wrapped_command (line 200) | static void decrypt_wrapped_command(BYTE *buf, UINT32 buf_len, TPM_AUTH ...
function encrypt_wrapped_command (line 222) | static void encrypt_wrapped_command(BYTE *buf, UINT32 buf_len, TPM_AUTH ...
function compute_key_digest (line 243) | static void compute_key_digest(TPM_REQUEST *req, TPM_DIGEST *digest)
function TPM_RESULT (line 295) | TPM_RESULT TPM_ExecuteTransport(UINT32 inWrappedCmdSize, BYTE *inWrapped...
function TPM_RESULT (line 416) | TPM_RESULT TPM_ReleaseTransportSigned(TPM_KEY_HANDLE keyHandle,
FILE: tpmd/unix/tpmd.c
function my_log (line 53) | void my_log(int priority, const char *fmt, ...)
function print_usage (line 77) | static void print_usage(char *name)
function parse_options (line 95) | static void parse_options(int argc, char **argv)
function switch_uid_gid (line 202) | static void switch_uid_gid(void)
function signal_handler (line 220) | static void signal_handler(int sig)
function init_signal_handler (line 226) | static void init_signal_handler(void)
function daemonize (line 247) | static void daemonize(void)
function mkdirs (line 281) | static int mkdirs(const char *path)
function init_socket (line 298) | static int init_socket(const char *name)
function init_device (line 321) | static int init_device(const char *name)
function handle_emuldev_command (line 347) | static int handle_emuldev_command(int devfd)
function main_loop (line 379) | static void main_loop(void)
function main (line 522) | int main(int argc, char **argv)
FILE: tpmd/windows/tpmd.c
function my_log (line 47) | void my_log(int priority, const char *fmt, ...)
function print_usage (line 75) | static void print_usage(char *name)
function parse_options (line 89) | static int parse_options(int argc, char **argv)
function BOOL (line 167) | BOOL signal_handler(DWORD event)
function init_signal_handler (line 178) | static int init_signal_handler(void)
function main_loop (line 188) | static void main_loop(void)
function BOOL (line 257) | BOOL updateServiceStatus(DWORD currentState, DWORD winExitCode,
function serviceCtrlHandler (line 282) | void serviceCtrlHandler(DWORD code)
function serviceMain (line 298) | void serviceMain(int argc, char **argv)
function main (line 326) | int main(int argc, char **argv)
FILE: tpmd_dev/darwin/tpm_bridge.c
type sockaddr_un (line 71) | struct sockaddr_un
type sockaddr_un (line 72) | struct sockaddr_un
type proc (line 86) | struct proc
type cdevsw (line 88) | struct cdevsw
function tpm_dev_open (line 114) | int
function tpm_dev_read (line 141) | int
function tpm_dev_write (line 201) | int
function tpmd_connect (line 256) | static int
function tpmd_disconnect (line 289) | static void
function tpm_bridge_locking_start (line 299) | static int
function tpm_bridge_locking_stop (line 331) | static int
function tpm_bridge_devfs_start (line 357) | static int
function tpm_bridge_devfs_stop (line 376) | static int
function kern_return_t (line 399) | kern_return_t
function kern_return_t (line 426) | kern_return_t
FILE: tpmd_dev/linux/tpmd_dev.c
type semaphore (line 62) | struct semaphore
type socket (line 75) | struct socket
type sockaddr_un (line 76) | struct sockaddr_un
function tpmd_connect (line 78) | static int tpmd_connect(char *socket_name)
function tpmd_disconnect (line 100) | static void tpmd_disconnect(void)
function tpmd_handle_command (line 106) | static int tpmd_handle_command(const uint8_t *in, uint32_t in_size)
function tpm_open (line 137) | static int tpm_open(struct inode *inode, struct file *file)
function tpm_release (line 152) | static int tpm_release(struct inode *inode, struct file *file)
function tpm_read (line 166) | static ssize_t tpm_read(struct file *file, char __user *buf, size_t coun...
function tpm_write (line 185) | static ssize_t tpm_write(struct file *file, const char __user *buf, size...
function tpm_ioctl (line 215) | static long tpm_ioctl(struct file *file, unsigned int cmd, unsigned long...
type file_operations (line 252) | struct file_operations
type miscdevice (line 261) | struct miscdevice
function init_tpm_module (line 267) | int __init init_tpm_module(void)
function cleanup_tpm_module (line 283) | void __exit cleanup_tpm_module(void)
FILE: tpmd_dev/openbsd/tpmd_dev.c
type uio (line 40) | struct uio
type uio (line 43) | struct uio
type lkm_table (line 44) | struct lkm_table
type cdevsw (line 60) | struct cdevsw
function test_and_set_bit (line 72) | int
function clear_bit (line 88) | int
function tpmd_connect (line 103) | static int
function tpmd_disconnect (line 142) | static void
function outputData (line 159) | int
function tpmopen (line 172) | int
function tpmclose (line 189) | int
function tpmread (line 205) | int
function tpmwrite (line 229) | int
function tpmioctl (line 259) | int
function tpm_handler (line 267) | int
function tpm (line 283) | int
FILE: tpmd_dev/openbsd/tpmd_dev.h
type socket (line 33) | struct socket
type mbuf (line 34) | struct mbuf
type simplelock (line 35) | struct simplelock
Condensed preview — 104 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,276K chars).
[
{
"path": ".gitignore",
"chars": 7,
"preview": "build/\n"
},
{
"path": ".travis.yml",
"chars": 1414,
"preview": "env:\n global:\n secure: \"J29/ntLw9L6cZwmzz/cuYKs7lZ30zGcAW+3BRys56BcBNGy/h1i/ScKuVNTVeGngYfnpVsifDheZNOv7u+WI6cjOiA3m"
},
{
"path": "AUTHORS",
"chars": 67,
"preview": "Mario Strasser <mast@gmx.net>\nHeiko Stamer <stamer@gaos.org> [DAA]\n"
},
{
"path": "CMakeLists.txt",
"chars": 3057,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "ChangeLog",
"chars": 17026,
"preview": "2011-11-05 Mario Strasser <mast@gmx.net>\n\t* ChangeLog: ChangeLog updated\n\t* CMakeList.txt: minor version number updated"
},
{
"path": "LICENSE",
"chars": 18092,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 2, June 1991\n\n Copyright (C) 1989, 1991 Fr"
},
{
"path": "README",
"chars": 7919,
"preview": " _____ ____ __ __ _____ _ _\n|_ _| _ \\| \\/ | | ____|_ __ ___ _ _| | __ "
},
{
"path": "build.bat",
"chars": 353,
"preview": "@echo off\r\n\r\nset BUILD_DIR=build\r\nset PATH=C:\\MinGW\\bin;C:\\Program Files\\CMake 2.8\\bin;C:\\Program Files (x86)\\CMake 2.8\\"
},
{
"path": "build.sh",
"chars": 203,
"preview": "#!/bin/sh\n\nBUILD_DIR=\"build\"\n\nif [ \"$1\" = \"clean\" ]; then\n rm -rf $BUILD_DIR\nfi\n\nif [ ! -d $BUILD_DIR ]; then\n mkdir $"
},
{
"path": "config.h.in",
"chars": 1175,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/CMakeLists.txt",
"chars": 575,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "crypto/bn.h",
"chars": 2311,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/bn_gmp.c",
"chars": 2980,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/bn_openssl.c",
"chars": 3582,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2011 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/hmac.c",
"chars": 2069,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/hmac.h",
"chars": 1127,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/rc4.c",
"chars": 1730,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/rc4.h",
"chars": 992,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/rsa.c",
"chars": 17429,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/rsa.h",
"chars": 4011,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/sha1.c",
"chars": 5661,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "crypto/sha1.h",
"chars": 1168,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "mtm/CMakeLists.txt",
"chars": 343,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "mtm/mtm_capability.c",
"chars": 4281,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_cmd_handler.c",
"chars": 7892,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * Copyr"
},
{
"path": "mtm/mtm_commands.h",
"chars": 6362,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * Copyr"
},
{
"path": "mtm/mtm_counter.c",
"chars": 1518,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_data.c",
"chars": 2363,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_data.h",
"chars": 782,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_eviction.c",
"chars": 1237,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_handles.c",
"chars": 1647,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_handles.h",
"chars": 884,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_integrity.c",
"chars": 1399,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_marshalling.c",
"chars": 9523,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_marshalling.h",
"chars": 2255,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_structures.h",
"chars": 8068,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * Th"
},
{
"path": "mtm/mtm_verification.c",
"chars": 18381,
"preview": "/* Software-based Mobile Trusted Module (MTM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * Copyr"
},
{
"path": "tddl/CMakeLists.txt",
"chars": 1150,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tddl/tddl-tpm-emulator.h",
"chars": 7309,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tddl/tddl.c",
"chars": 8129,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tddl/tddl_unix.h",
"chars": 2247,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tddl/tddl_windows.h",
"chars": 2202,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tddl/test_tddl.c",
"chars": 4887,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/CMakeLists.txt",
"chars": 236,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpm/tpm_audit.c",
"chars": 8813,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_authorization.c",
"chars": 24069,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_capability.c",
"chars": 38063,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * "
},
{
"path": "tpm/tpm_cmd_handler.c",
"chars": 128095,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_commands.h",
"chars": 104690,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_context.c",
"chars": 15505,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_counter.c",
"chars": 4912,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_credentials.c",
"chars": 7474,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_crypto.c",
"chars": 18722,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_daa.c",
"chars": 157240,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * "
},
{
"path": "tpm/tpm_data.c",
"chars": 9345,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_data.h",
"chars": 1031,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_delegation.c",
"chars": 29015,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_deprecated.c",
"chars": 21476,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * "
},
{
"path": "tpm/tpm_emulator.h",
"chars": 2284,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_emulator_extern.c",
"chars": 6923,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_emulator_extern.h",
"chars": 2093,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_error.c",
"chars": 10633,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_eviction.c",
"chars": 3333,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_handles.c",
"chars": 3647,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_handles.h",
"chars": 2050,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_identity.c",
"chars": 22326,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * "
},
{
"path": "tpm/tpm_integrity.c",
"chars": 12135,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_maintenance.c",
"chars": 12549,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_management.c",
"chars": 1677,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_marshalling.c",
"chars": 77133,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * "
},
{
"path": "tpm/tpm_marshalling.h",
"chars": 25218,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_migration.c",
"chars": 38334,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_nv_storage.c",
"chars": 14712,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_owner.c",
"chars": 12258,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_startup.c",
"chars": 4221,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_storage.c",
"chars": 33154,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_structures.h",
"chars": 83860,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * "
},
{
"path": "tpm/tpm_testing.c",
"chars": 10396,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_ticks.c",
"chars": 3711,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpm/tpm_transport.c",
"chars": 18649,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpmd/CMakeLists.txt",
"chars": 254,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpmd/unix/CMakeLists.txt",
"chars": 505,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpmd/unix/tpmd.c",
"chars": 16517,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpmd/windows/CMakeLists.txt",
"chars": 530,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpmd/windows/control_tpmd.bat",
"chars": 1046,
"preview": ":: Software-based Trusted Platform Module (TPM) Emulator\r\n:: Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\r\n::\r\n"
},
{
"path": "tpmd/windows/tpmd.c",
"chars": 11218,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * Cop"
},
{
"path": "tpmd_dev/CMakeLists.txt",
"chars": 2040,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpmd_dev/darwin/Info.plist",
"chars": 866,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "tpmd_dev/darwin/Makefile",
"chars": 554,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpmd_dev/darwin/tpm_bridge.c",
"chars": 10750,
"preview": "/*\n * Copyright (c) 2009-2010 Amit Singh. All Rights Reserved.\n * http://osxbook.com\n *\n * TPM Emulator Device Bridge fo"
},
{
"path": "tpmd_dev/darwin/tpm_bridge.xcodeproj/project.pbxproj",
"chars": 10509,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "tpmd_dev/darwin/tpm_bridge.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
"chars": 155,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"self:tpm_bridge.xcod"
},
{
"path": "tpmd_dev/darwin/tpm_bridge.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/WorkspaceSettings.xcsettings",
"chars": 382,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "tpmd_dev/darwin/tpm_bridge.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/tpm_bridge.xcscheme",
"chars": 1955,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n version = \"1.3\">\n <BuildAction\n parallelizeBuildables = \"YES\"\n "
},
{
"path": "tpmd_dev/darwin/tpm_bridge.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist",
"chars": 482,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "tpmd_dev/linux/Makefile",
"chars": 1140,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n#\n# $Id:"
},
{
"path": "tpmd_dev/linux/tpmd_dev.c",
"chars": 7686,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n *\n * "
},
{
"path": "tpmd_dev/linux/tpmd_dev.rules.in",
"chars": 75,
"preview": "KERNEL==\"tpm\", NAME=\"%k\", SYMLINK+=\"tpm0\", GROUP=\"$TPM_GROUP\", MODE=\"0660\"\n"
},
{
"path": "tpmd_dev/openbsd/Makefile",
"chars": 541,
"preview": "# Software-based Trusted Platform Module (TPM) Emulator\n# Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n# Copyri"
},
{
"path": "tpmd_dev/openbsd/tpmd_dev.c",
"chars": 6103,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * Cop"
},
{
"path": "tpmd_dev/openbsd/tpmd_dev.h",
"chars": 1685,
"preview": "/* Software-based Trusted Platform Module (TPM) Emulator\n * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>\n * Cop"
}
]
// ... and 3 more files (download for full content)
About this extraction
This page contains the full source code of the PeterHuewe/tpm-emulator GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 104 files (1.2 MB), approximately 358.5k tokens, and a symbol index with 973 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.