mirror of
https://github.com/google/go-attestation.git
synced 2025-02-21 01:11:21 +00:00
Verify(): ensure that the hash function is available (#204)
This commit is contained in:
parent
440d34a877
commit
1379a4f766
@ -150,6 +150,9 @@ func (p *CertificationParameters) Verify(opts VerifyOpts) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("Only RSA verification keys are supported")
|
||||
}
|
||||
if !opts.Hash.Available() {
|
||||
return fmt.Errorf("hash function is unavailable")
|
||||
}
|
||||
hsh := opts.Hash.New()
|
||||
hsh.Write(p.CreateAttestation)
|
||||
|
||||
|
@ -97,6 +97,15 @@ func TestCertificationParametersTPM20(t *testing.T) {
|
||||
},
|
||||
err: cmpopts.AnyError,
|
||||
},
|
||||
{
|
||||
name: "unavailable hash function",
|
||||
p: &skCertParams,
|
||||
opts: VerifyOpts{
|
||||
Public: correctOpts.Public,
|
||||
Hash: crypto.BLAKE2b_384,
|
||||
},
|
||||
err: cmpopts.AnyError,
|
||||
},
|
||||
{
|
||||
name: "modified Public",
|
||||
p: &CertificationParameters{
|
||||
|
Loading…
x
Reference in New Issue
Block a user