summaryrefslogtreecommitdiffstats
path: root/crypto/des
diff options
context:
space:
mode:
authorHongren (Zenithal) Zheng <i@zenithal.me>2022-05-11 18:32:13 +0800
committerTomas Mraz <tomas@openssl.org>2022-11-23 18:21:42 +0100
commit411a3d81874b95d5188d6c15a40ca85d58c292c7 (patch)
tree65a68103ceac88ac62a0d6e0c1a2f31bf267e00a /crypto/des
parent41ac1b428f87b6ab84eac8c5eeff1fd16db98f41 (diff)
Add ROTATE inline RISC-V zbb/zbkb asm for DES
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18290) (cherry picked from commit 6136408e6abf10672e399bf95be064868f2f7ca6)
Diffstat (limited to 'crypto/des')
-rw-r--r--crypto/des/des_local.h13
1 files changed, 13 insertions, 0 deletions
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