[PATCH 06/11] gcm-aarch64-ce: clear volatile vector registers at setup function

Jussi Kivilinna jussi.kivilinna at iki.fi
Sun Nov 3 20:56:50 CET 2024


* cipher/cipher-gcm-armv8-aarch64-ce.S
(_gcry_ghash_setup_armv8_ce_pmull): Clear used vectors registers
before function exit.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/cipher-gcm-armv8-aarch64-ce.S | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/cipher/cipher-gcm-armv8-aarch64-ce.S b/cipher/cipher-gcm-armv8-aarch64-ce.S
index 0c31a563..4cb63212 100644
--- a/cipher/cipher-gcm-armv8-aarch64-ce.S
+++ b/cipher/cipher-gcm-armv8-aarch64-ce.S
@@ -610,6 +610,7 @@ _gcry_ghash_setup_armv8_ce_pmull:
   /* H³ */
   PMUL_128x128(rr0, rr1, rh2, rh1, t0, t1, __)
   REDUCTION(rh3, rr0, rr1, rrconst, t0, t1, __, __, __)
+  CLEAR_REG(rh1)
 
   /* H⁴ */
   PMUL_128x128(rr0, rr1, rh2, rh2, t0, t1, __)
@@ -622,9 +623,18 @@ _gcry_ghash_setup_armv8_ce_pmull:
   /* H⁶ */
   PMUL_128x128(rr0, rr1, rh3, rh3, t0, t1, __)
   REDUCTION(rh6, rr0, rr1, rrconst, t0, t1, __, __, __)
+  CLEAR_REG(rr0)
+  CLEAR_REG(rr1)
+  CLEAR_REG(t0)
+  CLEAR_REG(t1)
 
   st1 {rh2.16b-rh4.16b}, [x1], #(3*16)
+  CLEAR_REG(rh2)
+  CLEAR_REG(rh3)
+  CLEAR_REG(rh4)
   st1 {rh5.16b-rh6.16b}, [x1]
+  CLEAR_REG(rh5)
+  CLEAR_REG(rh6)
 
   ret_spec_stop
   CFI_ENDPROC()
-- 
2.45.2




More information about the Gcrypt-devel mailing list