Fix Intel EK certificate URLs on Linux (#347)

This commit is contained in:
Herman Slatman 2023-09-08 20:23:49 +02:00 committed by GitHub
parent 42c11fc152
commit 3d71f101b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -212,13 +212,24 @@ func (t *wrappedTPM20) eks() ([]EK, error) {
if pub.RSAParameters == nil {
return nil, errors.New("ECC EK not yet supported")
}
i, err := t.info()
if err != nil {
return nil, fmt.Errorf("Retrieving TPM info failed: %v", err)
}
ekPub := &rsa.PublicKey{
E: int(pub.RSAParameters.Exponent()),
N: pub.RSAParameters.Modulus(),
}
var certificateURL string
if i.Manufacturer.String() == manufacturerIntel {
certificateURL = intelEKURL(ekPub)
}
return []EK{
{
Public: &rsa.PublicKey{
E: int(pub.RSAParameters.Exponent()),
N: pub.RSAParameters.Modulus(),
},
handle: commonRSAEkEquivalentHandle,
Public: ekPub,
CertificateURL: certificateURL,
handle: commonRSAEkEquivalentHandle,
},
}, nil
}