aboutsummaryrefslogtreecommitdiff
path: root/crypto/crypto.go
diff options
context:
space:
mode:
authorebiggers <ebiggers@google.com>2019-09-08 19:46:59 -0700
committerJoseph Richey <joerichey@google.com>2019-09-08 19:46:59 -0700
commit6445dad7d66fa6a1867090fcd9602c98863649f6 (patch)
treec0e5209f018a50ee8b0a1277cc7b06266eff18c1 /crypto/crypto.go
parent28b29d1c97ffd97671186b5e1fae37b64424f9ee (diff)
Fix various typos and grammatical errors (#141)
These were found by a combination of manual review and a custom script that checks for common errors. Also removed an outdated sentence from the comment for setupBefore().
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r--crypto/crypto.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index 7327bd5..8de8134 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -50,7 +50,7 @@ import (
// Crypto error values
var (
ErrBadAuth = errors.New("key authentication check failed")
- ErrNegitiveLength = errors.New("keys cannot have negative lengths")
+ ErrNegativeLength = errors.New("keys cannot have negative lengths")
ErrRecoveryCode = errors.New("invalid recovery code")
ErrGetrandomFail = util.SystemError("getrandom() failed")
ErrKeyAlloc = util.SystemError("could not allocate memory for key")
@@ -71,8 +71,8 @@ func checkWrappingKey(wrappingKey *Key) error {
return errors.Wrap(err, "wrapping key")
}
-// stretchKey stretches a key of length KeyLen using unsalted HKDF to make two
-// keys of length KeyLen.
+// stretchKey stretches a key of length InternalKeyLen using unsalted HKDF to
+// make two keys of length InternalKeyLen.
func stretchKey(key *Key) (encKey, authKey *Key) {
panicInputLength("hkdf key", metadata.InternalKeyLen, key.Len())
@@ -148,9 +148,10 @@ func Wrap(wrappingKey, secretKey *Key) (*metadata.WrappedKeyData, error) {
return data, nil
}
-// Unwrap takes a wrapping Key of length KeyLen, and uses it to unwrap the
-// WrappedKeyData to get the unwrapped secret Key. The Wrapped Key data includes
-// an authentication check, so an error will be returned if that check fails.
+// Unwrap takes a wrapping Key of length InternalKeyLen, and uses it to unwrap
+// the WrappedKeyData to get the unwrapped secret Key. The Wrapped Key data
+// includes an authentication check, so an error will be returned if that check
+// fails.
func Unwrap(wrappingKey *Key, data *metadata.WrappedKeyData) (*Key, error) {
if err := checkWrappingKey(wrappingKey); err != nil {
return nil, err