From d4c1ed997d49a76dc297189e64adaf60793e5f93 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Wed, 17 Jan 2024 16:14:08 +0100 Subject: [PATCH] reuse encodeBigInt --- cng/dsa.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cng/dsa.go b/cng/dsa.go index d7a5432..9c61ef1 100644 --- a/cng/dsa.go +++ b/cng/dsa.go @@ -451,11 +451,11 @@ func dsaAdjustHashSize(hkey bcrypt.KEY_HANDLE, hashed []byte, buf []byte) ([]byt if groupSize < len(hashed) { return hashed[:groupSize], nil } - zeroByteCount := groupSize - len(hashed) - for i := 0; i < zeroByteCount; i++ { - buf[i] = 0 + if err := encodeBigInt(buf, []sizedBigInt{ + {hashed, uint32(groupSize)}, + }); err != nil { + return nil, err } - copy(buf[zeroByteCount:], hashed) return buf[:groupSize], nil }