mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
Add ROTATE inline RISC-V zbb/zbkb asm for chacha
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18289)
This commit is contained in:
parent
cdf0a5c460
commit
ca6286c382
@ -24,6 +24,28 @@ typedef union {
|
||||
|
||||
# define ROTATE(v, n) (((v) << (n)) | ((v) >> (32 - (n))))
|
||||
|
||||
# ifndef PEDANTIC
|
||||
# if defined(__GNUC__) && __GNUC__>=2 && \
|
||||
!defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
|
||||
# if defined(__riscv_zbb) || defined(__riscv_zbkb)
|
||||
# if __riscv_xlen == 64
|
||||
# undef ROTATE
|
||||
# define ROTATE(x, n) ({ u32 ret; \
|
||||
asm ("roriw %0, %1, %2" \
|
||||
: "=r"(ret) \
|
||||
: "r"(x), "i"(32 - (n))); ret;})
|
||||
# endif
|
||||
# if __riscv_xlen == 32
|
||||
# undef ROTATE
|
||||
# define ROTATE(x, n) ({ u32 ret; \
|
||||
asm ("rori %0, %1, %2" \
|
||||
: "=r"(ret) \
|
||||
: "r"(x), "i"(32 - (n))); ret;})
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define U32TO8_LITTLE(p, v) do { \
|
||||
(p)[0] = (u8)(v >> 0); \
|
||||
(p)[1] = (u8)(v >> 8); \
|
||||
|
Loading…
Reference in New Issue
Block a user