From 74d4d6284a73398d652d1638114834a97f1e3fad Mon Sep 17 00:00:00 2001 From: duanying Date: Wed, 24 Apr 2024 10:40:10 +0800 Subject: [PATCH] fix MakeCredential return value error --- objectutil/credential.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/objectutil/credential.go b/objectutil/credential.go index 33fae6c..61de0bf 100644 --- a/objectutil/credential.go +++ b/objectutil/credential.go @@ -50,5 +50,14 @@ func MakeCredential(rand io.Reader, key *tpm2.Public, credential tpm2.Digest, ob return nil, nil, fmt.Errorf("cannot apply outer wrapper: %w", err) } + credentialBlob, err = mu.MarshalToBytes(credentialBlob) + if err != nil { + return nil, nil, fmt.Errorf("cannot marshal credential bytes: %w", err) + } + + secret, err = mu.MarshalToBytes(secret) + if err != nil { + return nil, nil, fmt.Errorf("cannot marshal secret bytes: %w", err) + } return credentialBlob, secret, nil }