aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/ecdsa/ecdsa.go
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2017-10-14 11:43:17 -0700
committerAdam Langley <agl@golang.org>2017-10-29 19:45:11 +0000
commit507ca082d116c19cbe5cbdd457e6b37d851d2341 (patch)
treebc0890fb2516bff8a59d835b572cc85ce540bfcb /src/crypto/ecdsa/ecdsa.go
parent5a4b6bce37ed85b1d26a00b215d2401d90de6b76 (diff)
downloadgo-507ca082d116c19cbe5cbdd457e6b37d851d2341.tar.gz
go-507ca082d116c19cbe5cbdd457e6b37d851d2341.zip
crypto/{ecdsa,rsa}: rename argument to PrivateKey.Sign.
The crypto.Signer interface takes pre-hased messages for ECDSA and RSA, but the argument in the implementations was called “msg”, not “digest”, which is confusing. This change renames them to help clarify the intended use. Change-Id: Ie2fb8753ca5280e493810d211c7c66223f94af88 Reviewed-on: https://go-review.googlesource.com/70950 Reviewed-by: Filippo Valsorda <hi@filippo.io>
Diffstat (limited to 'src/crypto/ecdsa/ecdsa.go')
-rw-r--r--src/crypto/ecdsa/ecdsa.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go
index 817bf7deb6..755ed284a9 100644
--- a/src/crypto/ecdsa/ecdsa.go
+++ b/src/crypto/ecdsa/ecdsa.go
@@ -64,12 +64,15 @@ 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) {
- r, s, err := Sign(rand, priv, msg)
+// 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) {
+ r, s, err := Sign(rand, priv, digest)
if err != nil {
return nil, err
}