aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/ecdsa/ecdsa.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2017-12-06 00:35:28 -0500
committerRuss Cox <rsc@golang.org>2017-12-06 01:03:36 -0500
commit185e6094fd968b35b80e56aad1286c66bb2cc261 (patch)
tree411babe570d6faa1e99251a9167123afd07407d2 /src/crypto/ecdsa/ecdsa.go
parentc36033a379a4907fb75309416ffcf2904e613ab9 (diff)
parenta032f74bf0b40a94669159e7d7e96722eb76199b (diff)
downloadgo-185e6094fd968b35b80e56aad1286c66bb2cc261.tar.gz
go-185e6094fd968b35b80e56aad1286c66bb2cc261.zip
[dev.boringcrypto] all: merge master (nearly Go 1.10 beta 1) into dev.boringcrypto
This is a git merge of master into dev.boringcrypto. The branch was previously based on release-branch.go1.9, so there are a handful of spurious conflicts that would also arise if trying to merge master into release-branch.go1.9 (which we never do). Those have all been resolved by taking the original file from master, discarding any Go 1.9-specific edits. all.bash passes on darwin/amd64, which is to say without actually using BoringCrypto. Go 1.10-related fixes to BoringCrypto itself will be in a followup CL. This CL is just the merge. Change-Id: I4c97711fec0fb86761913dcde28d25c001246c35
Diffstat (limited to 'src/crypto/ecdsa/ecdsa.go')
-rw-r--r--src/crypto/ecdsa/ecdsa.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go
index 3fe1dda660..6a47cc7d98 100644
--- a/src/crypto/ecdsa/ecdsa.go
+++ b/src/crypto/ecdsa/ecdsa.go
@@ -53,7 +53,7 @@ type PublicKey struct {
boring unsafe.Pointer
}
-// PrivateKey represents a ECDSA private key.
+// PrivateKey represents an ECDSA private key.
type PrivateKey struct {
PublicKey
D *big.Int
@@ -70,21 +70,24 @@ func (priv *PrivateKey) Public() crypto.PublicKey {
return &priv.PublicKey
}
-// Sign signs msg with priv, reading randomness from rand. This method is
-// intended to support keys where the private part is kept in, for example, a
-// hardware module. Common uses should use the Sign function in this package
-// directly.
-func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error) {
+// Sign signs digest with priv, reading randomness from rand. The opts argument
+// is not currently used but, in keeping with the crypto.Signer interface,
+// should be the hash function used to digest the message.
+//
+// This method implements crypto.Signer, which is an interface to support keys
+// where the private part is kept in, for example, a hardware module. Common
+// uses should use the Sign function in this package directly.
+func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) {
if boring.Enabled && rand == boring.RandReader {
b, err := boringPrivateKey(priv)
if err != nil {
return nil, err
}
- return boring.SignMarshalECDSA(b, msg)
+ return boring.SignMarshalECDSA(b, digest)
}
boring.UnreachableExceptTests()
- r, s, err := Sign(rand, priv, msg)
+ r, s, err := Sign(rand, priv, digest)
if err != nil {
return nil, err
}