summaryrefslogtreecommitdiffstats
path: root/crypto/des
diff options
context:
space:
mode:
authorHongren (Zenithal) Zheng <i@zenithal.me>2022-05-11 18:32:13 +0800
committerPauli <pauli@openssl.org>2022-08-15 12:04:19 +1000
commit6136408e6abf10672e399bf95be064868f2f7ca6 (patch)
tree18bb6c17b7cb5ee2532e7f6e7ec976b5951ab621 /crypto/des
parentd272ef5372a16924a5804b74a76491b1bc8529b5 (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)
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