From 354467ffbb81247ff17de9a70796b155337cb299 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Thu, 18 Dec 2014 03:18:23 -0500 Subject: [PATCH] crypto/cipher: update docs for the Stream interface Specify what will happen if len(dst) != len(src). Change-Id: I66afa3730f637753b825189687418f14ddec3629 Reviewed-on: https://go-review.googlesource.com/1754 Reviewed-by: Adam Langley --- src/crypto/cipher/cipher.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/crypto/cipher/cipher.go b/src/crypto/cipher/cipher.go index 67afdb1e05..7d27fde61d 100644 --- a/src/crypto/cipher/cipher.go +++ b/src/crypto/cipher/cipher.go @@ -29,6 +29,9 @@ type Block interface { type Stream interface { // XORKeyStream XORs each byte in the given slice with a byte from the // cipher's key stream. Dst and src may point to the same memory. + // If len(dst) < len(src), XORKeyStream should panic. It is acceptable + // to pass a dst bigger than src, and in that case, XORKeyStream will + // only update dst[:len(src)] and will not touch the rest of dst. XORKeyStream(dst, src []byte) } -- 2.48.1