From e6b0fdc3e1998fb7e2aac2abc36b20c49b99a53d Mon Sep 17 00:00:00 2001 From: Priyanshu Thapliyal Date: Tue, 24 Dec 2024 17:20:52 +0530 Subject: [PATCH] fix(measurement): enhance Valid method to check Extensions for measurement values Signed-off-by: Priyanshu Thapliyal --- comid/measurement.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/comid/measurement.go b/comid/measurement.go index 1977735..45fd182 100644 --- a/comid/measurement.go +++ b/comid/measurement.go @@ -424,6 +424,7 @@ func (o Mval) MarshalJSON() ([]byte, error) { } func (o Mval) Valid() error { + // Check if all base types are nil and Extensions are not nil if o.Ver == nil && o.SVN == nil && o.Digests == nil && @@ -436,7 +437,10 @@ func (o Mval) Valid() error { o.UEID == nil && o.UUID == nil && o.IntegrityRegisters == nil { - return fmt.Errorf("no measurement value set") + + if o.Extensions.IsEmpty() { + return fmt.Errorf("no measurement value set") + } } if o.Ver != nil {