1
2
3
4
5
6
7 package aes
8
9
10
11
12 func cryptBlocksChain(src, dst *byte, length int, key *uint32, iv *byte, enc int, nr int)
13
14 const cbcEncrypt = 1
15 const cbcDecrypt = 0
16
17 func cryptBlocksEnc(b *Block, civ *[BlockSize]byte, dst, src []byte) {
18 if !supportsAES {
19 cryptBlocksEncGeneric(b, civ, dst, src)
20 } else {
21 cryptBlocksChain(&src[0], &dst[0], len(src), &b.enc[0], &civ[0], cbcEncrypt, b.rounds)
22 }
23 }
24
25 func cryptBlocksDec(b *Block, civ *[BlockSize]byte, dst, src []byte) {
26 if !supportsAES {
27 cryptBlocksDecGeneric(b, civ, dst, src)
28 } else {
29 cryptBlocksChain(&src[0], &dst[0], len(src), &b.dec[0], &civ[0], cbcDecrypt, b.rounds)
30 }
31 }
32
View as plain text