1ca64b086SPhilippe Mathieu-Daudé /* 2ca64b086SPhilippe Mathieu-Daudé * tpm_ioctl.h 3ca64b086SPhilippe Mathieu-Daudé * 4ca64b086SPhilippe Mathieu-Daudé * (c) Copyright IBM Corporation 2014, 2015. 5ca64b086SPhilippe Mathieu-Daudé * 6ca64b086SPhilippe Mathieu-Daudé * This file is licensed under the terms of the 3-clause BSD license 7ca64b086SPhilippe Mathieu-Daudé */ 8efef4756SStefan Berger #ifndef _TPM_IOCTL_H_ 9efef4756SStefan Berger #define _TPM_IOCTL_H_ 10ca64b086SPhilippe Mathieu-Daudé 11efef4756SStefan Berger #if defined(__CYGWIN__) 12efef4756SStefan Berger # define __USE_LINUX_IOCTL_DEFS 13efef4756SStefan Berger #endif 14ca64b086SPhilippe Mathieu-Daudé 15d1c637ecSBin Meng #ifndef _WIN32 16ca64b086SPhilippe Mathieu-Daudé #include <sys/uio.h> 17ca64b086SPhilippe Mathieu-Daudé #include <sys/ioctl.h> 18d1c637ecSBin Meng #endif 19ca64b086SPhilippe Mathieu-Daudé 20ded5d78cSThomas Huth #ifdef HAVE_SYS_IOCCOM_H 21ded5d78cSThomas Huth #include <sys/ioccom.h> 22ded5d78cSThomas Huth #endif 23ded5d78cSThomas Huth 24ca64b086SPhilippe Mathieu-Daudé /* 25ca64b086SPhilippe Mathieu-Daudé * Every response from a command involving a TPM command execution must hold 26ca64b086SPhilippe Mathieu-Daudé * the ptm_res as the first element. 27ca64b086SPhilippe Mathieu-Daudé * ptm_res corresponds to the error code of a command executed by the TPM. 28ca64b086SPhilippe Mathieu-Daudé */ 29ca64b086SPhilippe Mathieu-Daudé 30ca64b086SPhilippe Mathieu-Daudé typedef uint32_t ptm_res; 31ca64b086SPhilippe Mathieu-Daudé 32*312c5404SStefan Berger /* PTM_GET_CAPABILITY: Get supported capabilities (ioctl's) */ 33*312c5404SStefan Berger struct ptm_cap_n { 34*312c5404SStefan Berger union { 35*312c5404SStefan Berger struct { 36*312c5404SStefan Berger ptm_res tpm_result; /* will always be TPM_SUCCESS (0) */ 37*312c5404SStefan Berger uint32_t caps; 38*312c5404SStefan Berger } resp; /* response */ 39*312c5404SStefan Berger } u; 40*312c5404SStefan Berger }; 41*312c5404SStefan Berger 42ca64b086SPhilippe Mathieu-Daudé /* PTM_GET_TPMESTABLISHED: get the establishment bit */ 43ca64b086SPhilippe Mathieu-Daudé struct ptm_est { 44ca64b086SPhilippe Mathieu-Daudé union { 45ca64b086SPhilippe Mathieu-Daudé struct { 46ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 47ca64b086SPhilippe Mathieu-Daudé unsigned char bit; /* TPM established bit */ 48ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 49ca64b086SPhilippe Mathieu-Daudé } u; 50ca64b086SPhilippe Mathieu-Daudé }; 51ca64b086SPhilippe Mathieu-Daudé 52ca64b086SPhilippe Mathieu-Daudé /* PTM_RESET_TPMESTABLISHED: reset establishment bit */ 53ca64b086SPhilippe Mathieu-Daudé struct ptm_reset_est { 54ca64b086SPhilippe Mathieu-Daudé union { 55ca64b086SPhilippe Mathieu-Daudé struct { 56ca64b086SPhilippe Mathieu-Daudé uint8_t loc; /* locality to use */ 57ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 58ca64b086SPhilippe Mathieu-Daudé struct { 59ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 60ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 61ca64b086SPhilippe Mathieu-Daudé } u; 62ca64b086SPhilippe Mathieu-Daudé }; 63ca64b086SPhilippe Mathieu-Daudé 64ca64b086SPhilippe Mathieu-Daudé /* PTM_INIT */ 65ca64b086SPhilippe Mathieu-Daudé struct ptm_init { 66ca64b086SPhilippe Mathieu-Daudé union { 67ca64b086SPhilippe Mathieu-Daudé struct { 68ca64b086SPhilippe Mathieu-Daudé uint32_t init_flags; /* see definitions below */ 69ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 70ca64b086SPhilippe Mathieu-Daudé struct { 71ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 72ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 73ca64b086SPhilippe Mathieu-Daudé } u; 74ca64b086SPhilippe Mathieu-Daudé }; 75ca64b086SPhilippe Mathieu-Daudé 76ca64b086SPhilippe Mathieu-Daudé /* above init_flags */ 77ca64b086SPhilippe Mathieu-Daudé #define PTM_INIT_FLAG_DELETE_VOLATILE (1 << 0) 78ca64b086SPhilippe Mathieu-Daudé /* delete volatile state file after reading it */ 79ca64b086SPhilippe Mathieu-Daudé 80ca64b086SPhilippe Mathieu-Daudé /* PTM_SET_LOCALITY */ 81ca64b086SPhilippe Mathieu-Daudé struct ptm_loc { 82ca64b086SPhilippe Mathieu-Daudé union { 83ca64b086SPhilippe Mathieu-Daudé struct { 84ca64b086SPhilippe Mathieu-Daudé uint8_t loc; /* locality to set */ 85ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 86ca64b086SPhilippe Mathieu-Daudé struct { 87ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 88ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 89ca64b086SPhilippe Mathieu-Daudé } u; 90ca64b086SPhilippe Mathieu-Daudé }; 91ca64b086SPhilippe Mathieu-Daudé 92ca64b086SPhilippe Mathieu-Daudé /* PTM_HASH_DATA: hash given data */ 93ca64b086SPhilippe Mathieu-Daudé struct ptm_hdata { 94ca64b086SPhilippe Mathieu-Daudé union { 95ca64b086SPhilippe Mathieu-Daudé struct { 96ca64b086SPhilippe Mathieu-Daudé uint32_t length; 97ca64b086SPhilippe Mathieu-Daudé uint8_t data[4096]; 98ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 99ca64b086SPhilippe Mathieu-Daudé struct { 100ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 101ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 102ca64b086SPhilippe Mathieu-Daudé } u; 103ca64b086SPhilippe Mathieu-Daudé }; 104ca64b086SPhilippe Mathieu-Daudé 105ca64b086SPhilippe Mathieu-Daudé /* 106ca64b086SPhilippe Mathieu-Daudé * size of the TPM state blob to transfer; x86_64 can handle 8k, 107ca64b086SPhilippe Mathieu-Daudé * ppc64le only ~7k; keep the response below a 4k page size 108ca64b086SPhilippe Mathieu-Daudé */ 109ca64b086SPhilippe Mathieu-Daudé #define PTM_STATE_BLOB_SIZE (3 * 1024) 110ca64b086SPhilippe Mathieu-Daudé 111ca64b086SPhilippe Mathieu-Daudé /* 112ca64b086SPhilippe Mathieu-Daudé * The following is the data structure to get state blobs from the TPM. 113ca64b086SPhilippe Mathieu-Daudé * If the size of the state blob exceeds the PTM_STATE_BLOB_SIZE, multiple reads 114ca64b086SPhilippe Mathieu-Daudé * with this ioctl and with adjusted offset are necessary. All bytes 115ca64b086SPhilippe Mathieu-Daudé * must be transferred and the transfer is done once the last byte has been 116ca64b086SPhilippe Mathieu-Daudé * returned. 117ca64b086SPhilippe Mathieu-Daudé * It is possible to use the read() interface for reading the data; however, the 118ca64b086SPhilippe Mathieu-Daudé * first bytes of the state blob will be part of the response to the ioctl(); a 119ca64b086SPhilippe Mathieu-Daudé * subsequent read() is only necessary if the total length (totlength) exceeds 120ca64b086SPhilippe Mathieu-Daudé * the number of received bytes. seek() is not supported. 121ca64b086SPhilippe Mathieu-Daudé */ 122ca64b086SPhilippe Mathieu-Daudé struct ptm_getstate { 123ca64b086SPhilippe Mathieu-Daudé union { 124ca64b086SPhilippe Mathieu-Daudé struct { 125ca64b086SPhilippe Mathieu-Daudé uint32_t state_flags; /* may be: PTM_STATE_FLAG_DECRYPTED */ 126ca64b086SPhilippe Mathieu-Daudé uint32_t type; /* which blob to pull */ 127ca64b086SPhilippe Mathieu-Daudé uint32_t offset; /* offset from where to read */ 128ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 129ca64b086SPhilippe Mathieu-Daudé struct { 130ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 131ca64b086SPhilippe Mathieu-Daudé uint32_t state_flags; /* may be: PTM_STATE_FLAG_ENCRYPTED */ 132ca64b086SPhilippe Mathieu-Daudé uint32_t totlength; /* total length that will be transferred */ 133ca64b086SPhilippe Mathieu-Daudé uint32_t length; /* number of bytes in following buffer */ 134ca64b086SPhilippe Mathieu-Daudé uint8_t data[PTM_STATE_BLOB_SIZE]; 135ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 136ca64b086SPhilippe Mathieu-Daudé } u; 137ca64b086SPhilippe Mathieu-Daudé }; 138ca64b086SPhilippe Mathieu-Daudé 139ca64b086SPhilippe Mathieu-Daudé /* TPM state blob types */ 140ca64b086SPhilippe Mathieu-Daudé #define PTM_BLOB_TYPE_PERMANENT 1 141ca64b086SPhilippe Mathieu-Daudé #define PTM_BLOB_TYPE_VOLATILE 2 142ca64b086SPhilippe Mathieu-Daudé #define PTM_BLOB_TYPE_SAVESTATE 3 143ca64b086SPhilippe Mathieu-Daudé 144ca64b086SPhilippe Mathieu-Daudé /* state_flags above : */ 145ca64b086SPhilippe Mathieu-Daudé #define PTM_STATE_FLAG_DECRYPTED 1 /* on input: get decrypted state */ 146ca64b086SPhilippe Mathieu-Daudé #define PTM_STATE_FLAG_ENCRYPTED 2 /* on output: state is encrypted */ 147ca64b086SPhilippe Mathieu-Daudé 148ca64b086SPhilippe Mathieu-Daudé /* 149ca64b086SPhilippe Mathieu-Daudé * The following is the data structure to set state blobs in the TPM. 150ca64b086SPhilippe Mathieu-Daudé * If the size of the state blob exceeds the PTM_STATE_BLOB_SIZE, multiple 151ca64b086SPhilippe Mathieu-Daudé * 'writes' using this ioctl are necessary. The last packet is indicated 152ca64b086SPhilippe Mathieu-Daudé * by the length being smaller than the PTM_STATE_BLOB_SIZE. 153ca64b086SPhilippe Mathieu-Daudé * The very first packet may have a length indicator of '0' enabling 154ca64b086SPhilippe Mathieu-Daudé * a write() with all the bytes from a buffer. If the write() interface 155ca64b086SPhilippe Mathieu-Daudé * is used, a final ioctl with a non-full buffer must be made to indicate 156ca64b086SPhilippe Mathieu-Daudé * that all data were transferred (a write with 0 bytes would not work). 157ca64b086SPhilippe Mathieu-Daudé */ 158ca64b086SPhilippe Mathieu-Daudé struct ptm_setstate { 159ca64b086SPhilippe Mathieu-Daudé union { 160ca64b086SPhilippe Mathieu-Daudé struct { 161ca64b086SPhilippe Mathieu-Daudé uint32_t state_flags; /* may be PTM_STATE_FLAG_ENCRYPTED */ 162ca64b086SPhilippe Mathieu-Daudé uint32_t type; /* which blob to set */ 163ca64b086SPhilippe Mathieu-Daudé uint32_t length; /* length of the data; 164ca64b086SPhilippe Mathieu-Daudé use 0 on the first packet to 165ca64b086SPhilippe Mathieu-Daudé transfer using write() */ 166ca64b086SPhilippe Mathieu-Daudé uint8_t data[PTM_STATE_BLOB_SIZE]; 167ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 168ca64b086SPhilippe Mathieu-Daudé struct { 169ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 170ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 171ca64b086SPhilippe Mathieu-Daudé } u; 172ca64b086SPhilippe Mathieu-Daudé }; 173ca64b086SPhilippe Mathieu-Daudé 174ca64b086SPhilippe Mathieu-Daudé /* 175ca64b086SPhilippe Mathieu-Daudé * PTM_GET_CONFIG: Data structure to get runtime configuration information 176ca64b086SPhilippe Mathieu-Daudé * such as which keys are applied. 177ca64b086SPhilippe Mathieu-Daudé */ 178ca64b086SPhilippe Mathieu-Daudé struct ptm_getconfig { 179ca64b086SPhilippe Mathieu-Daudé union { 180ca64b086SPhilippe Mathieu-Daudé struct { 181ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 182ca64b086SPhilippe Mathieu-Daudé uint32_t flags; 183ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 184ca64b086SPhilippe Mathieu-Daudé } u; 185ca64b086SPhilippe Mathieu-Daudé }; 186ca64b086SPhilippe Mathieu-Daudé 187ca64b086SPhilippe Mathieu-Daudé #define PTM_CONFIG_FLAG_FILE_KEY 0x1 188ca64b086SPhilippe Mathieu-Daudé #define PTM_CONFIG_FLAG_MIGRATION_KEY 0x2 189ca64b086SPhilippe Mathieu-Daudé 190ca64b086SPhilippe Mathieu-Daudé /* 191ca64b086SPhilippe Mathieu-Daudé * PTM_SET_BUFFERSIZE: Set the buffer size to be used by the TPM. 192ca64b086SPhilippe Mathieu-Daudé * A 0 on input queries for the current buffer size. Any other 193ca64b086SPhilippe Mathieu-Daudé * number will try to set the buffer size. The returned number is 194ca64b086SPhilippe Mathieu-Daudé * the buffer size that will be used, which can be larger than the 195ca64b086SPhilippe Mathieu-Daudé * requested one, if it was below the minimum, or smaller than the 196ca64b086SPhilippe Mathieu-Daudé * requested one, if it was above the maximum. 197ca64b086SPhilippe Mathieu-Daudé */ 198ca64b086SPhilippe Mathieu-Daudé struct ptm_setbuffersize { 199ca64b086SPhilippe Mathieu-Daudé union { 200ca64b086SPhilippe Mathieu-Daudé struct { 201ca64b086SPhilippe Mathieu-Daudé uint32_t buffersize; /* 0 to query for current buffer size */ 202ca64b086SPhilippe Mathieu-Daudé } req; /* request */ 203ca64b086SPhilippe Mathieu-Daudé struct { 204ca64b086SPhilippe Mathieu-Daudé ptm_res tpm_result; 205ca64b086SPhilippe Mathieu-Daudé uint32_t buffersize; /* buffer size in use */ 206ca64b086SPhilippe Mathieu-Daudé uint32_t minsize; /* min. supported buffer size */ 207ca64b086SPhilippe Mathieu-Daudé uint32_t maxsize; /* max. supported buffer size */ 208ca64b086SPhilippe Mathieu-Daudé } resp; /* response */ 209ca64b086SPhilippe Mathieu-Daudé } u; 210ca64b086SPhilippe Mathieu-Daudé }; 211ca64b086SPhilippe Mathieu-Daudé 212efef4756SStefan Berger #define PTM_GETINFO_SIZE (3 * 1024) 213efef4756SStefan Berger /* 214efef4756SStefan Berger * PTM_GET_INFO: Get info about the TPM implementation (from libtpms) 215efef4756SStefan Berger * 216efef4756SStefan Berger * This request allows to indirectly call TPMLIB_GetInfo(flags) and 217efef4756SStefan Berger * retrieve information from libtpms. 218efef4756SStefan Berger * Only one transaction is currently necessary for returning results 219efef4756SStefan Berger * to a client. Therefore, totlength and length will be the same if 220efef4756SStefan Berger * offset is 0. 221efef4756SStefan Berger */ 222efef4756SStefan Berger struct ptm_getinfo { 223efef4756SStefan Berger union { 224efef4756SStefan Berger struct { 225efef4756SStefan Berger uint64_t flags; 226efef4756SStefan Berger uint32_t offset; /* offset from where to read */ 227efef4756SStefan Berger uint32_t pad; /* 32 bit arch */ 228efef4756SStefan Berger } req; /* request */ 229efef4756SStefan Berger struct { 230efef4756SStefan Berger ptm_res tpm_result; 231efef4756SStefan Berger uint32_t totlength; 232efef4756SStefan Berger uint32_t length; 233efef4756SStefan Berger char buffer[PTM_GETINFO_SIZE]; 234efef4756SStefan Berger } resp; /* response */ 235efef4756SStefan Berger } u; 236efef4756SStefan Berger }; 237efef4756SStefan Berger 238efef4756SStefan Berger #define SWTPM_INFO_TPMSPECIFICATION ((uint64_t)1 << 0) 239efef4756SStefan Berger #define SWTPM_INFO_TPMATTRIBUTES ((uint64_t)1 << 1) 240efef4756SStefan Berger 241efef4756SStefan Berger /* 242efef4756SStefan Berger * PTM_LOCK_STORAGE: Lock the storage and retry n times 243efef4756SStefan Berger */ 244efef4756SStefan Berger struct ptm_lockstorage { 245efef4756SStefan Berger union { 246efef4756SStefan Berger struct { 247efef4756SStefan Berger uint32_t retries; /* number of retries */ 248efef4756SStefan Berger } req; /* request */ 249efef4756SStefan Berger struct { 250efef4756SStefan Berger ptm_res tpm_result; 2510a19d879SMichael Tokarev } resp; /* response */ 252efef4756SStefan Berger } u; 253efef4756SStefan Berger }; 254ca64b086SPhilippe Mathieu-Daudé 255*312c5404SStefan Berger typedef uint64_t ptm_cap; /* CUSE-only; use ptm_cap_n otherwise */ 256*312c5404SStefan Berger typedef struct ptm_cap_n ptm_cap_n; 257ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_est ptm_est; 258ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_reset_est ptm_reset_est; 259ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_loc ptm_loc; 260ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_hdata ptm_hdata; 261ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_init ptm_init; 262ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_getstate ptm_getstate; 263ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_setstate ptm_setstate; 264ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_getconfig ptm_getconfig; 265ca64b086SPhilippe Mathieu-Daudé typedef struct ptm_setbuffersize ptm_setbuffersize; 266efef4756SStefan Berger typedef struct ptm_getinfo ptm_getinfo; 267efef4756SStefan Berger typedef struct ptm_lockstorage ptm_lockstorage; 268ca64b086SPhilippe Mathieu-Daudé 269ca64b086SPhilippe Mathieu-Daudé /* capability flags returned by PTM_GET_CAPABILITY */ 270ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_INIT (1) 271ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_SHUTDOWN (1 << 1) 272ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_GET_TPMESTABLISHED (1 << 2) 273ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_SET_LOCALITY (1 << 3) 274ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_HASHING (1 << 4) 275ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_CANCEL_TPM_CMD (1 << 5) 276ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_STORE_VOLATILE (1 << 6) 277ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_RESET_TPMESTABLISHED (1 << 7) 278ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_GET_STATEBLOB (1 << 8) 279ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_SET_STATEBLOB (1 << 9) 280ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_STOP (1 << 10) 281ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_GET_CONFIG (1 << 11) 282ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_SET_DATAFD (1 << 12) 283ca64b086SPhilippe Mathieu-Daudé #define PTM_CAP_SET_BUFFERSIZE (1 << 13) 284efef4756SStefan Berger #define PTM_CAP_GET_INFO (1 << 14) 285efef4756SStefan Berger #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15) 286efef4756SStefan Berger #define PTM_CAP_LOCK_STORAGE (1 << 16) 287ca64b086SPhilippe Mathieu-Daudé 288d1c637ecSBin Meng #ifndef _WIN32 289ca64b086SPhilippe Mathieu-Daudé enum { 290ca64b086SPhilippe Mathieu-Daudé PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap), 291ca64b086SPhilippe Mathieu-Daudé PTM_INIT = _IOWR('P', 1, ptm_init), 292ca64b086SPhilippe Mathieu-Daudé PTM_SHUTDOWN = _IOR('P', 2, ptm_res), 293ca64b086SPhilippe Mathieu-Daudé PTM_GET_TPMESTABLISHED = _IOR('P', 3, ptm_est), 294ca64b086SPhilippe Mathieu-Daudé PTM_SET_LOCALITY = _IOWR('P', 4, ptm_loc), 295ca64b086SPhilippe Mathieu-Daudé PTM_HASH_START = _IOR('P', 5, ptm_res), 296ca64b086SPhilippe Mathieu-Daudé PTM_HASH_DATA = _IOWR('P', 6, ptm_hdata), 297ca64b086SPhilippe Mathieu-Daudé PTM_HASH_END = _IOR('P', 7, ptm_res), 298ca64b086SPhilippe Mathieu-Daudé PTM_CANCEL_TPM_CMD = _IOR('P', 8, ptm_res), 299ca64b086SPhilippe Mathieu-Daudé PTM_STORE_VOLATILE = _IOR('P', 9, ptm_res), 300ca64b086SPhilippe Mathieu-Daudé PTM_RESET_TPMESTABLISHED = _IOWR('P', 10, ptm_reset_est), 301ca64b086SPhilippe Mathieu-Daudé PTM_GET_STATEBLOB = _IOWR('P', 11, ptm_getstate), 302ca64b086SPhilippe Mathieu-Daudé PTM_SET_STATEBLOB = _IOWR('P', 12, ptm_setstate), 303ca64b086SPhilippe Mathieu-Daudé PTM_STOP = _IOR('P', 13, ptm_res), 304ca64b086SPhilippe Mathieu-Daudé PTM_GET_CONFIG = _IOR('P', 14, ptm_getconfig), 305ca64b086SPhilippe Mathieu-Daudé PTM_SET_DATAFD = _IOR('P', 15, ptm_res), 306ca64b086SPhilippe Mathieu-Daudé PTM_SET_BUFFERSIZE = _IOWR('P', 16, ptm_setbuffersize), 307efef4756SStefan Berger PTM_GET_INFO = _IOWR('P', 17, ptm_getinfo), 308efef4756SStefan Berger PTM_LOCK_STORAGE = _IOWR('P', 18, ptm_lockstorage), 309ca64b086SPhilippe Mathieu-Daudé }; 310d1c637ecSBin Meng #endif 311ca64b086SPhilippe Mathieu-Daudé 312ca64b086SPhilippe Mathieu-Daudé /* 313ca64b086SPhilippe Mathieu-Daudé * Commands used by the non-CUSE TPMs 314ca64b086SPhilippe Mathieu-Daudé * 315ca64b086SPhilippe Mathieu-Daudé * All messages container big-endian data. 316ca64b086SPhilippe Mathieu-Daudé * 317ca64b086SPhilippe Mathieu-Daudé * The return messages only contain the 'resp' part of the unions 318ca64b086SPhilippe Mathieu-Daudé * in the data structures above. Besides that the limits in the 319ca64b086SPhilippe Mathieu-Daudé * buffers above (ptm_hdata:u.req.data and ptm_get_state:u.resp.data 320ca64b086SPhilippe Mathieu-Daudé * and ptm_set_state:u.req.data) are 0xffffffff. 321ca64b086SPhilippe Mathieu-Daudé */ 322ca64b086SPhilippe Mathieu-Daudé enum { 323efef4756SStefan Berger CMD_GET_CAPABILITY = 1, /* 0x01 */ 324efef4756SStefan Berger CMD_INIT, /* 0x02 */ 325efef4756SStefan Berger CMD_SHUTDOWN, /* 0x03 */ 326efef4756SStefan Berger CMD_GET_TPMESTABLISHED, /* 0x04 */ 327efef4756SStefan Berger CMD_SET_LOCALITY, /* 0x05 */ 328efef4756SStefan Berger CMD_HASH_START, /* 0x06 */ 329efef4756SStefan Berger CMD_HASH_DATA, /* 0x07 */ 330efef4756SStefan Berger CMD_HASH_END, /* 0x08 */ 331efef4756SStefan Berger CMD_CANCEL_TPM_CMD, /* 0x09 */ 332efef4756SStefan Berger CMD_STORE_VOLATILE, /* 0x0a */ 333efef4756SStefan Berger CMD_RESET_TPMESTABLISHED, /* 0x0b */ 334efef4756SStefan Berger CMD_GET_STATEBLOB, /* 0x0c */ 335efef4756SStefan Berger CMD_SET_STATEBLOB, /* 0x0d */ 336efef4756SStefan Berger CMD_STOP, /* 0x0e */ 337efef4756SStefan Berger CMD_GET_CONFIG, /* 0x0f */ 338efef4756SStefan Berger CMD_SET_DATAFD, /* 0x10 */ 339efef4756SStefan Berger CMD_SET_BUFFERSIZE, /* 0x11 */ 340efef4756SStefan Berger CMD_GET_INFO, /* 0x12 */ 341efef4756SStefan Berger CMD_LOCK_STORAGE, /* 0x13 */ 342ca64b086SPhilippe Mathieu-Daudé }; 343ca64b086SPhilippe Mathieu-Daudé 344efef4756SStefan Berger #endif /* _TPM_IOCTL_H_ */ 345