Skip to content

Commit 4aeaf28

Browse files
committed
Add back key_type for TPM 2.0 without IDevID implementation.
1 parent 9c5075d commit 4aeaf28

6 files changed

Lines changed: 39 additions & 26 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ while TPM 1.2 systems are not supported.
585585
`TPM2_Import` command to import the received HMAC-SHA256 key into TPM,
586586
finally invoke `TPM2_Certify` command to certify any TPM residing key
587587
using the imported HMAC-SHA256 key. When invoking `TPM2_Certify`
588-
command, the `qualifyingData` argument must hold a TPMT_HA structure,
589-
with TPMT_HA.hashAlg field set to TPM_ALG_SHA256 and TPMT_HA.digest
588+
command, the `qualifyingData` argument must hold a `TPMT_HA` structure,
589+
with `TPMT_HA.hashAlg` field set to TPM_ALG_SHA256 and `TPMT_HA.digest`
590590
field set to the SHA256 hash over the `serialized_transport_key`.
591591
- For TPM 1.2, populate the `tpm12_ek` field of this message. First
592592
create a `TransportKey` message by generating an ephemeral HPKE key

proto/bootz.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,12 @@ message BootstrapStreamResponseV1 {
565565
bytes nonce = 1;
566566
}
567567
message ChallengeRequestTPM20HMAC {
568+
// The encryption key type: EK or PPK.
569+
openconfig.attestz.Key key_type = 1;
568570
// The HMAC key encrypted to EK/PPK.
569571
// The device should invoke TPM2_Import command to import this HMAC key
570572
// into the TPM.
571-
// NOTE: Whether it is encrypted to EK or PPK is decided by the identity
572-
// (tpm20_ek_pub or tpm20_ppk_pub) presented by the device.
573+
// NOTE: Whether it is encrypted to EK or PPK is decided by the key_type.
573574
openconfig.attestz.HMACChallenge hmac_encrypted = 2;
574575
}
575576
message ChallengeRequestTPM12EK {

proto/bootz/bootz.pb.go

Lines changed: 29 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/bootz/bootz_grpc.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/entitymanager/entitymanager.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ func (m *InMemoryEntityManager) ResolveChassis(ctx context.Context, chassis *typ
6868
}
6969
var key *rsa.PublicKey
7070
var keyType tpb.Key
71-
if _, ok := chassis.Identity.GetType().(*bpb.Identity_EkPpkPub); ok {
71+
switch chassis.Identity.GetType().(type) {
72+
case *bpb.Identity_Tpm20EkPub, *bpb.Identity_Tpm20PpkPub, *bpb.Identity_Tpm12EkPub, *bpb.Identity_EkPpkPub:
7273
for _, c := range inventory.GetControllerCards() {
7374
if c.GetSerialNumber() == chassis.ActiveSerial {
7475
block, _ := pem.Decode([]byte(c.GetPublicKey()))

server/service/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ func (s *Service) createChallengeRequest(session *streamSessionV1, message proto
733733
ChallengeRequest: &bpb.BootstrapStreamResponseV1_ChallengeRequest{
734734
Type: &bpb.BootstrapStreamResponseV1_ChallengeRequest_Tpm20Hmac{
735735
Tpm20Hmac: &bpb.BootstrapStreamResponseV1_ChallengeRequest_ChallengeRequestTPM20HMAC{
736+
KeyType: chassis.ActivePublicKeyType,
736737
HmacEncrypted: &epb.HMACChallenge{
737738
HmacPubKey: tpm2.Marshal(tpm2.New2B(*hmacPub)),
738739
Duplicate: tpm2.Marshal(&tpm2.TPM2BPrivate{Buffer: duplicate}),

0 commit comments

Comments
 (0)