Skip to content

Commit 8f9bfa9

Browse files
rscgopherbot
authored andcommitted
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Russ Cox <[email protected]>
1 parent 351e0f4 commit 8f9bfa9

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

src/crypto/ecdsa/boring.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package ecdsa
99
import (
1010
"crypto/internal/boring"
1111
"crypto/internal/boring/bbig"
12+
"crypto/internal/boring/bcache"
1213
"math/big"
1314
"unsafe"
1415
)
@@ -26,8 +27,8 @@ import (
2627
// still matches before using the cached key. The theory is that the real
2728
// operations are significantly more expensive than the comparison.
2829

29-
var pubCache boring.Cache
30-
var privCache boring.Cache
30+
var pubCache bcache.Cache
31+
var privCache bcache.Cache
3132

3233
func init() {
3334
pubCache.Register()

src/crypto/internal/boring/cache.go renamed to src/crypto/internal/boring/bcache/cache.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
package boring
5+
// Package bcache implements a GC-friendly cache (see [Cache]) for BoringCrypto.
6+
package bcache
67

78
import (
89
"sync/atomic"

src/crypto/internal/boring/cache_test.go renamed to src/crypto/internal/boring/bcache/cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
package boring
5+
package bcache
66

77
import (
88
"fmt"

src/crypto/rsa/boring.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package rsa
99
import (
1010
"crypto/internal/boring"
1111
"crypto/internal/boring/bbig"
12+
"crypto/internal/boring/bcache"
1213
"math/big"
1314
"unsafe"
1415
)
@@ -31,8 +32,8 @@ type boringPub struct {
3132
orig PublicKey
3233
}
3334

34-
var pubCache boring.Cache
35-
var privCache boring.Cache
35+
var pubCache bcache.Cache
36+
var privCache bcache.Cache
3637

3738
func init() {
3839
pubCache.Register()

src/go/build/deps_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ var depsRules = `
393393
< net/mail;
394394
395395
NONE < crypto/internal/boring/sig, crypto/internal/boring/syso;
396-
sync/atomic < crypto/internal/boring/fipstls;
396+
sync/atomic < crypto/internal/boring/bcache, crypto/internal/boring/fipstls;
397397
crypto/internal/boring/sig, crypto/internal/boring/fipstls < crypto/tls/fipsonly;
398398
399399
# CRYPTO is core crypto algorithms - no cgo, fmt, net.
@@ -410,7 +410,10 @@ var depsRules = `
410410
< crypto/internal/nistec
411411
< crypto/internal/edwards25519/field, golang.org/x/crypto/curve25519/internal/field
412412
< crypto/internal/edwards25519
413-
< crypto/cipher
413+
< crypto/cipher;
414+
415+
crypto/cipher,
416+
crypto/internal/boring/bcache
414417
< crypto/internal/boring
415418
< crypto/boring
416419
< crypto/aes, crypto/des, crypto/hmac, crypto/md5, crypto/rc4,

src/runtime/mgc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ func sync_runtime_registerPoolCleanup(f func()) {
15791579
poolcleanup = f
15801580
}
15811581

1582-
//go:linkname boring_registerCache crypto/internal/boring.registerCache
1582+
//go:linkname boring_registerCache crypto/internal/boring/bcache.registerCache
15831583
func boring_registerCache(p unsafe.Pointer) {
15841584
boringCaches = append(boringCaches, p)
15851585
}

0 commit comments

Comments
 (0)