Skip to content

Commit

Permalink
fix: add signature length in marshal()
Browse files Browse the repository at this point in the history
Signed-off-by: Ruoyu Ying <[email protected]>
  • Loading branch information
Ruoyu-y committed Jun 26, 2024
1 parent 40cb444 commit b7fac90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/golang/cctrusted_base/tdx/report.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package tdx

import (
"encoding/binary"
"errors"

"github.com/cc-api/cc-trusted-api/common/golang/cctrusted_base"
)

Expand Down Expand Up @@ -54,7 +56,9 @@ func (t *TdxReport) Marshal() ([]byte, error) {
if !ok {
return []byte{}, errors.New("Invalid TDX Quote Signature.")
}

sig_size := make([]byte, 4)
binary.LittleEndian.PutUint32(sig_size, uint32(len(sig_ecdsa.raw.Binary)))
rawBytes = append(rawBytes, sig_size...)
rawBytes = append(rawBytes, sig_ecdsa.raw.Binary...)
return rawBytes, nil
}

0 comments on commit b7fac90

Please sign in to comment.