Skip to content

Commit a3545df

Browse files
don't drop leading zeroes when performing generic ecdsa signing (#357)
call ret.FillBytes() instead of ret.Bytes() to preserve leading zeroes that may have been dropped when converting the digest to an integer
1 parent 93c5899 commit a3545df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

attest/wrapped_tpm20.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ func signECDSA(rw io.ReadWriter, key tpmutil.Handle, digest []byte, curve ellipt
623623
if excess > 0 {
624624
ret.Rsh(ret, uint(excess))
625625
}
626-
digest = ret.Bytes()
626+
// call ret.FillBytes() here instead of ret.Bytes() to preserve leading zeroes
627+
// that may have been dropped when converting the digest to an integer
628+
digest = ret.FillBytes(digest)
627629

628630
sig, err := tpm2.Sign(rw, key, "", digest, nil, nil)
629631
if err != nil {

0 commit comments

Comments
 (0)