diff options
Diffstat (limited to 'src/crypto/aes')
-rw-r--r-- | src/crypto/aes/cipher.go | 5 | ||||
-rw-r--r-- | src/crypto/aes/cipher_asm.go | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/crypto/aes/cipher.go b/src/crypto/aes/cipher.go index bb93fbb36e..29d01796eb 100644 --- a/src/crypto/aes/cipher.go +++ b/src/crypto/aes/cipher.go @@ -10,6 +10,8 @@ import ( "strconv" ) +import "crypto/internal/boring" + // The AES block size in bytes. const BlockSize = 16 @@ -37,6 +39,9 @@ func NewCipher(key []byte) (cipher.Block, error) { case 16, 24, 32: break } + if boring.Enabled { + return boring.NewAESCipher(key) + } return newCipher(key) } diff --git a/src/crypto/aes/cipher_asm.go b/src/crypto/aes/cipher_asm.go index 646bdfa5c0..4936699481 100644 --- a/src/crypto/aes/cipher_asm.go +++ b/src/crypto/aes/cipher_asm.go @@ -12,6 +12,8 @@ import ( "internal/cpu" ) +import "crypto/internal/boring" + // defined in asm_*.s //go:noescape @@ -56,6 +58,7 @@ func newCipher(key []byte) (cipher.Block, error) { func (c *aesCipherAsm) BlockSize() int { return BlockSize } func (c *aesCipherAsm) Encrypt(dst, src []byte) { + boring.Unreachable() if len(src) < BlockSize { panic("crypto/aes: input not full block") } @@ -69,6 +72,7 @@ func (c *aesCipherAsm) Encrypt(dst, src []byte) { } func (c *aesCipherAsm) Decrypt(dst, src []byte) { + boring.Unreachable() if len(src) < BlockSize { panic("crypto/aes: input not full block") } |