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

Prevent RandReader.Read argument from escaping to the heap #202

Merged
merged 4 commits into from
Oct 11, 2024
Merged

Conversation

qmuntal
Copy link
Collaborator

@qmuntal qmuntal commented Oct 8, 2024

Go 1.24 will bring back noescape and nocallback cgo directives, this time without the issue that made us revert the previous attempt to use them (see #129).

For now just use the cgo directives for go_openssl_RAND_bytes, as there is no other way to avoid the allocation.

Copy link
Collaborator

@dagood dagood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just comments about factoring and comments.

cgo_go124.go Show resolved Hide resolved
rand_test.go Show resolved Hide resolved
rand_test.go Outdated Show resolved Hide resolved
qmuntal and others added 2 commits October 10, 2024 11:36
Co-authored-by: Davis Goodin <dagood@users.noreply.github.com>
cgo_go124.go Outdated Show resolved Hide resolved
@qmuntal qmuntal merged commit f8f4eb3 into v2 Oct 11, 2024
40 checks passed
@qmuntal qmuntal deleted the allocrand branch October 11, 2024 13:32
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.

3 participants