1 /* 2 * Copyright (c) 2010-2012 United States Government, as represented by 3 * the Secretary of Defense. All rights reserved. 4 * 5 * based off of the original tools/vtpm_manager code base which is: 6 * Copyright (c) 2005/2006, Intel Corp. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * * Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * * Redistributions in binary form must reproduce the above 16 * copyright notice, this list of conditions and the following 17 * disclaimer in the documentation and/or other materials provided 18 * with the distribution. 19 * * Neither the name of Intel Corporation nor the names of its 20 * contributors may be used to endorse or promote products derived 21 * from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 34 * OF THE POSSIBILITY OF SUCH DAMAGE. 35 */ 36 37 #ifndef __TPM_H__ 38 #define __TPM_H__ 39 40 #include "tcg.h" 41 42 // ------------------------------------------------------------------ 43 // Exposed API 44 // ------------------------------------------------------------------ 45 46 // TPM v1.1B Command Set 47 48 // Authorzation 49 TPM_RESULT TPM_OIAP( 50 TPM_AUTH_SESSION* auth //out 51 ); 52 53 TPM_RESULT TPM_OSAP ( 54 TPM_ENTITY_TYPE entityType, // in 55 UINT32 entityValue, // in 56 const TPM_AUTHDATA* usageAuth, //in 57 TPM_SECRET *sharedSecret, //out 58 TPM_AUTH_SESSION *auth); 59 60 TPM_RESULT TPM_TakeOwnership( 61 const TPM_PUBKEY *pubEK, //in 62 const TPM_AUTHDATA* ownerAuth, //in 63 const TPM_AUTHDATA* srkAuth, //in 64 const TPM_KEY* inSrk, //in 65 TPM_KEY* outSrk, //out, optional 66 TPM_AUTH_SESSION* auth // in, out 67 ); 68 69 TPM_RESULT TPM_DisablePubekRead ( 70 const TPM_AUTHDATA* ownerAuth, 71 TPM_AUTH_SESSION* auth 72 ); 73 74 TPM_RESULT TPM_TerminateHandle ( TPM_AUTHHANDLE handle // in 75 ); 76 77 TPM_RESULT TPM_FlushSpecific ( TPM_HANDLE handle, // in 78 TPM_RESOURCE_TYPE resourceType //in 79 ); 80 81 // TPM Mandatory 82 TPM_RESULT TPM_Extend ( TPM_PCRINDEX pcrNum, // in 83 TPM_DIGEST* inDigest, // in 84 TPM_PCRVALUE* outDigest // out 85 ); 86 87 TPM_RESULT TPM_Reset(TPM_PCR_SELECTION *sel); 88 89 TPM_RESULT TPM_Seal( 90 TCS_KEY_HANDLE keyHandle, // in 91 UINT32 pcrInfoLongSize, // in 92 TPM_PCR_INFO_LONG* pcrInfoLong, // in 93 UINT32 inDataSize, // in 94 const BYTE* inData, // in 95 TPM_STORED_DATA12* sealedData, //out 96 const TPM_SECRET* osapSharedSecret, //in 97 const TPM_AUTHDATA* sealDataAuth, //in 98 TPM_AUTH_SESSION* pubAuth // in, out 99 ); 100 101 TPM_RESULT TPM_Unseal ( 102 TPM_KEY_HANDLE parentHandle, // in 103 const TPM_STORED_DATA12* sealedData, 104 UINT32* outSize, // out 105 BYTE** out, //out 106 const TPM_AUTHDATA* key_usage_auth, //in 107 const TPM_AUTHDATA* data_usage_auth, //in 108 TPM_AUTH_SESSION* keyAuth, // in, out 109 TPM_AUTH_SESSION* dataAuth // in, out 110 ); 111 112 TPM_RESULT TPM_LoadKey ( 113 TPM_KEY_HANDLE parentHandle, // 114 const TPM_KEY* key, //in 115 TPM_HANDLE* keyHandle, // out 116 const TPM_AUTHDATA* usage_auth, 117 TPM_AUTH_SESSION* auth 118 ); 119 120 TPM_RESULT TPM_FlushSpecific(TPM_HANDLE handle, //in 121 TPM_RESOURCE_TYPE rt //in 122 ); 123 124 TPM_RESULT TPM_GetRandom ( UINT32* bytesRequested, // in, out 125 BYTE* randomBytes // out 126 ); 127 128 TPM_RESULT TPM_ReadPubek ( 129 TPM_PUBKEY* pubEK //out 130 ); 131 132 TPM_RESULT TPM_GetCapability( 133 TPM_CAPABILITY_AREA capArea, 134 UINT32 subCapSize, 135 const BYTE* subCap, 136 UINT32* respSize, 137 BYTE** resp); 138 139 TPM_RESULT TPM_PCR_Read(UINT32 pcr, TPM_DIGEST *value); 140 TPM_RESULT TPM_SaveState(void); 141 142 TPM_RESULT TPM_CreateEndorsementKeyPair( 143 const TPM_KEY_PARMS* keyInfo, 144 TPM_PUBKEY* pubEK); 145 146 TPM_RESULT TPM_MakeIdentity( 147 const TPM_AUTHDATA* identityAuth, // in 148 const TPM_AUTHDATA* privCADigest, // in 149 const TPM_KEY* kinfo, // in 150 const TPM_AUTHDATA* srk_auth, // in 151 const TPM_AUTHDATA* owner_auth, // in 152 TPM_AUTH_SESSION* srkAuth, // in,out 153 TPM_AUTH_SESSION* ownAuth, // in,out 154 TPM_KEY* key, // out 155 UINT32* identityBindingSize, // out 156 BYTE** identityBinding); // out 157 158 TPM_RESULT TPM_ActivateIdentity( 159 TPM_KEY_HANDLE aikHandle, // in 160 BYTE* blob, // in 161 UINT32 blobSize, // in 162 const TPM_AUTHDATA* aik_auth, // in 163 const TPM_AUTHDATA* owner_auth, // in 164 TPM_AUTH_SESSION* aikAuth, // in,out 165 TPM_AUTH_SESSION* ownAuth, // in,out 166 TPM_SYMMETRIC_KEY* symKey); // out 167 168 TPM_RESULT TPM_Quote( 169 TPM_KEY_HANDLE keyh, // in 170 const TPM_NONCE* data, // in 171 const TPM_PCR_SELECTION *pcrSelect, // in 172 const TPM_AUTHDATA* auth, // in 173 TPM_AUTH_SESSION* oiap, // in,out 174 TPM_PCR_COMPOSITE *pcrs, // out 175 BYTE** sig, // out 176 UINT32* sigSize); // out 177 178 TPM_RESULT TPM_TransmitData( 179 BYTE* in, 180 UINT32 insize, 181 BYTE* out, 182 UINT32* outsize); 183 184 #endif //TPM_H 185