[PATCH 2/2] rijndael-ppc: fix bad register used for vector load/store assembly

Jussi Kivilinna jussi.kivilinna at iki.fi
Mon Dec 23 02:43:55 CET 2019


* cipher/rijndael-ppc.c (vec_aligned_ld, vec_load_be, vec_aligned_st)
(vec_store_be): Add "r0" to clobber list for load/store instructions.
--

Register r0 must not be used for RA input for vector load/store
instructions as r0 is not read as register but as value '0'.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 0 files changed

diff --git a/cipher/rijndael-ppc.c b/cipher/rijndael-ppc.c
index 7c349f8b0..48a47eddb 100644
--- a/cipher/rijndael-ppc.c
+++ b/cipher/rijndael-ppc.c
@@ -138,7 +138,7 @@ vec_aligned_ld(unsigned long offset, const unsigned char *ptr)
   __asm__ ("lvx %0,%1,%2\n\t"
 	   : "=v" (vec)
 	   : "r" (offset), "r" ((uintptr_t)ptr)
-	   : "memory");
+	   : "memory", "r0");
   return vec;
 #else
   return vec_vsx_ld (offset, ptr);
@@ -169,7 +169,7 @@ vec_load_be(unsigned long offset, const unsigned char *ptr,
   __asm__ ("lxvw4x %x0,%1,%2\n\t"
 	   : "=wa" (vec)
 	   : "r" (offset), "r" ((uintptr_t)ptr)
-	   : "memory");
+	   : "memory", "r0");
   __asm__ ("vperm %0,%1,%1,%2\n\t"
 	   : "=v" (vec)
 	   : "v" (vec), "v" (be_bswap_const));
@@ -188,7 +188,7 @@ vec_aligned_st(block vec, unsigned long offset, unsigned char *ptr)
   __asm__ ("stvx %0,%1,%2\n\t"
 	   :
 	   : "v" (vec), "r" (offset), "r" ((uintptr_t)ptr)
-	   : "memory");
+	   : "memory", "r0");
 #else
   vec_vsx_st (vec, offset, ptr);
 #endif
@@ -208,7 +208,7 @@ vec_store_be(block vec, unsigned long offset, unsigned char *ptr,
   __asm__ ("stxvw4x %x0,%1,%2\n\t"
 	   :
 	   : "wa" (vec), "r" (offset), "r" ((uintptr_t)ptr)
-	   : "memory");
+	   : "memory", "r0");
 #else
   (void)be_bswap_const;
   vec_vsx_st (vec, offset, ptr);




More information about the Gcrypt-devel mailing list