aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorzeripath2023-02-22 19:21:46 +0000
committerGitHub2023-02-22 14:21:46 -0500
commit1319ba6742a8562453646763adad22379674bab5 (patch)
treefe62dccd8bc7d8fb33f882257a53a2ce4eab1ccf /services
parenteb5a55785de39ae7162911f553b132c03ae7b424 (diff)
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 <art27@cantab.net> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'services')
-rw-r--r--services/auth/source/oauth2/jwtsigningkey.go2
-rw-r--r--services/lfs/server.go2
-rw-r--r--services/mailer/token/token.go3
-rw-r--r--services/webhook/deliver.go2
4 files changed, 5 insertions, 4 deletions
diff --git a/services/auth/source/oauth2/jwtsigningkey.go b/services/auth/source/oauth2/jwtsigningkey.go
index 93c157437..94feddbf6 100644
--- a/services/auth/source/oauth2/jwtsigningkey.go
+++ b/services/auth/source/oauth2/jwtsigningkey.go
@@ -9,7 +9,6 @@ import (
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
- "crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/pem"
@@ -25,6 +24,7 @@ import (
"code.gitea.io/gitea/modules/util"
"github.com/golang-jwt/jwt/v4"
+ "github.com/minio/sha256-simd"
ini "gopkg.in/ini.v1"
)
diff --git a/services/lfs/server.go b/services/lfs/server.go
index 320c8e728..217d45124 100644
--- a/services/lfs/server.go
+++ b/services/lfs/server.go
@@ -5,7 +5,6 @@ package lfs
import (
stdCtx "context"
- "crypto/sha256"
"encoding/base64"
"encoding/hex"
"errors"
@@ -32,6 +31,7 @@ import (
"code.gitea.io/gitea/modules/storage"
"github.com/golang-jwt/jwt/v4"
+ "github.com/minio/sha256-simd"
)
// requestContext contain variables from the HTTP request.
diff --git a/services/mailer/token/token.go b/services/mailer/token/token.go
index 8a5a762d6..aa7b56718 100644
--- a/services/mailer/token/token.go
+++ b/services/mailer/token/token.go
@@ -6,13 +6,14 @@ package token
import (
"context"
crypto_hmac "crypto/hmac"
- "crypto/sha256"
"encoding/base32"
"fmt"
"time"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/util"
+
+ "github.com/minio/sha256-simd"
)
// A token is a verifiable container describing an action.
diff --git a/services/webhook/deliver.go b/services/webhook/deliver.go
index effbe45e5..e389b1f9f 100644
--- a/services/webhook/deliver.go
+++ b/services/webhook/deliver.go
@@ -7,7 +7,6 @@ import (
"context"
"crypto/hmac"
"crypto/sha1"
- "crypto/sha256"
"crypto/tls"
"encoding/hex"
"fmt"
@@ -29,6 +28,7 @@ import (
webhook_module "code.gitea.io/gitea/modules/webhook"
"github.com/gobwas/glob"
+ "github.com/minio/sha256-simd"
)
// Deliver deliver hook task