From 4b334b8739a07cdc5835f898af42368998a7cbfb Mon Sep 17 00:00:00 2001 From: Yogesh Deshpande Date: Thu, 30 Nov 2023 18:51:41 -0500 Subject: [PATCH] Commiting intermittent work Signed-off-by: Yogesh Deshpande --- scheme/cca-realm/evidence_handler.go | 2 -- vts/appraisal/appraisal.go | 8 ++++++++ vts/trustedservices/trustedservices_grpc.go | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/scheme/cca-realm/evidence_handler.go b/scheme/cca-realm/evidence_handler.go index d865bae4..933cf060 100644 --- a/scheme/cca-realm/evidence_handler.go +++ b/scheme/cca-realm/evidence_handler.go @@ -184,7 +184,5 @@ func populateAttestationResult( } appraisal.UpdateStatusFromTrustVector() - appraisal.VeraisonAnnotatedEvidence = &evidence - return nil } diff --git a/vts/appraisal/appraisal.go b/vts/appraisal/appraisal.go index 700b1133..659ccdf6 100644 --- a/vts/appraisal/appraisal.go +++ b/vts/appraisal/appraisal.go @@ -88,3 +88,11 @@ func (o *Appraisal) InitPolicyID() { submod.AppraisalPolicyID = &policyID } } + +func (o *Appraisal) Update(apr *Appraisal) (*Appraisal, error) { + for key, submod := range apr.Result.Submods { + o.Result.Submods[key] = submod + } + + return o, nil +} diff --git a/vts/trustedservices/trustedservices_grpc.go b/vts/trustedservices/trustedservices_grpc.go index f8f83b96..f8bdfb46 100644 --- a/vts/trustedservices/trustedservices_grpc.go +++ b/vts/trustedservices/trustedservices_grpc.go @@ -407,12 +407,23 @@ func (o *GRPC) GetAttestation( mediaType := token.MediaType requireAttestation := true + var overallAppraisal *appraisal.Appraisal for requireAttestation { appraisal, err := o.getPerSchemeAttestation(ctx, mediaType, token) if err != nil { return o.finalize(appraisal, err) } + if overallAppraisal == nil { + overallAppraisal = appraisal + } else { + // Note we can just append subModule here, however for the now, entire Appraisal is passed + overallAppraisal, err = overallAppraisal.Update(appraisal) + if err != nil { + return o.finalize(overallAppraisal, err) + } + } + o.logger.Infow("Yogesh: Attestation Scheme =", "AS", appraisal.Scheme) ar := appraisal.Result @@ -422,7 +433,12 @@ func (o *GRPC) GetAttestation( mediaType = *ar.UpMediaType o.logger.Infow("Yogesh: Extracted MediaType=", "EC MT", mediaType) } else { - o.logger.Infow("evaluated attestation result", "attestation-result", appraisal.Result) + // o.logger.Infow("evaluated attestation result", "attestation-result", overallAppraisal.Result) + for key, submod := range overallAppraisal.Result.Submods { + o.logger.Infow("evaluated sub mod", "key=", key, "value=", submod) + //o.Result.Submods[key] = submod + } + requireAttestation = false return o.finalize(appraisal, err) }