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
crypto/sha1: add native SHA1 instruction implementation for AMD64 #27443
Comments
\cc @FiloSottile |
A quick note on our assembly policy - https://github.com/golang/go/wiki/AssemblyPolicy. |
It's not allowed to translate/port GPL code and then include it in a BSD-licensed project. EDIT: Ah, I see that that file has dual BSD/GPLv2. It should be ok. |
The existing Go AVX implementation has a similar source: go/src/crypto/sha1/sha1block_amd64.s Lines 5 to 11 in 317afdc
|
As far as I understand (and I'm not a lawyer) , problematic part is a copyright. I don't think that translating some piece of code removes the copyright of the original author, so submitting it to go isn't possible due to copyright transfer required by go CLA. Moving sha1 code was possible because original copyright holder (Intel) has CLA with google/go. It would be better if someone wrote a clean implementation from scratch. |
Someone could contact one of the authors listed here: I'm pretty sure the only thing stopping Intel from submitting this code is that nobody has asked them to do it yet. |
A couple annoying legal clarifications: the CLA is not a copyright transfer, the original owner retains copyright; the original owner must not only have a CLA on file, but also give permission to submit the code under the CLA (either in writing or by sending the contribution themselves); and while we can take in BSD licensed code without a CLA, we have to carry its LICENSE notice and wall it off from the rest of the code, so we only do it when it's really worth it. All that said, please do read the https://github.com/golang/go/wiki/AssemblyPolicy, it looks like those loops could be neatly generated, for example. |
Change https://golang.org/cl/135378 mentions this issue: |
@BenLubar could you please check that https://go-review.googlesource.com/c/go/+/135378 works |
Looks good to me.
|
@aead, SHA-1 may be broken for security purposes, but it is still widely used in other areas. If we use https://github.com/golang/go/wiki/Benchmarks as an representative sample of go programs, faster SHA-1 is beneficial , e. g. satori/go.uuid/BenchmarkNewV5 gets ~15% faster with https://golang.org/cl/135378 |
@TocarIP Regarding git and legacy crypto:
In addition for projects like |
Change https://golang.org/cl/353402 mentions this issue: |
I've transliterated the Linux kernel version of native SHA1 instructions to Go's flavor of assembly. The result is a 1.5x to 3x speed-up on my Ryzen 5 1600. Could this be included in Go, similar to the AVX2 implementation that is already in crypto/sha1?
The text was updated successfully, but these errors were encountered: