cbc_ppc64x.mx raw
1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build (ppc64 || ppc64le) && !purego
6
7 package aes
8
9 // cryptBlocksChain invokes the cipher message identifying encrypt or decrypt.
10 //
11 //go:noescape
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