diff options
author | Henry Brausen <henry.brausen@vrull.eu> | 2022-01-28 01:12:38 -0700 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-05-11 18:02:03 +1000 |
commit | cb2764f2a8165421dc5ab52159af99cbf766fa2c (patch) | |
tree | 0dad38b98830a896049fd3998202aac5239c8333 /crypto/sha | |
parent | 8712db5e4e0c508de10e887aebf639384dc20710 (diff) |
Add riscv64 asm_arch to linux64-riscv64 target
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18275)
Diffstat (limited to 'crypto/sha')
-rw-r--r-- | crypto/sha/sha256.c | 4 | ||||
-rw-r--r-- | crypto/sha/sha512.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/crypto/sha/sha256.c b/crypto/sha/sha256.c index 89beaf1479..649d25d6c6 100644 --- a/crypto/sha/sha256.c +++ b/crypto/sha/sha256.c @@ -132,7 +132,7 @@ static const SHA_LONG K256[64] = { # ifndef PEDANTIC # if defined(__GNUC__) && __GNUC__>=2 && \ !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) -# if __riscv_zknh +# if defined(__riscv_zknh) # define Sigma0(x) ({ MD32_REG_T ret; \ asm ("sha256sum0 %0, %1" \ : "=r"(ret) \ @@ -150,7 +150,7 @@ static const SHA_LONG K256[64] = { : "=r"(ret) \ : "r"(x)); ret; }) # endif -# if __riscv_zbt || __riscv_zpn +# if defined(__riscv_zbt) || defined(__riscv_zpn) # define Ch(x,y,z) ({ MD32_REG_T ret; \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3"\ : "=r"(ret) \ diff --git a/crypto/sha/sha512.c b/crypto/sha/sha512.c index db13565332..ee00b55de8 100644 --- a/crypto/sha/sha512.c +++ b/crypto/sha/sha512.c @@ -432,7 +432,7 @@ static const SHA_LONG64 K512[80] = { : "=r"(ret) \ : "r"(*((const SHA_LONG64 *)(&(x))))); ret; }) # endif -# elif (__riscv_zbkb || __riscv_zbb) && __riscv_xlen == 32 +# elif (defined(__riscv_zbkb) || defined(__riscv_zbb)) && __riscv_xlen == 32 # define PULL64(x) ({ SHA_LONG64 ret; \ unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ @@ -442,13 +442,13 @@ static const SHA_LONG64 K512[80] = { asm ("rev8 %0, %1" \ : "=r"(r[1]) \ : "r" (p[0])); ret; }) -# elif (__riscv_zbkb || __riscv_zbb) && __riscv_xlen == 64 +# elif (defined(__riscv_zbkb) || defined(__riscv_zbb)) && __riscv_xlen == 64 # define PULL64(x) ({ SHA_LONG64 ret; \ asm ("rev8 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # endif -# if __riscv_zknh && __riscv_xlen == 32 +# if defined(__riscv_zknh) && __riscv_xlen == 32 # define Sigma0(x) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ asm ("sha512sum0r %0, %1, %2" \ @@ -481,7 +481,7 @@ static const SHA_LONG64 K512[80] = { asm ("sha512sig1h %0, %2, %1" \ : "=r"(r[1]) \ : "r" (p[0]), "r" (p[1])); ret; }) -# elif __riscv_zknh && __riscv_xlen == 64 +# elif defined(__riscv_zknh) && __riscv_xlen == 64 # define Sigma0(x) ({ SHA_LONG64 ret; \ asm ("sha512sum0 %0, %1" \ : "=r"(ret) \ @@ -499,7 +499,7 @@ static const SHA_LONG64 K512[80] = { : "=r"(ret) \ : "r"(x)); ret; }) # endif -# if (__riscv_zbt || __riscv_zpn) && __riscv_xlen == 32 +# if (defined(__riscv_zbt) || defined(__riscv_zpn)) && __riscv_xlen == 32 # define Ch(x,y,z) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *xp = (const unsigned int *)(&(x)); \ const unsigned int *yp = (const unsigned int *)(&(y)); \ @@ -520,7 +520,7 @@ static const SHA_LONG64 K512[80] = { asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3\n\t" \ : "=r"(r[1]) \ : "r"(xp[1]^zp[1]), "r"(yp[1]), "r"(zp[1])); ret; }) -# elif (__riscv_zbt || __riscv_zpn) && __riscv_xlen == 64 +# elif (defined(__riscv_zbt) || defined(__riscv_zpn)) && __riscv_xlen == 64 # define Ch(x,y,z) ({ SHA_LONG64 ret; \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3"\ : "=r"(ret) \ |