Skip to content

Commit

Permalink
feat(s/c/tls): internal/cpu => internal/cpuproxy for arm64
Browse files Browse the repository at this point in the history
I extracted and adapted this diff from 62177de
with the intent of coming up with a more manageable patch set.

The idea here is to take advantage of the cpuproxy package to use the
information it provides to better initialize crypto using arm64.

The original issue describing this problem in its full extent was
ooni/probe#1444.

We're now working to forward-port this patch to go1.17.

The current issue describing this problem as of go1.17 is
ooni/probe#1863.

Is there a better way?
  • Loading branch information
bassosimone committed Nov 10, 2021
1 parent 849ebe0 commit ee1e862
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crypto/tls/cipher_suites.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"fmt"
"hash"
"internal/cpu"
"internal/cpuproxy"
"runtime"

"golang.org/x/crypto/chacha20poly1305"
Expand Down Expand Up @@ -356,7 +357,7 @@ var defaultCipherSuitesTLS13NoAES = []uint16{

var (
hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ
hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL
hasGCMAsmARM64 = cpuproxy.HasAES() && cpuproxy.HasGFMUL()
// Keep in sync with crypto/aes/cipher_s390x.go.
hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCBC && cpu.S390X.HasAESCTR &&
(cpu.S390X.HasGHASH || cpu.S390X.HasAESGCM)
Expand Down

0 comments on commit ee1e862

Please sign in to comment.