Skip to content

Commit 2640dd7

Browse files
authored
atls: Clarify usage of dst in ALTSRecordCrypto interface docs (#8266)
1 parent 58d1a72 commit 2640dd7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

credentials/alts/internal/conn/record.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ import (
3131

3232
// ALTSRecordCrypto is the interface for gRPC ALTS record protocol.
3333
type ALTSRecordCrypto interface {
34-
// Encrypt encrypts the plaintext and computes the tag (if any) of dst
35-
// and plaintext. dst and plaintext may fully overlap or not at all.
34+
// Encrypt encrypts the plaintext, computes the tag (if any) of dst and
35+
// plaintext, and appends the result to dst, returning the updated slice.
36+
// dst and plaintext may fully overlap or not at all.
3637
Encrypt(dst, plaintext []byte) ([]byte, error)
3738
// EncryptionOverhead returns the tag size (if any) in bytes.
3839
EncryptionOverhead() int
39-
// Decrypt decrypts ciphertext and verify the tag (if any). dst and
40-
// ciphertext may alias exactly or not at all. To reuse ciphertext's
41-
// storage for the decrypted output, use ciphertext[:0] as dst.
40+
// Decrypt decrypts ciphertext and verifies the tag (if any). If successful,
41+
// this function appends the resulting plaintext to dst, returning the
42+
// updated slice. dst and ciphertext may alias exactly or not at all. To
43+
// reuse ciphertext's storage for the decrypted output, use ciphertext[:0]
44+
// as dst. Even if the function fails, the contents of dst, up to its
45+
// capacity, may be overwritten.
4246
Decrypt(dst, ciphertext []byte) ([]byte, error)
4347
}
4448

0 commit comments

Comments
 (0)