diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-04-26 09:55:32 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-04-26 09:55:32 +0200 |
| commit | 7b15ed9ef455b6b66c6b376898a88aef5d6a9970 (patch) | |
| tree | 3ef530baa80cdf29436ba981f5783be6b4d2202b /src/pkg/crypto/cipher/ctr.go | |
| parent | 50104cc32a498f7517a51c8dc93106c51c7a54b4 (diff) | |
| download | golang-7b15ed9ef455b6b66c6b376898a88aef5d6a9970.tar.gz | |
Imported Upstream version 2011.04.13upstream/2011.04.13
Diffstat (limited to 'src/pkg/crypto/cipher/ctr.go')
| -rw-r--r-- | src/pkg/crypto/cipher/ctr.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/crypto/cipher/ctr.go b/src/pkg/crypto/cipher/ctr.go index 04436ec23..147b74fc2 100644 --- a/src/pkg/crypto/cipher/ctr.go +++ b/src/pkg/crypto/cipher/ctr.go @@ -22,6 +22,10 @@ type ctr struct { // NewCTR returns a Stream which encrypts/decrypts using the given Block in // counter mode. The length of iv must be the same as the Block's block size. func NewCTR(block Block, iv []byte) Stream { + if len(iv) != block.BlockSize() { + panic("cipher.NewCTR: iv length must equal block size") + } + return &ctr{ b: block, ctr: dup(iv), |
