diff options
Diffstat (limited to 'libgo/go/crypto/aes/cipher.go')
-rw-r--r-- | libgo/go/crypto/aes/cipher.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libgo/go/crypto/aes/cipher.go b/libgo/go/crypto/aes/cipher.go index 04d2be1..c5a8e91 100644 --- a/libgo/go/crypto/aes/cipher.go +++ b/libgo/go/crypto/aes/cipher.go @@ -36,15 +36,15 @@ func NewCipher(key []byte) (cipher.Block, error) { case 16, 24, 32: break } + return newCipher(key) +} - n := k + 28 +// newCipherGeneric creates and returns a new cipher.Block +// implemented in pure Go. +func newCipherGeneric(key []byte) (cipher.Block, error) { + n := len(key) + 28 c := aesCipher{make([]uint32, n), make([]uint32, n)} - expandKey(key, c.enc, c.dec) - - if hasGCMAsm() { - return &aesCipherGCM{c}, nil - } - + expandKeyGo(key, c.enc, c.dec) return &c, nil } @@ -57,7 +57,7 @@ func (c *aesCipher) Encrypt(dst, src []byte) { if len(dst) < BlockSize { panic("crypto/aes: output not full block") } - encryptBlock(c.enc, dst, src) + encryptBlockGo(c.enc, dst, src) } func (c *aesCipher) Decrypt(dst, src []byte) { @@ -67,5 +67,5 @@ func (c *aesCipher) Decrypt(dst, src []byte) { if len(dst) < BlockSize { panic("crypto/aes: output not full block") } - decryptBlock(c.dec, dst, src) + decryptBlockGo(c.dec, dst, src) } |