From de4e1db20cec32153c71b1491e62778f51b7c32b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Thu, 25 Jan 2024 21:10:01 +0100
Subject: [PATCH] Update powerpc64 aes decrypt.

---
 powerpc64/p8/aes-decrypt-internal.asm | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/powerpc64/p8/aes-decrypt-internal.asm b/powerpc64/p8/aes-decrypt-internal.asm
index 1c33f279..1dc66628 100644
--- a/powerpc64/p8/aes-decrypt-internal.asm
+++ b/powerpc64/p8/aes-decrypt-internal.asm
@@ -115,14 +115,14 @@ IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
  OPN_XXY(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
 
  mtctr ROUNDS
- li r10,0x10
+ li r10,-0x10
 .align 5
 L8x_round_loop:
  lxvd2x VSR(K),r10,KEYS
  vperm   K,K,K,SWAP_MASK
  OPN_XXY(vncipher, ZERO, S0, S1, S2, S3, S4, S5, S6, S7)
  OPN_XXY(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
- addi r10,r10,0x10
+ subi r10,r10,0x10
  bdnz L8x_round_loop
 
  lxvd2x VSR(K),r10,KEYS
@@ -176,14 +176,14 @@ IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3)')
  OPN_XXY(vxor, K, S0, S1, S2, S3)
 
  mtctr ROUNDS
- li r10,0x10
+ li r10,-0x10
 .align 5
 L4x_round_loop:
  lxvd2x VSR(K),r10,KEYS
  vperm  K,K,K,SWAP_MASK
  OPN_XXY(vncipher, ZERO, S0, S1, S2, S3)
  OPN_XXY(vxor, K, S0, S1, S2, S3)
- addi   r10,r10,0x10
+ subi   r10,r10,0x10
  bdnz  L4x_round_loop
 
  lxvd2x VSR(K),r10,KEYS
@@ -224,7 +224,7 @@ IF_LE(`vperm S0,S0,S0,SWAP_MASK
  vxor   S1,S1,K
 
  mtctr   ROUNDS
- li  r10,0x10
+ li  r10,-0x10
 .align 5
 L2x_round_loop:
  lxvd2x VSR(K),r10,KEYS
@@ -233,7 +233,7 @@ L2x_round_loop:
  vncipher S1,S1,ZERO
  vxor  S0,S0,K
  vxor  S1,S1,K
- addi   r10,r10,0x10
+ subi   r10,r10,0x10
  bdnz   L2x_round_loop
 
  lxvd2x VSR(K),r10,KEYS
@@ -267,14 +267,14 @@ IF_LE(`vperm S0,S0,S0,SWAP_MASK')
  vxor   S0,S0,K
 
  mtctr   ROUNDS
- li   r10,0x10
+ li   r10,-0x10
 .align 5
 L1x_round_loop:
  lxvd2x VSR(K),r10,KEYS
  vperm  K,K,K,SWAP_MASK
  vncipher S0,S0,ZERO
  vxor   S0,S0,K
- addi   r10,r10,0x10
+ subi   r10,r10,0x10
  bdnz   L1x_round_loop
 
  lxvd2x VSR(K),r10,KEYS
-- 
GitLab