- Add upstream changes: * 0001-Add-support-for-powerpc64.-1160.patch * 0002-Mark-stack-non-executable-when-compiling-with-clang-.patch - Spec cleanup OBS-URL: https://build.opensuse.org/request/show/986335 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/liboqs?expand=0&rev=5
153 lines
6.7 KiB
Diff
153 lines
6.7 KiB
Diff
From eb2f38c44ed15e058bc7ab217ba614b32f012090 Mon Sep 17 00:00:00 2001
|
|
From: pkubaj <pkubaj@FreeBSD.org>
|
|
Date: Fri, 24 Dec 2021 00:03:25 +0100
|
|
Subject: [PATCH 1/2] Add support for powerpc64. (#1160)
|
|
|
|
This is 64-bit POWER big-endian. Since s390x (64-bit big-endian) and ppc64le
|
|
(64-bit POWER) are already supported, this shouldn't be an issue.
|
|
---
|
|
.CMake/alg_support.cmake | 4 ++--
|
|
CMakeLists.txt | 7 +++++++
|
|
src/kem/sike/CMakeLists.txt | 3 +++
|
|
src/kem/sike/external/P434/P434_internal.h | 2 +-
|
|
src/kem/sike/external/P503/P503_internal.h | 2 +-
|
|
src/kem/sike/external/P610/P610_internal.h | 2 +-
|
|
src/kem/sike/external/P751/P751_internal.h | 2 +-
|
|
src/kem/sike/external/config.h | 7 +++++++
|
|
8 files changed, 23 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/.CMake/alg_support.cmake b/.CMake/alg_support.cmake
|
|
index 0de57e8..bb9ebea 100644
|
|
--- a/.CMake/alg_support.cmake
|
|
+++ b/.CMake/alg_support.cmake
|
|
@@ -27,8 +27,8 @@ if(OQS_DIST_X86_64_BUILD OR OQS_USE_AVX2_INSTRUCTIONS)
|
|
endif()
|
|
endif()
|
|
|
|
-# BIKE is not supported on Windows, 32-bit ARM and S390X (big endian)
|
|
-cmake_dependent_option(OQS_ENABLE_KEM_BIKE "Enable BIKE algorithm family" ON "NOT WIN32; NOT ARCH_ARM32v7; NOT ARCH_X86; NOT ARCH_S390X" OFF)
|
|
+# BIKE is not supported on Windows, 32-bit ARM, S390X (big endian) and PPC64 (big endian)
|
|
+cmake_dependent_option(OQS_ENABLE_KEM_BIKE "Enable BIKE algorithm family" ON "NOT WIN32; NOT ARCH_ARM32v7; NOT ARCH_X86; NOT ARCH_S390X; NOT ARCH_PPC64" OFF)
|
|
cmake_dependent_option(OQS_ENABLE_KEM_bike_l1 "" ON "OQS_ENABLE_KEM_BIKE" OFF)
|
|
cmake_dependent_option(OQS_ENABLE_KEM_bike_l3 "" ON "OQS_ENABLE_KEM_BIKE" OFF)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 140cfb8..416da83 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -59,6 +59,13 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le|powerpc64le")
|
|
if(${OQS_DIST_BUILD})
|
|
set(OQS_DIST_PPC64LE_BUILD ON)
|
|
endif()
|
|
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(ppc64|powerpc64)")
|
|
+ message(WARNING "There is currently no CI for: " ${CMAKE_SYSTEM_PROCESSOR})
|
|
+ set(ARCH "ppc64")
|
|
+ set(ARCH_PPC64 ON)
|
|
+ if(${OQS_DIST_BUILD})
|
|
+ set(OQS_DIST_PPC64_BUILD ON)
|
|
+ endif()
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
|
|
set(ARCH "s390x")
|
|
set(ARCH_S390X ON)
|
|
diff --git a/src/kem/sike/CMakeLists.txt b/src/kem/sike/CMakeLists.txt
|
|
index c260ce1..0f4714b 100644
|
|
--- a/src/kem/sike/CMakeLists.txt
|
|
+++ b/src/kem/sike/CMakeLists.txt
|
|
@@ -8,6 +8,7 @@ if(
|
|
ARCH_ARM32v7 OR
|
|
ARCH_ARM64v8 OR
|
|
ARCH_PPC64LE OR
|
|
+ ARCH_PPC64 OR
|
|
ARCH_S390X)
|
|
AND
|
|
# check that one SIDH/SIKE alg is enabled
|
|
@@ -137,6 +138,8 @@ if(
|
|
target_compile_definitions(sike PRIVATE USE_SIKEP751_ASM)
|
|
endif()
|
|
endif()
|
|
+ elseif(ARCH_PPC64)
|
|
+ target_compile_definitions(sike PRIVATE _GENERIC_ _PPC64_)
|
|
elseif(ARCH_PPC64LE)
|
|
target_compile_definitions(sike PRIVATE _GENERIC_ _PPC64LE_)
|
|
elseif(ARCH_S390X)
|
|
diff --git a/src/kem/sike/external/P434/P434_internal.h b/src/kem/sike/external/P434/P434_internal.h
|
|
index 6c7f66c..168ac9f 100644
|
|
--- a/src/kem/sike/external/P434/P434_internal.h
|
|
+++ b/src/kem/sike/external/P434/P434_internal.h
|
|
@@ -9,7 +9,7 @@
|
|
|
|
#include "../config.h"
|
|
|
|
-#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64LE)
|
|
+#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64) || (TARGET == TARGET_PPC64LE)
|
|
#define NWORDS_FIELD 7 // Number of words of a 434-bit field element
|
|
#define p434_ZERO_WORDS 3 // Number of "0" digits in the least significant part of p434 + 1
|
|
#elif (TARGET == TARGET_x86) || (TARGET == TARGET_ARM)
|
|
diff --git a/src/kem/sike/external/P503/P503_internal.h b/src/kem/sike/external/P503/P503_internal.h
|
|
index 3a9bb32..3c72a4b 100644
|
|
--- a/src/kem/sike/external/P503/P503_internal.h
|
|
+++ b/src/kem/sike/external/P503/P503_internal.h
|
|
@@ -9,7 +9,7 @@
|
|
|
|
#include "../config.h"
|
|
|
|
-#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64LE)
|
|
+#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64) || (TARGET == TARGET_PPC64LE)
|
|
#define NWORDS_FIELD 8 // Number of words of a 503-bit field element
|
|
#define p503_ZERO_WORDS 3 // Number of "0" digits in the least significant part of p503 + 1
|
|
#elif (TARGET == TARGET_x86) || (TARGET == TARGET_ARM)
|
|
diff --git a/src/kem/sike/external/P610/P610_internal.h b/src/kem/sike/external/P610/P610_internal.h
|
|
index 8a6a08f..7d6f60d 100644
|
|
--- a/src/kem/sike/external/P610/P610_internal.h
|
|
+++ b/src/kem/sike/external/P610/P610_internal.h
|
|
@@ -9,7 +9,7 @@
|
|
|
|
#include "../config.h"
|
|
|
|
-#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64LE)
|
|
+#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64) || (TARGET == TARGET_PPC64LE)
|
|
#define NWORDS_FIELD 10 // Number of words of a 610-bit field element
|
|
#define p610_ZERO_WORDS 4 // Number of "0" digits in the least significant part of p610 + 1
|
|
#elif (TARGET == TARGET_x86) || (TARGET == TARGET_ARM)
|
|
diff --git a/src/kem/sike/external/P751/P751_internal.h b/src/kem/sike/external/P751/P751_internal.h
|
|
index 1f9f231..0b17da1 100644
|
|
--- a/src/kem/sike/external/P751/P751_internal.h
|
|
+++ b/src/kem/sike/external/P751/P751_internal.h
|
|
@@ -9,7 +9,7 @@
|
|
|
|
#include "../config.h"
|
|
|
|
-#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64LE)
|
|
+#if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) || (TARGET == TARGET_PPC64) || (TARGET == TARGET_PPC64LE)
|
|
#define NWORDS_FIELD 12 // Number of words of a 751-bit field element
|
|
#define p751_ZERO_WORDS 5 // Number of "0" digits in the least significant part of p751 + 1
|
|
#elif (TARGET == TARGET_x86) || (TARGET == TARGET_ARM)
|
|
diff --git a/src/kem/sike/external/config.h b/src/kem/sike/external/config.h
|
|
index 1a915d3..46cd312 100644
|
|
--- a/src/kem/sike/external/config.h
|
|
+++ b/src/kem/sike/external/config.h
|
|
@@ -32,6 +32,7 @@
|
|
#define TARGET_ARM 4
|
|
#define TARGET_ARM64 5
|
|
#define TARGET_PPC64LE 6
|
|
+#define TARGET_PPC64 7
|
|
|
|
#if defined(_AMD64_)
|
|
#define TARGET TARGET_AMD64
|
|
@@ -63,6 +64,12 @@ typedef uint16_t hdigit_t; // Unsigned 16-bit digit
|
|
#define LOG2RADIX 6
|
|
typedef uint64_t digit_t; // Unsigned 64-bit digit
|
|
typedef uint32_t hdigit_t; // Unsigned 32-bit digit
|
|
+#elif defined(_PPC64_)
|
|
+#define TARGET TARGET_PPC64
|
|
+#define RADIX 64
|
|
+#define LOG2RADIX 6
|
|
+typedef uint64_t digit_t; // Unsigned 64-bit digit
|
|
+typedef uint32_t hdigit_t; // Unsigned 32-bit digit
|
|
#elif defined(_PPC64LE_)
|
|
#define TARGET TARGET_PPC64LE
|
|
#define RADIX 64
|
|
--
|
|
2.36.1
|
|
|