2022-09-07 04:39:38 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
package snp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type signatureError struct {
|
|
|
|
innerError error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *signatureError) Unwrap() error {
|
|
|
|
return e.innerError
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *signatureError) Error() string {
|
|
|
|
return fmt.Sprintf("signature validation failed: %v", e.innerError)
|
|
|
|
}
|
|
|
|
|
|
|
|
type askError struct {
|
|
|
|
innerError error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *askError) Unwrap() error {
|
|
|
|
return e.innerError
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *askError) Error() string {
|
|
|
|
return fmt.Sprintf("validating ASK: %v", e.innerError)
|
|
|
|
}
|
|
|
|
|
|
|
|
type vcekError struct {
|
|
|
|
innerError error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *vcekError) Unwrap() error {
|
|
|
|
return e.innerError
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *vcekError) Error() string {
|
|
|
|
return fmt.Sprintf("validating VCEK: %v", e.innerError)
|
|
|
|
}
|
|
|
|
|
|
|
|
type idKeyError struct {
|
2023-01-18 10:49:55 -05:00
|
|
|
encounteredValue []byte
|
2023-04-06 11:00:56 -04:00
|
|
|
expectedValues [][]byte
|
2022-09-07 04:39:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *idKeyError) Unwrap() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *idKeyError) Error() string {
|
2023-05-03 05:11:53 -04:00
|
|
|
return fmt.Sprintf("accepted idkeydigest list %x doesn't contain reported idkeydigest %x", e.expectedValues, e.encounteredValue)
|
2022-09-07 04:39:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type versionError struct {
|
|
|
|
expectedType string
|
|
|
|
excpectedVersion tcbVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *versionError) Unwrap() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *versionError) Error() string {
|
|
|
|
return fmt.Sprintf("invalid %s version: %x", e.expectedType, e.excpectedVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
var errDebugEnabled = errors.New("SNP report indicates debugging, expected no debugging")
|