From 6136408e6abf10672e399bf95be064868f2f7ca6 Mon Sep 17 00:00:00 2001 From: "Hongren (Zenithal) Zheng" Date: Wed, 11 May 2022 18:32:13 +0800 Subject: Add ROTATE inline RISC-V zbb/zbkb asm for DES Reviewed-by: Hugo Landau Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/18290) --- crypto/des/des_local.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crypto/des') diff --git a/crypto/des/des_local.h b/crypto/des/des_local.h index f888cb8001..5b02822952 100644 --- a/crypto/des/des_local.h +++ b/crypto/des/des_local.h @@ -109,6 +109,19 @@ : "cc"); \ ret; \ }) +# elif defined(__riscv_zbb) || defined(__riscv_zbkb) +# if __riscv_xlen == 64 +# define ROTATE(x, n) ({ register unsigned int ret; \ + asm ("roriw %0, %1, %2" \ + : "=r"(ret) \ + : "r"(x), "i"(n)); ret; }) +# endif +# if __riscv_xlen == 32 +# define ROTATE(x, n) ({ register unsigned int ret; \ + asm ("rori %0, %1, %2" \ + : "=r"(ret) \ + : "r"(x), "i"(n)); ret; }) +# endif # endif # endif # ifndef ROTATE -- cgit v1.2.3