From 1319ba6742a8562453646763adad22379674bab5 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 22 Feb 2023 19:21:46 +0000 Subject: Use minio/sha256-simd for accelerated SHA256 (#23052) minio/sha256-simd provides additional acceleration for SHA256 using AVX512, SHA Extensions for x86 and ARM64 for ARM. It provides a drop-in replacement for crypto/sha256 and if the extensions are not available it falls back to standard crypto/sha256. --------- Signed-off-by: Andrew Thornton Co-authored-by: John Olheiser --- models/auth/oauth2.go | 2 +- models/auth/twofactor.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'models/auth') diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go index 09d4bfc4ea..bda0668c45 100644 --- a/models/auth/oauth2.go +++ b/models/auth/oauth2.go @@ -5,7 +5,6 @@ package auth import ( "context" - "crypto/sha256" "encoding/base32" "encoding/base64" "fmt" @@ -18,6 +17,7 @@ import ( "code.gitea.io/gitea/modules/util" uuid "github.com/google/uuid" + "github.com/minio/sha256-simd" "golang.org/x/crypto/bcrypt" "xorm.io/builder" "xorm.io/xorm" diff --git a/models/auth/twofactor.go b/models/auth/twofactor.go index 5b3a9d011a..751a281f7e 100644 --- a/models/auth/twofactor.go +++ b/models/auth/twofactor.go @@ -5,7 +5,6 @@ package auth import ( "crypto/md5" - "crypto/sha256" "crypto/subtle" "encoding/base32" "encoding/base64" @@ -18,6 +17,7 @@ import ( "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" + "github.com/minio/sha256-simd" "github.com/pquerna/otp/totp" "golang.org/x/crypto/pbkdf2" ) -- cgit v1.2.3