Skip to content

Commit

Permalink
sha3: disable s390x assembly
Browse files Browse the repository at this point in the history
It was integrated in such a way that it made devirtualization
impossible, leading to allocations on every platform.

It can be reintroduced according to AssemblyPolicy and TargetSpecific.

Updates #64897

Change-Id: I3a4edc91185c2928b2c9b80655a2bc8daa6b44e3
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/544816
Reviewed-by: Roland Shoemaker <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Mauri de Souza Meneguzzo <[email protected]>
Auto-Submit: Filippo Valsorda <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
  • Loading branch information
FiloSottile authored and gopherbot committed May 7, 2024
1 parent 10f366e commit 59b5a86
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 66 deletions.
12 changes: 0 additions & 12 deletions sha3/hashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,27 @@ import (
// Its generic security strength is 224 bits against preimage attacks,
// and 112 bits against collision attacks.
func New224() hash.Hash {
if h := new224Asm(); h != nil {
return h
}
return &state{rate: 144, outputLen: 28, dsbyte: 0x06}
}

// New256 creates a new SHA3-256 hash.
// Its generic security strength is 256 bits against preimage attacks,
// and 128 bits against collision attacks.
func New256() hash.Hash {
if h := new256Asm(); h != nil {
return h
}
return &state{rate: 136, outputLen: 32, dsbyte: 0x06}
}

// New384 creates a new SHA3-384 hash.
// Its generic security strength is 384 bits against preimage attacks,
// and 192 bits against collision attacks.
func New384() hash.Hash {
if h := new384Asm(); h != nil {
return h
}
return &state{rate: 104, outputLen: 48, dsbyte: 0x06}
}

// New512 creates a new SHA3-512 hash.
// Its generic security strength is 512 bits against preimage attacks,
// and 256 bits against collision attacks.
func New512() hash.Hash {
if h := new512Asm(); h != nil {
return h
}
return &state{rate: 72, outputLen: 64, dsbyte: 0x06}
}

Expand Down
27 changes: 0 additions & 27 deletions sha3/hashes_generic.go

This file was deleted.

2 changes: 1 addition & 1 deletion sha3/sha3_s390x.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 gc && !purego
//go:build gc && !purego && ignore

package sha3

Expand Down
2 changes: 1 addition & 1 deletion sha3/sha3_s390x.s
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 gc && !purego
//go:build gc && !purego && ignore

#include "textflag.h"

Expand Down
6 changes: 0 additions & 6 deletions sha3/shake.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,13 @@ func (c *state) Clone() ShakeHash {
// Its generic security strength is 128 bits against all attacks if at
// least 32 bytes of its output are used.
func NewShake128() ShakeHash {
if h := newShake128Asm(); h != nil {
return h
}
return &state{rate: rate128, outputLen: 32, dsbyte: dsbyteShake}
}

// NewShake256 creates a new SHAKE256 variable-output-length ShakeHash.
// Its generic security strength is 256 bits against all attacks if
// at least 64 bytes of its output are used.
func NewShake256() ShakeHash {
if h := newShake256Asm(); h != nil {
return h
}
return &state{rate: rate256, outputLen: 64, dsbyte: dsbyteShake}
}

Expand Down
19 changes: 0 additions & 19 deletions sha3/shake_generic.go

This file was deleted.

0 comments on commit 59b5a86

Please sign in to comment.