mirror of https://github.com/golang/go.git
crypto/internal/boring: factor Cache into crypto/internal/boring/bcache
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>
This commit is contained in:
parent
351e0f4083
commit
8f9bfa9b7b
|
|
@ -9,6 +9,7 @@ package ecdsa
|
||||||
import (
|
import (
|
||||||
"crypto/internal/boring"
|
"crypto/internal/boring"
|
||||||
"crypto/internal/boring/bbig"
|
"crypto/internal/boring/bbig"
|
||||||
|
"crypto/internal/boring/bcache"
|
||||||
"math/big"
|
"math/big"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
@ -26,8 +27,8 @@ import (
|
||||||
// still matches before using the cached key. The theory is that the real
|
// still matches before using the cached key. The theory is that the real
|
||||||
// operations are significantly more expensive than the comparison.
|
// operations are significantly more expensive than the comparison.
|
||||||
|
|
||||||
var pubCache boring.Cache
|
var pubCache bcache.Cache
|
||||||
var privCache boring.Cache
|
var privCache bcache.Cache
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pubCache.Register()
|
pubCache.Register()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// 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 (
|
import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package boring
|
package bcache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -9,6 +9,7 @@ package rsa
|
||||||
import (
|
import (
|
||||||
"crypto/internal/boring"
|
"crypto/internal/boring"
|
||||||
"crypto/internal/boring/bbig"
|
"crypto/internal/boring/bbig"
|
||||||
|
"crypto/internal/boring/bcache"
|
||||||
"math/big"
|
"math/big"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
@ -31,8 +32,8 @@ type boringPub struct {
|
||||||
orig PublicKey
|
orig PublicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
var pubCache boring.Cache
|
var pubCache bcache.Cache
|
||||||
var privCache boring.Cache
|
var privCache bcache.Cache
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pubCache.Register()
|
pubCache.Register()
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@ var depsRules = `
|
||||||
< net/mail;
|
< net/mail;
|
||||||
|
|
||||||
NONE < crypto/internal/boring/sig, crypto/internal/boring/syso;
|
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/internal/boring/sig, crypto/internal/boring/fipstls < crypto/tls/fipsonly;
|
||||||
|
|
||||||
# CRYPTO is core crypto algorithms - no cgo, fmt, net.
|
# CRYPTO is core crypto algorithms - no cgo, fmt, net.
|
||||||
|
|
@ -410,7 +410,10 @@ var depsRules = `
|
||||||
< crypto/internal/nistec
|
< crypto/internal/nistec
|
||||||
< crypto/internal/edwards25519/field, golang.org/x/crypto/curve25519/internal/field
|
< crypto/internal/edwards25519/field, golang.org/x/crypto/curve25519/internal/field
|
||||||
< crypto/internal/edwards25519
|
< crypto/internal/edwards25519
|
||||||
< crypto/cipher
|
< crypto/cipher;
|
||||||
|
|
||||||
|
crypto/cipher,
|
||||||
|
crypto/internal/boring/bcache
|
||||||
< crypto/internal/boring
|
< crypto/internal/boring
|
||||||
< crypto/boring
|
< crypto/boring
|
||||||
< crypto/aes, crypto/des, crypto/hmac, crypto/md5, crypto/rc4,
|
< crypto/aes, crypto/des, crypto/hmac, crypto/md5, crypto/rc4,
|
||||||
|
|
|
||||||
|
|
@ -1579,7 +1579,7 @@ func sync_runtime_registerPoolCleanup(f func()) {
|
||||||
poolcleanup = f
|
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) {
|
func boring_registerCache(p unsafe.Pointer) {
|
||||||
boringCaches = append(boringCaches, p)
|
boringCaches = append(boringCaches, p)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue