github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/go/tpm2/structures.go (about) 1 // Copyright (c) 2014, Google Inc. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package tpm2 16 17 import ( 18 "fmt" 19 ) 20 21 // A Handle is a 32-bit unsigned integer. 22 type Handle uint32 23 24 // A commandHeader is the header for a TPM command. 25 type commandHeader struct { 26 Tag uint16 27 Size uint32 28 Cmd uint32 29 } 30 31 // String returns a string version of a commandHeader 32 func (ch commandHeader) String() string { 33 return fmt.Sprintf("commandHeader{Tag: %x, Size: %x, Cmd: %x}", ch.Tag, ch.Size, ch.Cmd) 34 } 35 36 // A responseHeader is a header for TPM responses. 37 type responseHeader struct { 38 Tag uint16 39 Size uint32 40 Res uint32 41 } 42 43 type RsaParams struct { 44 Enc_alg uint16 45 Hash_alg uint16 46 Attributes uint32 47 Auth_policy []byte 48 Symalg uint16 49 Sym_sz uint16 50 Mode uint16 51 Scheme uint16 52 Scheme_hash uint16 53 Mod_sz uint16 54 Exp uint32 55 Modulus []byte 56 } 57 58 type KeyedHashParams struct { 59 Type_alg uint16 60 Hash_alg uint16 61 Attributes uint32 62 Auth_policy []byte 63 Symalg uint16 64 Sym_sz uint16 65 Mode uint16 66 Scheme uint16 67 Unique []byte 68 } 69 70 type AttestParams struct { 71 Magic_number uint32 72 Attest_type uint16 73 Name []byte 74 Data []byte 75 Clock uint64 76 ResetCount uint32 77 RestartCount uint32 78 Safe byte 79 FirmwareVersion uint64 80 PcrSelect []byte 81 PcrDigest []byte 82 } 83 84