mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-09 03:19:04 +00:00
tpm2: rev155: Major refactoring of header files
- Introduce Platform.h and replace usage of PlatformData.h and Platform_fp.h - Drop Implementation.h since we now use TpmProfile.h (which we prepared previously); many #defines were moved to TpmTypes.h Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
296cbb1699
commit
3dcaa01d0a
@ -357,7 +357,6 @@ noinst_HEADERS += \
|
||||
tpm2/Hierarchy_fp.h \
|
||||
tpm2/HMAC_fp.h \
|
||||
tpm2/HMAC_Start_fp.h \
|
||||
tpm2/Implementation.h \
|
||||
tpm2/Import_fp.h \
|
||||
tpm2/IncrementalSelfTest_fp.h \
|
||||
tpm2/InternalRoutines.h \
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Simulates the cancel pins on the TPM. */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: Cancel.c 1311 2018-08-23 21:39:29Z kgoldman $ */
|
||||
/* $Id: Cancel.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -63,8 +63,7 @@
|
||||
/* C.2.1. Description */
|
||||
/* This module simulates the cancel pins on the TPM. */
|
||||
/* C.2.2. Includes, Typedefs, Structures, and Defines */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "Platform.h"
|
||||
/* C.2.3. Functions */
|
||||
/* C.2.3.1. _plat__IsCanceled() */
|
||||
/* Check if the cancel flag is set */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Used by the simulator to mimic a hardware clock */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: Clock.c 1407 2019-01-07 17:55:07Z kgoldman $ */
|
||||
/* $Id: Clock.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -71,10 +71,9 @@
|
||||
TPM. In this implementation, all the time values are measured in millisecond. However, the
|
||||
precision of the clock functions may be implementation dependent. */
|
||||
/* C.3.2. Includes and Data Definitions */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "TpmFail_fp.h"
|
||||
#include <assert.h>
|
||||
#include "Platform.h"
|
||||
#include "TpmFail_fp.h"
|
||||
|
||||
/* libtpms added begin */
|
||||
/* ClockGetTime -- get time given a specified clock type */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Entropy */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: Entropy.c 1370 2018-11-02 19:39:07Z kgoldman $ */
|
||||
/* $Id: Entropy.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -67,9 +67,8 @@
|
||||
|
||||
#include <openssl/rand.h> /* libtpms added */
|
||||
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include <time.h>
|
||||
#include "Platform.h"
|
||||
#ifdef _MSC_VER
|
||||
#include <process.h>
|
||||
#else
|
||||
|
||||
@ -129,8 +129,13 @@
|
||||
#define PCR_SELECT_MIN ((PLATFORM_PCR+7)/8)
|
||||
#define PCR_SELECT_MAX ((IMPLEMENTATION_PCR+7)/8)
|
||||
#define MAX_ORDERLY_COUNT ((1 << ORDERLY_BITS) - 1)
|
||||
#define PRIVATE_VENDOR_SPECIFIC_BYTES \
|
||||
((MAX_RSA_KEY_BYTES/2) * (3 + CRT_FORMAT_RSA * 2)) /* libtpms: keep as was in rev 150 */
|
||||
|
||||
/* This was wrong in rev 155, but is not used anyway because of the protector. The correct value is
|
||||
in TpmProfile.h, which is included before GpMacros.h */
|
||||
#ifndef PRIVATE_VENDOR_SPECIFIC_BYTES
|
||||
#define PRIVATE_VENDOR_SPECIFIC_BYTES \
|
||||
(MAX_RSA_KEY_BYTES/2)
|
||||
#endif
|
||||
/* 5.10.5 Compile-time Checks */
|
||||
/* In some cases, the relationship between two values may be dependent on things that change based
|
||||
on various selections like the chosen cryptographic libraries. It is possible that these
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -39,7 +39,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "PlatformData.h"
|
||||
#include "Platform.h"
|
||||
#include "LibtpmsCallbacks.h"
|
||||
#include "NVMarshal.h"
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/********************************************************************************/
|
||||
/* */
|
||||
/* */
|
||||
/* Platform Locality Support */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: LocalityPlat.c 809 2016-11-16 18:31:54Z kgoldman $ */
|
||||
/* $Id: LocalityPlat.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,14 +55,13 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
/* C.5 LocalityPlat.c */
|
||||
/* C.5.1. Includes */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "Platform.h"
|
||||
/* C.5.2. Functions */
|
||||
/* C.5.2.1. _plat__LocalityGet() */
|
||||
/* Get the most recent command locality in locality value form. This is an integer value for
|
||||
|
||||
@ -46,8 +46,7 @@
|
||||
#define OBJECT_C
|
||||
#define PCR_C
|
||||
#define SESSION_C
|
||||
#include "PlatformData.h"
|
||||
#include "Implementation.h"
|
||||
#include "Platform.h"
|
||||
#include "NVMarshal.h"
|
||||
#include "Marshal_fp.h"
|
||||
#include "Unmarshal_fp.h"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* NV read and write access methods */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: NVMem.c 1370 2018-11-02 19:39:07Z kgoldman $ */
|
||||
/* $Id: NVMem.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -68,8 +68,7 @@
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "Platform.h"
|
||||
/* libtpms added begin */
|
||||
#include "NVMarshal.h"
|
||||
#include "LibtpmsCallbacks.h"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Simulates the Physical Present Interface */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: PPPlat.c 1311 2018-08-23 21:39:29Z kgoldman $ */
|
||||
/* $Id: PPPlat.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -63,11 +63,8 @@
|
||||
/* C.10.1. Description */
|
||||
/* This module simulates the physical presence interface pins on the TPM. */
|
||||
/* C.10.2. Includes */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
|
||||
#include "Platform.h"
|
||||
#include "LibtpmsCallbacks.h" /* libtpms added */
|
||||
|
||||
/* C.10.3. Functions */
|
||||
/* C.10.3.1. _plat__PhysicalPresenceAsserted() */
|
||||
/* Check if physical presence is signaled */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* TPM variables that are not stack allocated */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: PlatformData.c 1311 2018-08-23 21:39:29Z kgoldman $ */
|
||||
/* $Id: PlatformData.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,17 +55,16 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
/* C.10 PlatformData.c */
|
||||
/* C.10.1. Description */
|
||||
/* C.9 PlatformData.c */
|
||||
/* C.9.1. Description */
|
||||
/* This file will instance the TPM variables that are not stack allocated. The descriptions for
|
||||
these variables are in Global.h for this project. */
|
||||
/* C.10.2. Includes */
|
||||
#include "Implementation.h"
|
||||
#include "PlatformData.h"
|
||||
/* C.9.2. Includes */
|
||||
#include "Platform.h"
|
||||
/* From Cancel.c */
|
||||
BOOL s_isCanceled;
|
||||
/* From Clock.c */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Instance data for the Platform module. */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: PlatformData.h 1370 2018-11-02 19:39:07Z kgoldman $ */
|
||||
/* $Id: PlatformData.h 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,16 +55,15 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018. */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019. */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
/* A.1 PlatformData.h */
|
||||
/* c.8 PlatformData.h */
|
||||
/* This file contains the instance data for the Platform module. It is collected in this file so
|
||||
that the state of the module is easier to manage. */
|
||||
#ifndef _PLATFORM_DATA_H_
|
||||
#define _PLATFORM_DATA_H_
|
||||
#include "Implementation.h"
|
||||
/* From Cancel.c Cancel flag. It is initialized as FALSE, which indicate the command is not being
|
||||
canceled */
|
||||
extern int s_isCanceled;
|
||||
@ -99,7 +98,7 @@ extern BOOL s_timerReset;
|
||||
/* This value indicates that the timer was stopped. It causes a clock discontinuity. */
|
||||
extern BOOL s_timerStopped;
|
||||
/* CLOCK_NOMINAL is the number of hardware ticks per mS. A value of 300000 means that the nominal
|
||||
clock rate used to drive the hardware clock is 30 MHz(). The adjustment rates are used to
|
||||
clock rate used to drive the hardware clock is 30 MHz. The adjustment rates are used to
|
||||
determine the conversion of the hardware ticks to internal hardware clock value. In practice, we
|
||||
would expect that there would be a hardware register will accumulated mS. It would be incremented
|
||||
by the output of a pre-scaler. The pre-scaler would divide the ticks from the clock by some value
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/********************************************************************************/
|
||||
/* */
|
||||
/* */
|
||||
/* Platform Power Support */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: PowerPlat.c 809 2016-11-16 18:31:54Z kgoldman $ */
|
||||
/* $Id: PowerPlat.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,14 +55,13 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
/* C.7 PowerPlat.c */
|
||||
/* C.7.1. Includes and Function Prototypes */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "Platform.h"
|
||||
#include "_TPM_Init_fp.h"
|
||||
/* C.7.2. Functions */
|
||||
/* C.7.2.1. _plat__Signal_PowerOn() */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Platform specific entry and fail processing */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: RunCommand.c 953 2017-03-06 20:31:40Z kgoldman $ */
|
||||
/* $Id: RunCommand.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016, 2017 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -72,8 +72,7 @@
|
||||
in which the TPM is executing. For a simulator, setjmp/longjmp is used. For an OS, a system exit
|
||||
to the OS would be appropriate. */
|
||||
/* C.11.2. Includes and locals */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "Platform.h"
|
||||
#include <setjmp.h>
|
||||
#include "ExecCommand_fp.h"
|
||||
jmp_buf s_jumpBuffer;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Structure definitions for the self-test */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: SelfTest.h 1311 2018-08-23 21:39:29Z kgoldman $ */
|
||||
/* $Id: SelfTest.h 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -68,53 +68,16 @@
|
||||
/* 5.16.2 Defines */
|
||||
/* Was typing this a lot */
|
||||
#define SELF_TEST_FAILURE FAIL(FATAL_ERROR_SELF_TEST)
|
||||
/* Use the definition of key sizes to set algorithm values for key size. Need to do this to avoid a
|
||||
lot of #ifdefs in the code. Also, define the index for each of the algorithms. */
|
||||
#if ALG_AES && defined AES_KEY_SIZE_BITS_128
|
||||
# define AES_128 YES
|
||||
# define AES_128_INDEX 0
|
||||
#else
|
||||
# define AES_128 NO
|
||||
#endif
|
||||
#if ALG_AES && defined AES_KEY_SIZE_BITS_192
|
||||
# define AES_192 YES
|
||||
# define AES_192_INDEX (AES_128)
|
||||
#else
|
||||
# define AES_192 NO
|
||||
#endif
|
||||
#if ALG_AES && defined AES_KEY_SIZE_BITS_256
|
||||
# define AES_256 YES
|
||||
# define AES_256_INDEX (AES_128 + AES_192)
|
||||
#else
|
||||
# define AES_256 NO
|
||||
#endif
|
||||
#if ALG_SM4 && defined SM4_KEY_SIZE_BITS_128
|
||||
# define SM4_128 YES
|
||||
# define SM4_128_INDEX (AES_128 + AES_192 + AES_256)
|
||||
#else
|
||||
# define SM4_128 NO
|
||||
#endif
|
||||
// libtpms added begin
|
||||
#if ALG_TDES && defined TDES_KEY_SIZE_BITS_128
|
||||
# define TDES_128 YES
|
||||
# define TDES_128_INDEX (AES_128 + AES_192 + AES_256 + SM4_128)
|
||||
# define TDES_128_INDEX2 (AES_128 + AES_192 + AES_256 + SM4_128 + TDES_128)
|
||||
#else
|
||||
# define TDES_128 NO
|
||||
#endif
|
||||
#if ALG_TDES && defined TDES_KEY_SIZE_BITS_192
|
||||
# define TDES_192 YES
|
||||
# define TDES_192_INDEX (AES_128 + AES_192 + AES_256 + SM4_128 + TDES_128 \
|
||||
+ TDES_128)
|
||||
# define TDES_192_INDEX2 (AES_128 + AES_192 + AES_256 + SM4_128 + TDES_128 \
|
||||
+ TDES_128 + TDES_192)
|
||||
#else
|
||||
# define TDES_192 NO
|
||||
#endif
|
||||
// libtpms added end
|
||||
#define NUM_SYMS (AES_128 + AES_192 + AES_256 + SM4_128 \
|
||||
+ TDES_128 + TDES_128 + TDES_192 + TDES_192) // libtpms changed
|
||||
|
||||
// Use the definition of key sizes to set algorithm values for key size.
|
||||
|
||||
#define AES_ENTRIES (AES_128 + AES_192 + AES_256)
|
||||
#define SM4_ENTRIES (SM4_128)
|
||||
#define CAMELLIA_ENTRIES (CAMELLIA_128 + CAMELLIA_192 + CAMELLIA_256)
|
||||
#define TDES_ENTRIES (TDES_128 * 2 + TDES_192 * 2) /* libtpms changed */
|
||||
#define NUM_SYMS (AES_ENTRIES + SM4_ENTRIES + CAMELLIA_ENTRIES + TDES_ENTRIES)
|
||||
typedef UINT32 SYM_INDEX;
|
||||
|
||||
/* These two defines deal with the fact that the TPM_ALG_ID table does not delimit the symmetric
|
||||
mode values with a TPM_SYM_MODE_FIRST and TPM_SYM_MODE_LAST */
|
||||
#define TPM_SYM_MODE_FIRST ALG_CTR_VALUE
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
#ifndef STATE_MARSHAL_H
|
||||
#define STATE_MARSHAL_H
|
||||
|
||||
#include "BaseTypes.h"
|
||||
#include "Tpm.h"
|
||||
#include "TpmTypes.h"
|
||||
|
||||
/*
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Process the commands */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: TPMCmdp.c 1262 2018-07-11 21:03:43Z kgoldman $ */
|
||||
/* $Id: TPMCmdp.c 1478 2019-06-10 21:15:14Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -69,7 +69,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include "Implementation.h"
|
||||
#include "TpmBuildSwitches.h"
|
||||
#ifdef TPM_WINDOWS
|
||||
#include <windows.h>
|
||||
@ -91,6 +90,7 @@
|
||||
#ifdef TPM_POSIX
|
||||
#include "TcpServerPosix_fp.h"
|
||||
#endif
|
||||
#include "TpmProfile.h" /* kgold */
|
||||
|
||||
static BOOL s_isPowerOn = FALSE;
|
||||
/* D.4.3. Functions */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Root header file for building any TPM.lib code */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: Tpm.h 1047 2017-07-20 18:27:34Z kgoldman $ */
|
||||
/* $Id: Tpm.h 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,19 +55,27 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016, 2017 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
/* 5.19 Tpm.h */
|
||||
/* 5.18 Tpm.h */
|
||||
/* Root header file for building any TPM.lib code */
|
||||
#ifndef _TPM_H_
|
||||
#define _TPM_H_
|
||||
#include "Implementation.h"
|
||||
#include "LibSupport.h" /* Types from the library. These need to come before Global.h
|
||||
because some of the structures in that file depend on the
|
||||
structures used by the cryptographic libraries. */
|
||||
|
||||
#include "TpmBuildSwitches.h"
|
||||
#include "BaseTypes.h"
|
||||
#include "TPMB.h"
|
||||
#include "MinMax.h"
|
||||
#include "TpmProfile.h"
|
||||
#include "TpmAlgorithmDefines.h"
|
||||
#include "LibSupport.h" // Types from the library. These need to come before
|
||||
// Global.h because some of the structures in
|
||||
// that file depend on the structures used by the
|
||||
// cryptographic libraries.
|
||||
#include "GpMacros.h" // Define additional macros
|
||||
#include "Global.h" // Define other TPM types
|
||||
#include "InternalRoutines.h" // Function prototypes
|
||||
|
||||
#endif // _TPM_H_
|
||||
|
||||
@ -289,7 +289,7 @@
|
||||
#define MAX_ALG_LIST_SIZE 64
|
||||
#endif
|
||||
#ifndef PRIMARY_SEED_SIZE
|
||||
#define PRIMARY_SEED_SIZE 32
|
||||
#define PRIMARY_SEED_SIZE 64 /* libtpms: 64 per define USE_SPEC_COMPLIANT_PROOFS */
|
||||
#endif
|
||||
#ifndef CONTEXT_ENCRYPT_ALGORITHM
|
||||
#define CONTEXT_ENCRYPT_ALGORITHM AES
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* TPM Part 2 Headers */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: TpmTypes.h 1370 2018-11-02 19:39:07Z kgoldman $ */
|
||||
/* $Id: TpmTypes.h 1490 2019-07-26 21:13:22Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -64,10 +64,234 @@
|
||||
#ifndef TPMTYPES_H
|
||||
#define TPMTYPES_H
|
||||
|
||||
#include "BaseTypes.h" /* kgold */
|
||||
#include "Implementation.h" /* kgold */
|
||||
#include "GpMacros.h"
|
||||
#include "Capabilities.h"
|
||||
/* Table 1:2 - Definition of TPM_ALG_ID Constants */
|
||||
|
||||
typedef UINT16 TPM_ALG_ID;
|
||||
#define TYPE_OF_TPM_ALG_ID UINT16
|
||||
#define ALG_ERROR_VALUE 0x0000
|
||||
#define TPM_ALG_ERROR (TPM_ALG_ID)(ALG_ERROR_VALUE)
|
||||
#define ALG_RSA_VALUE 0x0001
|
||||
#define TPM_ALG_RSA (TPM_ALG_ID)(ALG_RSA_VALUE)
|
||||
#define ALG_TDES_VALUE 0x0003
|
||||
#define TPM_ALG_TDES (TPM_ALG_ID)(ALG_TDES_VALUE)
|
||||
#define ALG_SHA_VALUE 0x0004
|
||||
#define TPM_ALG_SHA (TPM_ALG_ID)(ALG_SHA_VALUE)
|
||||
#define ALG_SHA1_VALUE 0x0004
|
||||
#define TPM_ALG_SHA1 (TPM_ALG_ID)(ALG_SHA1_VALUE)
|
||||
#define ALG_HMAC_VALUE 0x0005
|
||||
#define TPM_ALG_HMAC (TPM_ALG_ID)(ALG_HMAC_VALUE)
|
||||
#define ALG_AES_VALUE 0x0006
|
||||
#define TPM_ALG_AES (TPM_ALG_ID)(ALG_AES_VALUE)
|
||||
#define ALG_MGF1_VALUE 0x0007
|
||||
#define TPM_ALG_MGF1 (TPM_ALG_ID)(ALG_MGF1_VALUE)
|
||||
#define ALG_KEYEDHASH_VALUE 0x0008
|
||||
#define TPM_ALG_KEYEDHASH (TPM_ALG_ID)(ALG_KEYEDHASH_VALUE)
|
||||
#define ALG_XOR_VALUE 0x000A
|
||||
#define TPM_ALG_XOR (TPM_ALG_ID)(ALG_XOR_VALUE)
|
||||
#define ALG_SHA256_VALUE 0x000B
|
||||
#define TPM_ALG_SHA256 (TPM_ALG_ID)(ALG_SHA256_VALUE)
|
||||
#define ALG_SHA384_VALUE 0x000C
|
||||
#define TPM_ALG_SHA384 (TPM_ALG_ID)(ALG_SHA384_VALUE)
|
||||
#define ALG_SHA512_VALUE 0x000D
|
||||
#define TPM_ALG_SHA512 (TPM_ALG_ID)(ALG_SHA512_VALUE)
|
||||
#define ALG_NULL_VALUE 0x0010
|
||||
#define TPM_ALG_NULL (TPM_ALG_ID)(ALG_NULL_VALUE)
|
||||
#define ALG_SM3_256_VALUE 0x0012
|
||||
#define TPM_ALG_SM3_256 (TPM_ALG_ID)(ALG_SM3_256_VALUE)
|
||||
#define ALG_SM4_VALUE 0x0013
|
||||
#define TPM_ALG_SM4 (TPM_ALG_ID)(ALG_SM4_VALUE)
|
||||
#define ALG_RSASSA_VALUE 0x0014
|
||||
#define TPM_ALG_RSASSA (TPM_ALG_ID)(ALG_RSASSA_VALUE)
|
||||
#define ALG_RSAES_VALUE 0x0015
|
||||
#define TPM_ALG_RSAES (TPM_ALG_ID)(ALG_RSAES_VALUE)
|
||||
#define ALG_RSAPSS_VALUE 0x0016
|
||||
#define TPM_ALG_RSAPSS (TPM_ALG_ID)(ALG_RSAPSS_VALUE)
|
||||
#define ALG_OAEP_VALUE 0x0017
|
||||
#define TPM_ALG_OAEP (TPM_ALG_ID)(ALG_OAEP_VALUE)
|
||||
#define ALG_ECDSA_VALUE 0x0018
|
||||
#define TPM_ALG_ECDSA (TPM_ALG_ID)(ALG_ECDSA_VALUE)
|
||||
#define ALG_ECDH_VALUE 0x0019
|
||||
#define TPM_ALG_ECDH (TPM_ALG_ID)(ALG_ECDH_VALUE)
|
||||
#define ALG_ECDAA_VALUE 0x001A
|
||||
#define TPM_ALG_ECDAA (TPM_ALG_ID)(ALG_ECDAA_VALUE)
|
||||
#define ALG_SM2_VALUE 0x001B
|
||||
#define TPM_ALG_SM2 (TPM_ALG_ID)(ALG_SM2_VALUE)
|
||||
#define ALG_ECSCHNORR_VALUE 0x001C
|
||||
#define TPM_ALG_ECSCHNORR (TPM_ALG_ID)(ALG_ECSCHNORR_VALUE)
|
||||
#define ALG_ECMQV_VALUE 0x001D
|
||||
#define TPM_ALG_ECMQV (TPM_ALG_ID)(ALG_ECMQV_VALUE)
|
||||
#define ALG_KDF1_SP800_56A_VALUE 0x0020
|
||||
#define TPM_ALG_KDF1_SP800_56A (TPM_ALG_ID)(ALG_KDF1_SP800_56A_VALUE)
|
||||
#define ALG_KDF2_VALUE 0x0021
|
||||
#define TPM_ALG_KDF2 (TPM_ALG_ID)(ALG_KDF2_VALUE)
|
||||
#define ALG_KDF1_SP800_108_VALUE 0x0022
|
||||
#define TPM_ALG_KDF1_SP800_108 (TPM_ALG_ID)(ALG_KDF1_SP800_108_VALUE)
|
||||
#define ALG_ECC_VALUE 0x0023
|
||||
#define TPM_ALG_ECC (TPM_ALG_ID)(ALG_ECC_VALUE)
|
||||
#define ALG_SYMCIPHER_VALUE 0x0025
|
||||
#define TPM_ALG_SYMCIPHER (TPM_ALG_ID)(ALG_SYMCIPHER_VALUE)
|
||||
#define ALG_CAMELLIA_VALUE 0x0026
|
||||
#define TPM_ALG_CAMELLIA (TPM_ALG_ID)(ALG_CAMELLIA_VALUE)
|
||||
#define ALG_SHA3_256_VALUE 0x0027
|
||||
#define TPM_ALG_SHA3_256 (TPM_ALG_ID)(ALG_SHA3_256_VALUE)
|
||||
#define ALG_SHA3_384_VALUE 0x0028
|
||||
#define TPM_ALG_SHA3_384 (TPM_ALG_ID)(ALG_SHA3_384_VALUE)
|
||||
#define ALG_SHA3_512_VALUE 0x0029
|
||||
#define TPM_ALG_SHA3_512 (TPM_ALG_ID)(ALG_SHA3_512_VALUE)
|
||||
#define ALG_CMAC_VALUE 0x003F
|
||||
#define TPM_ALG_CMAC (TPM_ALG_ID)(ALG_CMAC_VALUE)
|
||||
#define ALG_CTR_VALUE 0x0040
|
||||
#define TPM_ALG_CTR (TPM_ALG_ID)(ALG_CTR_VALUE)
|
||||
#define ALG_OFB_VALUE 0x0041
|
||||
#define TPM_ALG_OFB (TPM_ALG_ID)(ALG_OFB_VALUE)
|
||||
#define ALG_CBC_VALUE 0x0042
|
||||
#define TPM_ALG_CBC (TPM_ALG_ID)(ALG_CBC_VALUE)
|
||||
#define ALG_CFB_VALUE 0x0043
|
||||
#define TPM_ALG_CFB (TPM_ALG_ID)(ALG_CFB_VALUE)
|
||||
#define ALG_ECB_VALUE 0x0044
|
||||
#define TPM_ALG_ECB (TPM_ALG_ID)(ALG_ECB_VALUE)
|
||||
|
||||
/* Values derived from Table 1:2 */
|
||||
#define ALG_FIRST_VALUE 0x0001
|
||||
#define TPM_ALG_FIRST (TPM_ALG_ID)(ALG_FIRST_VALUE)
|
||||
#define ALG_LAST_VALUE 0x0044
|
||||
#define TPM_ALG_LAST (TPM_ALG_ID)(ALG_LAST_VALUE)
|
||||
|
||||
/* Table 1:3 - Definition of TPM_ECC_CURVE Constants */
|
||||
typedef UINT16 TPM_ECC_CURVE;
|
||||
#define TYPE_OF_TPM_ECC_CURVE UINT16
|
||||
#define TPM_ECC_NONE (TPM_ECC_CURVE)(0x0000)
|
||||
#define TPM_ECC_NIST_P192 (TPM_ECC_CURVE)(0x0001)
|
||||
#define TPM_ECC_NIST_P224 (TPM_ECC_CURVE)(0x0002)
|
||||
#define TPM_ECC_NIST_P256 (TPM_ECC_CURVE)(0x0003)
|
||||
#define TPM_ECC_NIST_P384 (TPM_ECC_CURVE)(0x0004)
|
||||
#define TPM_ECC_NIST_P521 (TPM_ECC_CURVE)(0x0005)
|
||||
#define TPM_ECC_BN_P256 (TPM_ECC_CURVE)(0x0010)
|
||||
#define TPM_ECC_BN_P638 (TPM_ECC_CURVE)(0x0011)
|
||||
#define TPM_ECC_SM2_P256 (TPM_ECC_CURVE)(0x0020)
|
||||
|
||||
/* Table 2:12 - Definition of TPM_CC Constants */
|
||||
typedef UINT32 TPM_CC;
|
||||
#define TYPE_OF_TPM_CC UINT32
|
||||
#define TPM_CC_NV_UndefineSpaceSpecial (TPM_CC)(0x0000011F)
|
||||
#define TPM_CC_EvictControl (TPM_CC)(0x00000120)
|
||||
#define TPM_CC_HierarchyControl (TPM_CC)(0x00000121)
|
||||
#define TPM_CC_NV_UndefineSpace (TPM_CC)(0x00000122)
|
||||
#define TPM_CC_ChangeEPS (TPM_CC)(0x00000124)
|
||||
#define TPM_CC_ChangePPS (TPM_CC)(0x00000125)
|
||||
#define TPM_CC_Clear (TPM_CC)(0x00000126)
|
||||
#define TPM_CC_ClearControl (TPM_CC)(0x00000127)
|
||||
#define TPM_CC_ClockSet (TPM_CC)(0x00000128)
|
||||
#define TPM_CC_HierarchyChangeAuth (TPM_CC)(0x00000129)
|
||||
#define TPM_CC_NV_DefineSpace (TPM_CC)(0x0000012A)
|
||||
#define TPM_CC_PCR_Allocate (TPM_CC)(0x0000012B)
|
||||
#define TPM_CC_PCR_SetAuthPolicy (TPM_CC)(0x0000012C)
|
||||
#define TPM_CC_PP_Commands (TPM_CC)(0x0000012D)
|
||||
#define TPM_CC_SetPrimaryPolicy (TPM_CC)(0x0000012E)
|
||||
#define TPM_CC_FieldUpgradeStart (TPM_CC)(0x0000012F)
|
||||
#define TPM_CC_ClockRateAdjust (TPM_CC)(0x00000130)
|
||||
#define TPM_CC_CreatePrimary (TPM_CC)(0x00000131)
|
||||
#define TPM_CC_NV_GlobalWriteLock (TPM_CC)(0x00000132)
|
||||
#define TPM_CC_GetCommandAuditDigest (TPM_CC)(0x00000133)
|
||||
#define TPM_CC_NV_Increment (TPM_CC)(0x00000134)
|
||||
#define TPM_CC_NV_SetBits (TPM_CC)(0x00000135)
|
||||
#define TPM_CC_NV_Extend (TPM_CC)(0x00000136)
|
||||
#define TPM_CC_NV_Write (TPM_CC)(0x00000137)
|
||||
#define TPM_CC_NV_WriteLock (TPM_CC)(0x00000138)
|
||||
#define TPM_CC_DictionaryAttackLockReset (TPM_CC)(0x00000139)
|
||||
#define TPM_CC_DictionaryAttackParameters (TPM_CC)(0x0000013A)
|
||||
#define TPM_CC_NV_ChangeAuth (TPM_CC)(0x0000013B)
|
||||
#define TPM_CC_PCR_Event (TPM_CC)(0x0000013C)
|
||||
#define TPM_CC_PCR_Reset (TPM_CC)(0x0000013D)
|
||||
#define TPM_CC_SequenceComplete (TPM_CC)(0x0000013E)
|
||||
#define TPM_CC_SetAlgorithmSet (TPM_CC)(0x0000013F)
|
||||
#define TPM_CC_SetCommandCodeAuditStatus (TPM_CC)(0x00000140)
|
||||
#define TPM_CC_FieldUpgradeData (TPM_CC)(0x00000141)
|
||||
#define TPM_CC_IncrementalSelfTest (TPM_CC)(0x00000142)
|
||||
#define TPM_CC_SelfTest (TPM_CC)(0x00000143)
|
||||
#define TPM_CC_Startup (TPM_CC)(0x00000144)
|
||||
#define TPM_CC_Shutdown (TPM_CC)(0x00000145)
|
||||
#define TPM_CC_StirRandom (TPM_CC)(0x00000146)
|
||||
#define TPM_CC_ActivateCredential (TPM_CC)(0x00000147)
|
||||
#define TPM_CC_Certify (TPM_CC)(0x00000148)
|
||||
#define TPM_CC_PolicyNV (TPM_CC)(0x00000149)
|
||||
#define TPM_CC_CertifyCreation (TPM_CC)(0x0000014A)
|
||||
#define TPM_CC_Duplicate (TPM_CC)(0x0000014B)
|
||||
#define TPM_CC_GetTime (TPM_CC)(0x0000014C)
|
||||
#define TPM_CC_GetSessionAuditDigest (TPM_CC)(0x0000014D)
|
||||
#define TPM_CC_NV_Read (TPM_CC)(0x0000014E)
|
||||
#define TPM_CC_NV_ReadLock (TPM_CC)(0x0000014F)
|
||||
#define TPM_CC_ObjectChangeAuth (TPM_CC)(0x00000150)
|
||||
#define TPM_CC_PolicySecret (TPM_CC)(0x00000151)
|
||||
#define TPM_CC_Rewrap (TPM_CC)(0x00000152)
|
||||
#define TPM_CC_Create (TPM_CC)(0x00000153)
|
||||
#define TPM_CC_ECDH_ZGen (TPM_CC)(0x00000154)
|
||||
#define TPM_CC_HMAC (TPM_CC)(0x00000155)
|
||||
#define TPM_CC_MAC (TPM_CC)(0x00000155)
|
||||
#define TPM_CC_Import (TPM_CC)(0x00000156)
|
||||
#define TPM_CC_Load (TPM_CC)(0x00000157)
|
||||
#define TPM_CC_Quote (TPM_CC)(0x00000158)
|
||||
#define TPM_CC_RSA_Decrypt (TPM_CC)(0x00000159)
|
||||
#define TPM_CC_HMAC_Start (TPM_CC)(0x0000015B)
|
||||
#define TPM_CC_MAC_Start (TPM_CC)(0x0000015B)
|
||||
#define TPM_CC_SequenceUpdate (TPM_CC)(0x0000015C)
|
||||
#define TPM_CC_Sign (TPM_CC)(0x0000015D)
|
||||
#define TPM_CC_Unseal (TPM_CC)(0x0000015E)
|
||||
#define TPM_CC_PolicySigned (TPM_CC)(0x00000160)
|
||||
#define TPM_CC_ContextLoad (TPM_CC)(0x00000161)
|
||||
#define TPM_CC_ContextSave (TPM_CC)(0x00000162)
|
||||
#define TPM_CC_ECDH_KeyGen (TPM_CC)(0x00000163)
|
||||
#define TPM_CC_EncryptDecrypt (TPM_CC)(0x00000164)
|
||||
#define TPM_CC_FlushContext (TPM_CC)(0x00000165)
|
||||
#define TPM_CC_LoadExternal (TPM_CC)(0x00000167)
|
||||
#define TPM_CC_MakeCredential (TPM_CC)(0x00000168)
|
||||
#define TPM_CC_NV_ReadPublic (TPM_CC)(0x00000169)
|
||||
#define TPM_CC_PolicyAuthorize (TPM_CC)(0x0000016A)
|
||||
#define TPM_CC_PolicyAuthValue (TPM_CC)(0x0000016B)
|
||||
#define TPM_CC_PolicyCommandCode (TPM_CC)(0x0000016C)
|
||||
#define TPM_CC_PolicyCounterTimer (TPM_CC)(0x0000016D)
|
||||
#define TPM_CC_PolicyCpHash (TPM_CC)(0x0000016E)
|
||||
#define TPM_CC_PolicyLocality (TPM_CC)(0x0000016F)
|
||||
#define TPM_CC_PolicyNameHash (TPM_CC)(0x00000170)
|
||||
#define TPM_CC_PolicyOR (TPM_CC)(0x00000171)
|
||||
#define TPM_CC_PolicyTicket (TPM_CC)(0x00000172)
|
||||
#define TPM_CC_ReadPublic (TPM_CC)(0x00000173)
|
||||
#define TPM_CC_RSA_Encrypt (TPM_CC)(0x00000174)
|
||||
#define TPM_CC_StartAuthSession (TPM_CC)(0x00000176)
|
||||
#define TPM_CC_VerifySignature (TPM_CC)(0x00000177)
|
||||
#define TPM_CC_ECC_Parameters (TPM_CC)(0x00000178)
|
||||
#define TPM_CC_FirmwareRead (TPM_CC)(0x00000179)
|
||||
#define TPM_CC_GetCapability (TPM_CC)(0x0000017A)
|
||||
#define TPM_CC_GetRandom (TPM_CC)(0x0000017B)
|
||||
#define TPM_CC_GetTestResult (TPM_CC)(0x0000017C)
|
||||
#define TPM_CC_Hash (TPM_CC)(0x0000017D)
|
||||
#define TPM_CC_PCR_Read (TPM_CC)(0x0000017E)
|
||||
#define TPM_CC_PolicyPCR (TPM_CC)(0x0000017F)
|
||||
#define TPM_CC_PolicyRestart (TPM_CC)(0x00000180)
|
||||
#define TPM_CC_ReadClock (TPM_CC)(0x00000181)
|
||||
#define TPM_CC_PCR_Extend (TPM_CC)(0x00000182)
|
||||
#define TPM_CC_PCR_SetAuthValue (TPM_CC)(0x00000183)
|
||||
#define TPM_CC_NV_Certify (TPM_CC)(0x00000184)
|
||||
#define TPM_CC_EventSequenceComplete (TPM_CC)(0x00000185)
|
||||
#define TPM_CC_HashSequenceStart (TPM_CC)(0x00000186)
|
||||
#define TPM_CC_PolicyPhysicalPresence (TPM_CC)(0x00000187)
|
||||
#define TPM_CC_PolicyDuplicationSelect (TPM_CC)(0x00000188)
|
||||
#define TPM_CC_PolicyGetDigest (TPM_CC)(0x00000189)
|
||||
#define TPM_CC_TestParms (TPM_CC)(0x0000018A)
|
||||
#define TPM_CC_Commit (TPM_CC)(0x0000018B)
|
||||
#define TPM_CC_PolicyPassword (TPM_CC)(0x0000018C)
|
||||
#define TPM_CC_ZGen_2Phase (TPM_CC)(0x0000018D)
|
||||
#define TPM_CC_EC_Ephemeral (TPM_CC)(0x0000018E)
|
||||
#define TPM_CC_PolicyNvWritten (TPM_CC)(0x0000018F)
|
||||
#define TPM_CC_PolicyTemplate (TPM_CC)(0x00000190)
|
||||
#define TPM_CC_CreateLoaded (TPM_CC)(0x00000191)
|
||||
#define TPM_CC_PolicyAuthorizeNV (TPM_CC)(0x00000192)
|
||||
#define TPM_CC_EncryptDecrypt2 (TPM_CC)(0x00000193)
|
||||
#define TPM_CC_AC_GetCapability (TPM_CC)(0x00000194)
|
||||
#define TPM_CC_AC_Send (TPM_CC)(0x00000195)
|
||||
#define TPM_CC_Policy_AC_SendSelect (TPM_CC)(0x00000196)
|
||||
#define CC_VEND 0x20000000
|
||||
#define TPM_CC_Vendor_TCG_Test (TPM_CC)(0x20000000)
|
||||
|
||||
/* Table 2:5 - Definition of Types for Documentation Clarity */
|
||||
typedef UINT32 TPM_ALGORITHM_ID;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/********************************************************************************/
|
||||
/* */
|
||||
/* */
|
||||
/* Secret Value to the TPM */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: Unique.c 809 2016-11-16 18:31:54Z kgoldman $ */
|
||||
/* $Id: Unique.c 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -66,8 +66,7 @@
|
||||
to provide personalization to the random number generation and as a shared secret between the TPM
|
||||
and the manufacturer. */
|
||||
/* C.12.2. Includes */
|
||||
#include "PlatformData.h"
|
||||
#include "Platform_fp.h"
|
||||
#include "Platform.h"
|
||||
const char notReallyUnique[] =
|
||||
"This is not really a unique value. A real unique value should"
|
||||
" be generated by the platform.";
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: Unmarshal_fp.h 1378 2018-11-19 20:43:20Z kgoldman $ */
|
||||
/* $Id: Unmarshal_fp.h 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -64,6 +64,7 @@
|
||||
#ifndef UNMARSHAL_FP_H
|
||||
#define UNMARSHAL_FP_H
|
||||
|
||||
#include "Tpm.h"
|
||||
#include "TpmTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -72,9 +72,9 @@
|
||||
/* a) the key size */
|
||||
/* b) the block size (the IV size) */
|
||||
/* c) the symmetric algorithm */
|
||||
#define DRBG_KEY_SIZE_BITS MAX_AES_KEY_BITS
|
||||
#define DRBG_IV_SIZE_BITS (MAX_AES_BLOCK_SIZE_BYTES * 8)
|
||||
#define DRBG_ALGORITHM TPM_ALG_AES
|
||||
#define DRBG_KEY_SIZE_BITS AES_MAX_KEY_SIZE_BITS
|
||||
#define DRBG_IV_SIZE_BITS (AES_MAX_BLOCK_SIZE * 8)
|
||||
#define DRBG_ALGORITHM TPM_ALG_AES
|
||||
typedef tpmKeyScheduleAES DRBG_KEY_SCHEDULE;
|
||||
#define DRBG_ENCRYPT_SETUP(key, keySizeInBits, schedule) \
|
||||
TpmCryptSetEncryptKeyAES(key, keySizeInBits, schedule)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* For defining the internal BIGNUM structure */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: BnValues.h 1259 2018-07-10 19:11:09Z kgoldman $ */
|
||||
/* $Id: BnValues.h 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,7 +55,7 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
@ -268,9 +268,6 @@ typedef struct
|
||||
+ ((UINT64)(h)) \
|
||||
)
|
||||
|
||||
/* Add implementation dependent definitions for other ECC Values and for linkages. MATH_LIB_H is
|
||||
defined in LibSupport.h */
|
||||
#include MATHLIB_H
|
||||
#ifndef RADIX_BYTES
|
||||
# if RADIX_BITS == 32
|
||||
# define RADIX_BYTES 4
|
||||
@ -280,5 +277,10 @@ typedef struct
|
||||
# error "RADIX_BITS must either be 32 or 64"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Add implementation dependent definitions for other ECC Values and for linkages */
|
||||
|
||||
#include LIB_INCLUDE(MATH_LIB, Math)
|
||||
|
||||
#endif // _BN_NUMBERS_H
|
||||
|
||||
|
||||
@ -59,66 +59,30 @@
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
#ifndef LIBSUPPORT_H
|
||||
#define LIBSUPPORT_H
|
||||
|
||||
/* 5.15 LibSupport.h */
|
||||
|
||||
/* This header file is used to select the library code that gets included in the TPM built */
|
||||
// 5.12 LibSupport.h
|
||||
// This header file is used to select the library code that gets included in the TPM built
|
||||
#ifndef _LIB_SUPPORT_H_
|
||||
#define _LIB_SUPPORT_H_
|
||||
/* OSSL has a full suite but yields an executable that is much larger than it needs to be. */
|
||||
#define OSSL 1
|
||||
/* LTC has symmetric support, RSA support, and inadequate ECC support */
|
||||
#define LTC 2
|
||||
/* MSBN only provides math support so should not be used as the hash or symmetric library */
|
||||
#define MSBN 3
|
||||
/* SYMCRYPT only provides symmetric cryptography so would need to be combined with another
|
||||
library that has math support */
|
||||
#define SYMCRYPT 4
|
||||
#if RADIX_BITS == 32
|
||||
# define RADIX_BYTES 4
|
||||
#elif RADIX_BITS == 64
|
||||
# define RADIX_BYTES 8
|
||||
#else
|
||||
#error "RADIX_BITS must either be 32 or 64."
|
||||
#endif
|
||||
/* Include the options for hashing If all the optional headers were always part of the
|
||||
distribution then it would not be necessary to do the conditional testing before the
|
||||
include. )-; */
|
||||
#if HASH_LIB == OSSL
|
||||
# include "TpmToOsslHash.h"
|
||||
#elif HASH_LIB == LTC
|
||||
# include "ltc/TpmToLtcHash.h"
|
||||
#elif HASH_LIB == SYMCRYPT
|
||||
#include "symcrypt/TpmToSymcryptHash.h"
|
||||
#else
|
||||
# error "No hash library selected"
|
||||
#endif
|
||||
/* Set the linkage for the selected symmetric library */
|
||||
#if SYM_LIB == OSSL
|
||||
# include "TpmToOsslSym.h"
|
||||
#elif SYM_LIB == LTC
|
||||
# include "ltc/TpmToLtcSym.h"
|
||||
#elif SYM_LIB == SYMCRYPT
|
||||
#include "symcrypt/TpmToSymcryptSym.h"
|
||||
#else
|
||||
# error "No symmetric library selected"
|
||||
#endif
|
||||
#ifndef RADIX_BITS
|
||||
# if defined(__x86_64__) || defined(_WIN64) || defined(_M_X64) || defined(_M_ARM64)
|
||||
# define RADIX_BITS 64
|
||||
# else
|
||||
# define RADIX_BITS 32
|
||||
# endif
|
||||
#endif // RADIX_BITS
|
||||
// These macros use the selected libraries to the proper include files.
|
||||
#define LIB_JOIN(x,y) x##y
|
||||
#define LIB_CONCAT(x,y) LIB_JOIN(x, y)
|
||||
#define LIB_QUOTE(_STRING_) #_STRING_
|
||||
#define LIB_INCLUDE2(_LIB_, _TYPE_) LIB_QUOTE(TpmTo##_LIB_##_TYPE_.h)
|
||||
#define LIB_INCLUDE(_LIB_, _TYPE_) LIB_INCLUDE2(_LIB_, _TYPE_)
|
||||
#define SYM_LIBRARY LIB_CONCAT(SYM_LIB_, SYM_LIB)
|
||||
#define HASH_LIBRARY(_LIB_) LIB_CONCAT(HASH_LIB_, HASH_LIB)
|
||||
#define MATH_LIBRARY(_LIB_) LIB_CONCAT(MATH_LIB_, MATH_LIB)
|
||||
// Include the options for hashing and symmetric. Defer the load of the math package Until the
|
||||
// bignum parameters are defined.
|
||||
#include LIB_INCLUDE(SYM_LIB, Sym)
|
||||
#include LIB_INCLUDE(HASH_LIB, Hash)
|
||||
#undef MIN
|
||||
#undef MIN
|
||||
/* Select a big number Library. This uses a define rather than an include so that the header
|
||||
will not be included until the required values have been defined. */
|
||||
#if MATH_LIB == OSSL
|
||||
# define MATHLIB_H "TpmToOsslMath.h"
|
||||
#elif MATH_LIB == LTC
|
||||
# define MATHLIB_H "ltc/TpmToLtcMath.h"
|
||||
#elif MATH_LIB == MSBN
|
||||
#define MATHLIB_H "msbn/TpmToMsBnMath.h"
|
||||
#else
|
||||
# error "No math library selected"
|
||||
#endif
|
||||
#undef MAX
|
||||
#endif // _LIB_SUPPORT_H_
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Used to splice the OpenSSL() hash code into the TPM code */
|
||||
/* Written by Ken Goldman */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* $Id: TpmToOsslHash.h 1311 2018-08-23 21:39:29Z kgoldman $ */
|
||||
/* $Id: TpmToOsslHash.h 1476 2019-06-10 19:32:03Z kgoldman $ */
|
||||
/* */
|
||||
/* Licenses and Notices */
|
||||
/* */
|
||||
@ -55,19 +55,16 @@
|
||||
/* arising in any way out of use or reliance upon this specification or any */
|
||||
/* information herein. */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
|
||||
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
|
||||
/* */
|
||||
/********************************************************************************/
|
||||
|
||||
#ifndef TPMTOOSSLHASH_H
|
||||
#define TPMTOOSSLHASH_H
|
||||
|
||||
/* B.2.2.1. TpmToOsslHash.h */
|
||||
/* B.2.2.1.1. Introduction */
|
||||
/* This header file is used to splice the OpenSSL() hash code into the TPM code. */
|
||||
#ifndef _TPM_TO_OSSL_HASH_H_
|
||||
#define _TPM_TO_OSSL_HASH_H_
|
||||
#if HASH_LIB == OSSL
|
||||
/* This header file is used to splice the OpenSSL hash code into the TPM code. */
|
||||
#ifndef HASH_LIB_DEFINED
|
||||
#define HASH_LIB_DEFINED
|
||||
#define HASH_LIB_OSSL
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
@ -146,7 +143,6 @@ typedef const BYTE *PCBYTE;
|
||||
(hashStateTo)->def->contextSize)
|
||||
/* Function aliases. The code in CryptHash.c uses the internal designation for the functions. These
|
||||
need to be translated to the function names of the library. */
|
||||
// Internal Designation External Designation
|
||||
#define tpmHashStart_SHA1 SHA1_Init // external name of the initialization method
|
||||
#define tpmHashData_SHA1 SHA1_Update
|
||||
#define tpmHashEnd_SHA1 SHA1_Final
|
||||
@ -175,7 +171,6 @@ typedef const BYTE *PCBYTE;
|
||||
#define LibHashInit()
|
||||
/* This definition would change if there were something to report */
|
||||
#define HashLibSimulationEnd()
|
||||
#endif // HASH_LIB == OSSL
|
||||
#endif //
|
||||
#endif // // HASH_LIB_DEFINED
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "tpm2/Tpm.h"
|
||||
#include "tpm2/TpmTypes.h"
|
||||
#include "tpm2/TpmBuildSwitches.h"
|
||||
#include "tpm2/_TPM_Hash_Start_fp.h"
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Implementation.h"
|
||||
#include "Tpm.h"
|
||||
|
||||
/* from Global.h */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user