Skip to content

One shot hash functions allocates #43

Closed
@qmuntal

Description

@qmuntal

Since #41 one shot hash functions allocates memory in the heap, which they shouldn't. This was catch in the Microsoft build of Go CI: https://dev.azure.com/dnceng-public/public/_build/results?buildId=985995&view=ms.vss-test-web.build-test-results-tab&runId=26310528&resultId=152960&paneView=debug.

We should have a test in this repo that verifies we don't regress in this area.

Note that the regression comes because #41 didn't use the unsafe.Pointer(&*addr(p) trick to avoid p escaping to the heap: https://github.com/microsoft/go-crypto-darwin/pull/41/files#diff-3794e990c34a47b91f236be8c64ca1c0ce13c5d74a41baa12b83188807cb39baL48.

In the OpenSSL repo we recently moved away from this hack, and started using the #cgo noescape/nocallback directives: golang-fips/openssl#258. This repo should follow suit.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions