Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align internal SHAKE buffer when using it as []uint64 #92

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

bwesterb
Copy link
Member

@bwesterb bwesterb commented Mar 4, 2020

The Go runtime assumes that a pointer to a type is aligned on the size
of that type. We cast a [N]byte to []uint64, which breaks this
assumption. Thus allocate the original [N]byte as a [N/8]uint64 instead.

Fixes #89

Cf. the same issue and patch in upstream:

patch https://go-review.googlesource.com/c/crypto/+/203837/
issue golang/go#35173

The Go runtime assumes that a pointer to a type is aligned on the size
of that type.  We cast a [N]byte to []uint64, which breaks this
assumption.  Thus allocate the original [N]byte as a [N/8]uint64 instead.

Fixes cloudflare#89

Cf. the same issue and patch in upstream:

  patch https://go-review.googlesource.com/c/crypto/+/203837/
  issue golang/go#35173
@bwesterb bwesterb requested a review from armfazh March 4, 2020 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shake is crashing when using unsafe pointer casting
2 participants