From a38a2d02d5c26adb34ec18b495a1d698517c1735 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 28 Feb 2017 14:20:44 +0100 Subject: [PATCH] crypto/sha512: fix checkAVX2 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 Reviewed-by: Russ Cox --- src/crypto/sha512/sha512block_amd64.s | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crypto/sha512/sha512block_amd64.s b/src/crypto/sha512/sha512block_amd64.s index 9c9fd98cd8..19b390a448 100644 --- a/src/crypto/sha512/sha512block_amd64.s +++ b/src/crypto/sha512/sha512block_amd64.s @@ -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) -- 2.50.0