From 9c307d8039b8b6513c8a8363347bf49c2e933993 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 25 Aug 2017 21:24:15 -0400 Subject: [PATCH] [dev.boringcrypto] crypto/internal/cipherhw: fix AESGCMSupport for BoringCrypto The override was not commented and was in the wrong file. Change-Id: I739db561acff6d91b0f3559c8bb45437f11c0b04 Reviewed-on: https://go-review.googlesource.com/59250 Reviewed-by: Adam Langley --- src/crypto/internal/cipherhw/cipherhw_amd64.go | 8 ++++++++ src/crypto/internal/cipherhw/generic.go | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/crypto/internal/cipherhw/cipherhw_amd64.go b/src/crypto/internal/cipherhw/cipherhw_amd64.go index be0d490a221..a1267b17a29 100644 --- a/src/crypto/internal/cipherhw/cipherhw_amd64.go +++ b/src/crypto/internal/cipherhw/cipherhw_amd64.go @@ -6,11 +6,19 @@ package cipherhw +import "crypto/internal/boring" + // defined in asm_amd64.s func hasAESNI() bool // AESGCMSupport returns true if the Go standard library supports AES-GCM in // hardware. func AESGCMSupport() bool { + // If BoringCrypto is enabled, we report having + // AES-GCM support, so that crypto/tls will + // prioritize AES-GCM usage. + if boring.Enabled { + return true + } return hasAESNI() } diff --git a/src/crypto/internal/cipherhw/generic.go b/src/crypto/internal/cipherhw/generic.go index 4e7d2cb0411..64d90d3b41e 100644 --- a/src/crypto/internal/cipherhw/generic.go +++ b/src/crypto/internal/cipherhw/generic.go @@ -6,8 +6,6 @@ package cipherhw -import "crypto/internal/boring" - func AESGCMSupport() bool { - return boring.Enabled + return false }