Skip to content

Commit

Permalink
Add support for LoongArch. (#1137)
Browse files Browse the repository at this point in the history
Signed-off-by: liuxiang88 <[email protected]>
  • Loading branch information
liuxiang88 authored Sep 5, 2023
1 parent fe308e3 commit 3385b60
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc64le|ppc64le")
set(ARCH "ppc64le")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "riscv64")
set(ARCH "riscv64")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "loongarch64")
set(ARCH "loongarch64")
else()
message(STATUS "Unknown processor found. Using generic implementations. Processor:" ${CMAKE_SYSTEM_PROCESSOR})
set(ARCH "generic")
Expand Down
2 changes: 2 additions & 0 deletions crypto/fipsmodule/rand/getrandom_fillin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#define EXPECTED_NR_getrandom 359
#elif defined(OPENSSL_RISCV64)
#define EXPECTED_NR_getrandom 278
#elif defined(OPENSSL_LOONGARCH64)
#define EXPECTED_NR_getrandom 278
#endif

#if defined(EXPECTED_NR_getrandom)
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/sha/keccak1600.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <assert.h>

#if defined(__x86_64__) || defined(__aarch64__) || \
defined(__mips64) || defined(__ia64) || \
defined(__mips64) || defined(__ia64) || defined(__loongarch_lp64) || \
(defined(__VMS) && !defined(__vax))

// These are available even in ILP32 flavours, but even then they are
Expand Down Expand Up @@ -60,7 +60,7 @@ static const uint64_t iotas[] = {

#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
(defined(__x86_64) && !defined(__BMI__)) || defined(_M_X64) || \
defined(__mips) || defined(__riscv) || defined(__s390__) || \
defined(__mips) || defined(__riscv) || defined(__s390__) || defined(__loongarch__) || \
defined(__EMSCRIPTEN__)

// These platforms don't support "logical and with complement" instruction.
Expand Down
3 changes: 3 additions & 0 deletions include/openssl/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ extern "C" {
#define OPENSSL_RISCV64
#elif defined(__riscv) && __SIZEOF_POINTER__ == 4
#define OPENSSL_32_BIT
#elif defined(__loongarch_lp64)
#define OPENSSL_64_BIT
#define OPENSSL_LOONGARCH64
#elif defined(__pnacl__)
#define OPENSSL_32_BIT
#define OPENSSL_PNACL
Expand Down

0 comments on commit 3385b60

Please sign in to comment.