package aes
import (
)
const BlockSize = 16
type aesCipher struct {
enc []uint32
dec []uint32
}
type KeySizeError int
func ( KeySizeError) () string {
return "crypto/aes: invalid key size " + strconv.Itoa(int())
}
func ( []byte) (cipher.Block, error) {
:= len()
switch {
default:
return nil, KeySizeError()
case 16, 24, 32:
break
}
return newCipher()
}
func ( []byte) (cipher.Block, error) {
:= len() + 28
:= aesCipher{make([]uint32, ), make([]uint32, )}
expandKeyGo(, .enc, .dec)
return &, nil
}
func ( *aesCipher) () int { return BlockSize }
func ( *aesCipher) (, []byte) {
if len() < BlockSize {
panic("crypto/aes: input not full block")
}
if len() < BlockSize {
panic("crypto/aes: output not full block")
}
if subtle.InexactOverlap([:BlockSize], [:BlockSize]) {
panic("crypto/aes: invalid buffer overlap")
}
encryptBlockGo(.enc, , )
}
func ( *aesCipher) (, []byte) {
if len() < BlockSize {
panic("crypto/aes: input not full block")
}
if len() < BlockSize {
panic("crypto/aes: output not full block")
}
if subtle.InexactOverlap([:BlockSize], [:BlockSize]) {
panic("crypto/aes: invalid buffer overlap")
}
decryptBlockGo(.dec, , )
}