Skip to content

Commit

Permalink
fix: backport darwin/arm64 patches from main
Browse files Browse the repository at this point in the history
This diff backports code to correctly handle darwin/arm64 from
`main` (see #7).

While there, this diff aims at reducing unnecessary differences with
the main branch, by removing code we also removed in there.

The reference issues are:

1. ooni/probe#2122

2. ooni/probe#2223
  • Loading branch information
bassosimone committed Aug 22, 2022
1 parent a495151 commit 24a810b
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 2,261 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ the package is only secure depending on the CPU configuration, which
currently only holds for `aes` (see [aes/const.go](aes/const.go))

- [ ] ensure that every forked package is never imported by using
the following checks (we could also use `go list`, in principle, but
I have not find a way for getting results for all architectures)
the following checks (we could also use `go list` as follows
`GOOS=os GOARCH=arch go list --json ./...`):

1. `git grep 'subtle"'`

Expand Down
500 changes: 0 additions & 500 deletions aes/asm_ppc64le.s

This file was deleted.

191 changes: 0 additions & 191 deletions aes/asm_s390x.s

This file was deleted.

66 changes: 0 additions & 66 deletions aes/cbc_s390x.go

This file was deleted.

6 changes: 3 additions & 3 deletions aes/cipher_asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package aes
import (
"crypto/cipher"

"github.com/ooni/oocrypto/internal/cpuarm64"
"github.com/ooni/oocrypto/internal/cpuoverlay"
"github.com/ooni/oocrypto/internal/subtle"
"golang.org/x/sys/cpu"
)
Expand All @@ -29,8 +29,8 @@ type aesCipherAsm struct {
aesCipher
}

var supportsAES = cpu.X86.HasAES || cpuarm64.HasAES()
var supportsGFMUL = cpu.X86.HasPCLMULQDQ || cpuarm64.HasPMULL()
var supportsAES = cpu.X86.HasAES || cpuoverlay.Arm64HasAES()
var supportsGFMUL = cpu.X86.HasPCLMULQDQ || cpuoverlay.Arm64HasPMULL()

func newCipher(key []byte) (cipher.Block, error) {
if !supportsAES {
Expand Down
2 changes: 1 addition & 1 deletion aes/cipher_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !amd64 && !s390x && !ppc64le && !arm64
//go:build !amd64 && !arm64

package aes

Expand Down
83 changes: 0 additions & 83 deletions aes/cipher_ppc64le.go

This file was deleted.

Loading

0 comments on commit 24a810b

Please sign in to comment.