Skip to content

Commit

Permalink
Merge pull request #6 from parazyd/noiseseed-fix
Browse files Browse the repository at this point in the history
Make sure that the buffer passed to indcpaGenMatrix isn't modified
  • Loading branch information
nadimkobeissi authored Dec 12, 2023
2 parents 9e394b2 + 95a6241 commit ba5df7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions indcpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ func indcpaGenMatrix(seed []byte, transposed bool, paramsK int) ([]polyvec, erro
xof.Reset()
var err error
if transposed {
_, err = xof.Write(append(seed, []byte{byte(i), byte(j)}...))
xof_buf := append(append(make([]byte, 0, len(seed)+2), seed...), byte(i), byte(j))
_, err = xof.Write(xof_buf)
} else {
_, err = xof.Write(append(seed, []byte{byte(j), byte(i)}...))
xof_buf := append(append(make([]byte, 0, len(seed)+2), seed...), byte(j), byte(i))
_, err = xof.Write(xof_buf)
}
if err != nil {
return []polyvec{}, err
Expand Down

0 comments on commit ba5df7e

Please sign in to comment.