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
This commit is contained in:
Marcin Wielgoszewski 2023-11-09 11:39:58 -05:00 committed by GitHub
parent 93c5899459
commit a3545dfc94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,7 +623,9 @@ func signECDSA(rw io.ReadWriter, key tpmutil.Handle, digest []byte, curve ellipt
if excess > 0 {
ret.Rsh(ret, uint(excess))
}
digest = ret.Bytes()
// call ret.FillBytes() here instead of ret.Bytes() to preserve leading zeroes
// that may have been dropped when converting the digest to an integer
digest = ret.FillBytes(digest)
sig, err := tpm2.Sign(rw, key, "", digest, nil, nil)
if err != nil {