run 'go get -u; make revendor'

Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
Stephan Renatus
2019-07-31 08:09:38 +02:00
parent 7c1b4b3005
commit 076cd77469
975 changed files with 347835 additions and 77390 deletions

View File

@@ -16,6 +16,7 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"io"
)
@@ -67,6 +68,10 @@ func Decrypt(ciphertext []byte, key *[32]byte) (plaintext []byte, err error) {
return nil, err
}
if len(ciphertext) < gcm.NonceSize() {
return nil, errors.New("malformed ciphertext")
}
return gcm.Open(nil,
ciphertext[:gcm.NonceSize()],
ciphertext[gcm.NonceSize():],

View File

@@ -60,7 +60,7 @@ func CheckHMAC(data, suppliedMAC []byte, key *[32]byte) bool {
return hmac.Equal(expectedMAC, suppliedMAC)
}
// GenerateSigningKey generates a random P-256 ECDSA private key.
// NewSigningKey generates a random P-256 ECDSA private key.
func NewSigningKey() (*ecdsa.PrivateKey, error) {
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
return key, err