Debian Codegraph @

tpm2/kdf.go

raw
1 package tpm2
2
3 import (
4 "crypto"
5
6 legacy "github.com/google/go-tpm/legacy/tpm2"
7 )
8
9 // KDFa implements TPM 2.0's default key derivation function, as defined in
10 // section 11.4.9.2 of the TPM revision 2 specification part 1.
11 // See: https://trustedcomputinggroup.org/resource/tpm-library-specification/
12 // The key & label parameters must not be zero length.
13 // The label parameter is a non-null-terminated string.
14 // The contextU & contextV parameters are optional.
15 func KDFa(h crypto.Hash, key []byte, label string, contextU, contextV []byte, bits int) []byte {
16 return legacy.KDFaHash(h, key, label, contextU, contextV, bits)
17 }
18
19 // KDFe implements TPM 2.0's ECDH key derivation function, as defined in
20 // section 11.4.9.3 of the TPM revision 2 specification part 1.
21 // See: https://trustedcomputinggroup.org/resource/tpm-library-specification/
22 // The z parameter is the x coordinate of one party's private ECC key multiplied
23 // by the other party's public ECC point.
24 // The use parameter is a non-null-terminated string.
25 // The partyUInfo and partyVInfo are the x coordinates of the initiator's and
26 // the responder's ECC points, respectively.
27 func KDFe(h crypto.Hash, z []byte, use string, partyUInfo, partyVInfo []byte, bits int) []byte {
28 return legacy.KDFeHash(h, z, use, partyUInfo, partyVInfo, bits)
29 }