]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add ROTATE inline RISC-V zbb/zbkb asm for DES
authorHongren (Zenithal) Zheng <i@zenithal.me>
Wed, 11 May 2022 10:32:13 +0000 (18:32 +0800)
committerPauli <pauli@openssl.org>
Mon, 15 Aug 2022 02:04:19 +0000 (12:04 +1000)
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18290)

crypto/des/des_local.h

index f888cb800169347094ddc9b413f78e58385cdfd4..5b02822952748c60ae7993f671c03b8f5e227eb1 100644 (file)
                                         : "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