]> Cypherpunks.ru repositories - gostls13.git/commitdiff
crypto/internal/boring: factor Cache into crypto/internal/boring/bcache
authorRuss Cox <rsc@golang.org>
Wed, 11 May 2022 19:11:29 +0000 (15:11 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 27 Jun 2022 11:50:31 +0000 (11:50 +0000)
Requested by the maintainers of the OpenSSL-based fork of Go+BoringCrypto,
to make maintaining that fork easier.

Change-Id: I770e70ecc12b589034da31edecf59c73b2c6e1dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/407135
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

src/crypto/ecdsa/boring.go
src/crypto/internal/boring/bcache/cache.go [moved from src/crypto/internal/boring/cache.go with 97% similarity]
src/crypto/internal/boring/bcache/cache_test.go [moved from src/crypto/internal/boring/cache_test.go with 99% similarity]
src/crypto/internal/boring/bcache/stub.s [moved from src/crypto/internal/boring/stub.s with 100% similarity]
src/crypto/rsa/boring.go
src/go/build/deps_test.go
src/runtime/mgc.go

index edb723fe0ee2dc387580d3098902dc48ce4265f2..4495730b84ffdc60f1f0af363ab2724319b21706 100644 (file)
@@ -9,6 +9,7 @@ package ecdsa
 import (
        "crypto/internal/boring"
        "crypto/internal/boring/bbig"
+       "crypto/internal/boring/bcache"
        "math/big"
        "unsafe"
 )
@@ -26,8 +27,8 @@ import (
 // still matches before using the cached key. The theory is that the real
 // operations are significantly more expensive than the comparison.
 
-var pubCache boring.Cache
-var privCache boring.Cache
+var pubCache bcache.Cache
+var privCache bcache.Cache
 
 func init() {
        pubCache.Register()
similarity index 97%
rename from src/crypto/internal/boring/cache.go
rename to src/crypto/internal/boring/bcache/cache.go
index 476e47706c91568428117a9390732af090000459..c0b9d7bf2a49841904a2ed72efd620569d0c255e 100644 (file)
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package boring
+// Package bcache implements a GC-friendly cache (see [Cache]) for BoringCrypto.
+package bcache
 
 import (
        "sync/atomic"
similarity index 99%
rename from src/crypto/internal/boring/cache_test.go
rename to src/crypto/internal/boring/bcache/cache_test.go
index f9ccb74f6fdd31a8a703c50ba852efd418935cc9..8b2cf3d09415d8e7c7a7d7222596f56acf67da7a 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package boring
+package bcache
 
 import (
        "fmt"
index fc2842fb341cc3f182aaf02c9e88d36308cd41cc..9b1db564c36f3cee2a5cd2edc645da4b082dc6e7 100644 (file)
@@ -9,6 +9,7 @@ package rsa
 import (
        "crypto/internal/boring"
        "crypto/internal/boring/bbig"
+       "crypto/internal/boring/bcache"
        "math/big"
        "unsafe"
 )
@@ -31,8 +32,8 @@ type boringPub struct {
        orig PublicKey
 }
 
-var pubCache boring.Cache
-var privCache boring.Cache
+var pubCache bcache.Cache
+var privCache bcache.Cache
 
 func init() {
        pubCache.Register()
index 5b971b93e20803a2eaf90a2c293a9d56437b16a0..84cc9de8e786e067315861c0cdeda50b764dfc0a 100644 (file)
@@ -393,7 +393,7 @@ var depsRules = `
        < net/mail;
 
        NONE < crypto/internal/boring/sig, crypto/internal/boring/syso;
-       sync/atomic < crypto/internal/boring/fipstls;
+       sync/atomic < crypto/internal/boring/bcache, crypto/internal/boring/fipstls;
        crypto/internal/boring/sig, crypto/internal/boring/fipstls < crypto/tls/fipsonly;
 
        # CRYPTO is core crypto algorithms - no cgo, fmt, net.
@@ -410,7 +410,10 @@ var depsRules = `
        < crypto/internal/nistec
        < crypto/internal/edwards25519/field, golang.org/x/crypto/curve25519/internal/field
        < crypto/internal/edwards25519
-       < crypto/cipher
+       < crypto/cipher;
+
+       crypto/cipher,
+       crypto/internal/boring/bcache
        < crypto/internal/boring
        < crypto/boring
        < crypto/aes, crypto/des, crypto/hmac, crypto/md5, crypto/rc4,
index 9b25948255d96e191f36209e49f829ef9ffcd3aa..63e04636d7ce86dc8f48946bc17ed08ae3611569 100644 (file)
@@ -1579,7 +1579,7 @@ func sync_runtime_registerPoolCleanup(f func()) {
        poolcleanup = f
 }
 
-//go:linkname boring_registerCache crypto/internal/boring.registerCache
+//go:linkname boring_registerCache crypto/internal/boring/bcache.registerCache
 func boring_registerCache(p unsafe.Pointer) {
        boringCaches = append(boringCaches, p)
 }