[PATCH 4/5] aarch64: camellia: Only use the lower 32 bit of an int parameter

Martin Storsjö martin at martin.st
Thu Mar 22 09:56:14 CET 2018

The keybits parameter is declared as int, and in those cases, the
upper half of a register is undefined, not guaranteed to be zero.

Signed-off-by: Martin Storsjö <martin at martin.st>
I didn't check other files and functions for the same issue, I
just happened to notice this one while looking closer at the
camellia source file.

>From previous experience, clang can be pretty aggressive with
passing in undefined data in the upper half of registers, where
it isn't supposed to make any difference.
 cipher/camellia-aarch64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cipher/camellia-aarch64.S b/cipher/camellia-aarch64.S
index 440f69f..68d2a7d 100644
--- a/cipher/camellia-aarch64.S
+++ b/cipher/camellia-aarch64.S
@@ -33,7 +33,7 @@
 #define CTX x0
 #define RDST x1
 #define RSRC x2
-#define RKEYBITS x3
+#define RKEYBITS w3
 #define RTAB1 x4
 #define RTAB2 x5

More information about the Gcrypt-devel mailing list