simplify crypto/rand reading

This commit is contained in:
Lucas Clemente
2016-08-09 13:08:42 +02:00
parent 8c5a3dabd6
commit 4eb9077f1b
4 changed files with 6 additions and 9 deletions

View File

@@ -121,7 +121,7 @@ func deriveKey(secret []byte) ([]byte, error) {
func encryptToken(aead cipher.AEAD, token *sourceAddressToken) ([]byte, error) {
nonce := make([]byte, stkNonceSize)
if _, err := io.ReadFull(rand.Reader, nonce); err != nil {
if _, err := rand.Read(nonce); err != nil {
return nil, err
}
return aead.Seal(nonce, nonce, token.serialize(), nil), nil