]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/sha512: fix checkAVX2
authorDavid du Colombier <0intro@gmail.com>
Tue, 28 Feb 2017 13:20:44 +0000 (14:20 +0100)
committerRuss Cox <rsc@golang.org>
Tue, 28 Feb 2017 13:38:39 +0000 (13:38 +0000)
The checkAVX2 test doesn't appear to be correct,
because it always returns the value of support_bmi2,
even if the value of support_avx2 is false.

Consequently, checkAVX2 always returns true, as long
as BMI2 is supported, even if AVX2 is not supported.

We change checkAVX2 to return false when support_avx2
is false.

Fixes #19316.

Change-Id: I2ec9dfaa09f4b54c4a03d60efef891b955d60578
Reviewed-on: https://go-review.googlesource.com/37590
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/crypto/sha512/sha512block_amd64.s

index 9c9fd98cd898410081fca1acf008d976d70bce4d..19b390a44832a0b3a1c5f7b5121178988bc1629f 100644 (file)
@@ -1480,6 +1480,7 @@ TEXT ·checkAVX2(SB), NOSPLIT, $0
        CMPB AX,$0
        JNE check_bmi2
        MOVB AX, ret+0(FP)
+       RET
 check_bmi2:
        MOVB runtime·support_bmi2(SB), AX
        MOVB AX, ret+0(FP)