mirror of
https://github.com/golang/go
synced 2024-11-21 21:54:40 -07:00
crypto/cipher: bad CTR IV length now triggers panic
R=rsc CC=golang-dev https://golang.org/cl/4326042
This commit is contained in:
parent
d41d6fec10
commit
9225bbfc0c
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user