15679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This file was extracted from the TCG Published 25679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Trusted Platform Module Library 35679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Part 4: Supporting Routines 45679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Family "2.0" 55679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Level 00 Revision 01.16 65679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// October 30, 2014 75679752bf24c21135884e987c4077e2f7184897Vadim Bendebury 85679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifndef _CRYPT_PRI_H 95679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define _CRYPT_PRI_H 105679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include <stddef.h> 115679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "TpmBuildSwitches.h" 125679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "BaseTypes.h" 135679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "TpmError.h" 145679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "swap.h" 155679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "Implementation.h" 16c4b77e00643ea6e230916a76da450315ab820997Vadim Bendebury#include "TPM_Types.h" 175679752bf24c21135884e987c4077e2f7184897Vadim Bendebury//#include "TPMB.h" 185679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "bool.h" 195679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "Platform.h" 205679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifndef NULL 215679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define NULL 0 225679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 235679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef UINT16 NUMBYTES; // When a size is a number of bytes 245679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef UINT32 NUMDIGITS; // When a size is a number of "digits" 255679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// General Purpose Macros 265679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 275679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifndef MAX 285679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# define MAX(a, b) ((a) > (b) ? (a) : b) 295679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 305679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 315679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This is the definition of a bit array with one bit per algorithm 325679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 335679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef BYTE ALGORITHM_VECTOR[(ALG_LAST_VALUE + 7) / 8]; 345679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 355679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 365679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Self-test 375679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 385679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This structure is used to contain self-test tracking information for the crypto engine. Each of the major 395679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// modules is given a 32-bit value in which it may maintain its own self test information. The convention for 405679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// this state is that when all of the bits in this structure are 0, all functions need to be tested. 415679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 425679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct { 435679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 rng; 445679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 hash; 455679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 sym; 465679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_RSA 475679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 rsa; 485679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 495679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_ECC 505679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 ecc; 515679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 525679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} CRYPTO_SELF_TEST_STATE; 535679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 545679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 555679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Hash-related Structures 565679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 575679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct { 585679752bf24c21135884e987c4077e2f7184897Vadim Bendebury const TPM_ALG_ID alg; 595679752bf24c21135884e987c4077e2f7184897Vadim Bendebury const NUMBYTES digestSize; 605679752bf24c21135884e987c4077e2f7184897Vadim Bendebury const NUMBYTES blockSize; 615679752bf24c21135884e987c4077e2f7184897Vadim Bendebury const NUMBYTES derSize; 625679752bf24c21135884e987c4077e2f7184897Vadim Bendebury const BYTE der[20]; 635679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} HASH_INFO; 645679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 655679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This value will change with each implementation. The value of 16 is used to account for any slop in the 665679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// context values. The overall size needs to be as large as any of the hash contexts. The structure needs to 675679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// start on an alignment boundary and be an even multiple of the alignment 685679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 695679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define ALIGNED_SIZE(x, b) ((((x) + (b) - 1) / (b)) * (b)) 705679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define MAX_HASH_STATE_SIZE ((2 * MAX_HASH_BLOCK_SIZE) + 16) 71c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury#if defined USER_MIN_HASH_STATE_SIZE && \ 72c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury (MAX_HASH_STATE_SIZE < (USER_MIN_HASH_STATE_SIZE)) 73c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury#define REQUIRED_HASH_STATE_SIZE USER_MIN_HASH_STATE_SIZE 74c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury#else 75c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury#define REQUIRED_HASH_STATE_SIZE MAX_HASH_STATE_SIZE 76c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury#endif 775679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define MAX_HASH_STATE_SIZE_ALIGNED \ 78c27666cb7d1bf5377232a9d7b8bb25e0268e2733Vadim Bendebury ALIGNED_SIZE(REQUIRED_HASH_STATE_SIZE, CRYPTO_ALIGNMENT) 795679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 805679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This is an byte array that will hold any of the hash contexts. 815679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 825679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef CRYPTO_ALIGNED BYTE ALIGNED_HASH_STATE[MAX_HASH_STATE_SIZE_ALIGNED]; 835679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 845679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Macro to align an address to the next higher size 855679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 865679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define AlignPointer(address, align) \ 875679752bf24c21135884e987c4077e2f7184897Vadim Bendebury ((((intptr_t)&(address)) + (align - 1)) & ~(align - 1)) 885679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 895679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Macro to test alignment 905679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 915679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define IsAddressAligned(address, align) \ 925679752bf24c21135884e987c4077e2f7184897Vadim Bendebury (((intptr_t)(address) & (align - 1)) == 0) 935679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 945679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This is the structure that is used for passing a context into the hashing functions. It should be the same 955679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// size as the function context used within the hashing functions. This is checked when the hash function is 965679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// initialized. This version uses a new layout for the contexts and a different definition. The state buffer is an 975679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// array of HASH_UNIT values so that a decent compiler will put the structure on a HASH_UNIT boundary. 985679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// If the structure is not properly aligned, the code that manipulates the structure will copy to a properly 995679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// aligned structure before it is used and copy the result back. This just makes things slower. 1005679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1015679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct _HASH_STATE 1025679752bf24c21135884e987c4077e2f7184897Vadim Bendebury{ 1035679752bf24c21135884e987c4077e2f7184897Vadim Bendebury ALIGNED_HASH_STATE state; 1045679752bf24c21135884e987c4077e2f7184897Vadim Bendebury TPM_ALG_ID hashAlg; 1055679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} CPRI_HASH_STATE, *PCPRI_HASH_STATE; 1065679752bf24c21135884e987c4077e2f7184897Vadim Bendeburyextern const HASH_INFO g_hashData[HASH_COUNT + 1]; 1075679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1085679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This is for the external hash state. This implementation assumes that the size of the exported hash state 1095679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// is no larger than the internal hash state. There is a compile-time check to make sure that this is true. 1105679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1115679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct { 1125679752bf24c21135884e987c4077e2f7184897Vadim Bendebury ALIGNED_HASH_STATE buffer; 1135679752bf24c21135884e987c4077e2f7184897Vadim Bendebury TPM_ALG_ID hashAlg; 1145679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} EXPORT_HASH_STATE; 1155679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef enum { 1165679752bf24c21135884e987c4077e2f7184897Vadim Bendebury IMPORT_STATE, // Converts externally formatted state to internal 1175679752bf24c21135884e987c4077e2f7184897Vadim Bendebury EXPORT_STATE // Converts internal formatted state to external 1185679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} IMPORT_EXPORT; 1195679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1205679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Values and structures for the random number generator. These values are defined in this header file so 1215679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// that the size of the RNG state can be known to TPM.lib. This allows the allocation of some space in NV 1225679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// memory for the state to be stored on an orderly shutdown. The GET_PUT enum is used by 1235679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// _cpri__DrbgGetPutState() to indicate the direction of data flow. 1245679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1255679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef enum { 1265679752bf24c21135884e987c4077e2f7184897Vadim Bendebury GET_STATE, // Get the state to save to NV 1275679752bf24c21135884e987c4077e2f7184897Vadim Bendebury PUT_STATE // Restore the state from NV 1285679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} GET_PUT; 1295679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1305679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// The DRBG based on a symmetric block cipher is defined by three values, 1315679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// a) the key size 1325679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// b) the block size (the IV size) 1335679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// c) the symmetric algorithm 1345679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1355679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define DRBG_KEY_SIZE_BITS MAX_AES_KEY_BITS 1365679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define DRBG_IV_SIZE_BITS (MAX_AES_BLOCK_SIZE_BYTES * 8) 1375679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define DRBG_ALGORITHM TPM_ALG_AES 1385679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#if ((DRBG_KEY_SIZE_BITS % 8) != 0) || ((DRBG_IV_SIZE_BITS % 8) != 0) 1395679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#error "Key size and IV for DRBG must be even multiples of 8" 1405679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 1415679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#if (DRBG_KEY_SIZE_BITS % DRBG_IV_SIZE_BITS) != 0 1425679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#error "Key size for DRBG must be even multiple of the cypher block size" 1435679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 1445679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef UINT32 DRBG_SEED[(DRBG_KEY_SIZE_BITS + DRBG_IV_SIZE_BITS) / 32]; 1455679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct { 1465679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT64 reseedCounter; 1475679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 magic; 1485679752bf24c21135884e987c4077e2f7184897Vadim Bendebury DRBG_SEED seed; // contains the key and IV for the counter mode DRBG 1495679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 lastValue[4]; // used when the TPM does continuous self-test 1505679752bf24c21135884e987c4077e2f7184897Vadim Bendebury // for FIPS compliance of DRBG 1515679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} DRBG_STATE, *pDRBG_STATE; 1525679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1535679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1545679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Asymmetric Structures and Values 1555679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1565679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_ECC 1575679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1585679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1595679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// ECC-related Structures 1605679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1615679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This structure replicates the structure definition in TPM_Types.h. It is duplicated to avoid inclusion of all of 1625679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// TPM_Types.h This structure is similar to the RSA_KEY structure below. The purpose of these structures 1635679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// is to reduce the overhead of a function call and to make the code less dependent on key types as much 1645679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// as possible. 1655679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1665679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct { 1675679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 curveID; // The curve identifier 1685679752bf24c21135884e987c4077e2f7184897Vadim Bendebury TPMS_ECC_POINT *publicPoint; // Pointer to the public point 1695679752bf24c21135884e987c4077e2f7184897Vadim Bendebury TPM2B_ECC_PARAMETER *privateKey; // Pointer to the private key 1705679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} ECC_KEY; 1715679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif // TPM_ALG_ECC 1725679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_RSA 1735679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1745679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1755679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// RSA-related Structures 1765679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1775679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// This structure is a succinct representation of the cryptographic components of an RSA key. 1785679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1795679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef struct { 1805679752bf24c21135884e987c4077e2f7184897Vadim Bendebury UINT32 exponent; // The public exponent pointer 1815679752bf24c21135884e987c4077e2f7184897Vadim Bendebury TPM2B *publicKey; // Pointer to the public modulus 1825679752bf24c21135884e987c4077e2f7184897Vadim Bendebury TPM2B *privateKey; // The private exponent (not a prime) 1835679752bf24c21135884e987c4077e2f7184897Vadim Bendebury} RSA_KEY; 1845679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif // TPM_ALG_RSA 1855679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1865679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1875679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// Miscelaneous 1885679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 1895679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_RSA 1905679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# ifdef TPM_ALG_ECC 1915679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# if MAX_RSA_KEY_BYTES > MAX_ECC_KEY_BYTES 1925679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# define MAX_NUMBER_SIZE MAX_RSA_KEY_BYTES 1935679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# else 1945679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# define MAX_NUMBER_SIZE MAX_ECC_KEY_BYTES 1955679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# endif 1965679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# else // RSA but no ECC 1975679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# define MAX_NUMBER_SIZE MAX_RSA_KEY_BYTES 1985679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# endif 1995679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#elif defined TPM_ALG_ECC 2005679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# define MAX_NUMBER_SIZE MAX_ECC_KEY_BYTES 2015679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#else 2025679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# error No assymmetric algorithm implemented. 2035679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 2045679752bf24c21135884e987c4077e2f7184897Vadim Bendeburytypedef INT16 CRYPT_RESULT; 2055679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_RESULT_MIN INT16_MIN 2065679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_RESULT_MAX INT16_MAX 2075679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 2085679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 2095679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// <0 recoverable error 2105679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 2115679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 0 success 2125679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// >0 command specific return value (generally a digest size) 2135679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 2145679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_FAIL ((CRYPT_RESULT) 1) 2155679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_SUCCESS ((CRYPT_RESULT) 0) 2165679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_NO_RESULT ((CRYPT_RESULT) -1) 2175679752bf24c21135884e987c4077e2f7184897Vadim Bendebury// 2185679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_SCHEME ((CRYPT_RESULT) -2) 2195679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_PARAMETER ((CRYPT_RESULT) -3) 2205679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_UNDERFLOW ((CRYPT_RESULT) -4) 2215679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_POINT ((CRYPT_RESULT) -5) 2225679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#define CRYPT_CANCEL ((CRYPT_RESULT) -6) 2235679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "CpriCryptPri_fp.h" 2245679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_ECC 2255679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# include "CpriDataEcc.h" 2265679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# include "CpriECC_fp.h" 2275679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 2285679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "MathFunctions_fp.h" 2295679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "CpriRNG_fp.h" 2305679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "CpriHash_fp.h" 2315679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#include "CpriSym_fp.h" 2325679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#ifdef TPM_ALG_RSA 2335679752bf24c21135884e987c4077e2f7184897Vadim Bendebury# include "CpriRSA_fp.h" 2345679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif 2355679752bf24c21135884e987c4077e2f7184897Vadim Bendebury#endif // !_CRYPT_PRI_H 236