Skip to content

Commit 59b5a86

Browse files
FiloSottilegopherbot
authored andcommitted
sha3: disable s390x assembly
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]>
1 parent 10f366e commit 59b5a86

6 files changed

+2
-66
lines changed

sha3/hashes.go

-12
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,27 @@ import (
1616
// Its generic security strength is 224 bits against preimage attacks,
1717
// and 112 bits against collision attacks.
1818
func New224() hash.Hash {
19-
if h := new224Asm(); h != nil {
20-
return h
21-
}
2219
return &state{rate: 144, outputLen: 28, dsbyte: 0x06}
2320
}
2421

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

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

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

sha3/hashes_generic.go

-27
This file was deleted.

sha3/sha3_s390x.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build gc && !purego
5+
//go:build gc && !purego && ignore
66

77
package sha3
88

sha3/sha3_s390x.s

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build gc && !purego
5+
//go:build gc && !purego && ignore
66

77
#include "textflag.h"
88

sha3/shake.go

-6
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,13 @@ func (c *state) Clone() ShakeHash {
115115
// Its generic security strength is 128 bits against all attacks if at
116116
// least 32 bytes of its output are used.
117117
func NewShake128() ShakeHash {
118-
if h := newShake128Asm(); h != nil {
119-
return h
120-
}
121118
return &state{rate: rate128, outputLen: 32, dsbyte: dsbyteShake}
122119
}
123120

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

sha3/shake_generic.go

-19
This file was deleted.

0 commit comments

Comments
 (0)