summaryrefslogtreecommitdiff
path: root/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4')
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-SnP.h82
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-on1.c56
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/Makefile49
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/PlSnP-Fallback.inc295
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/config.mk12
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/manifest.mn23
-rw-r--r--lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/serial.gyp32
7 files changed, 549 insertions, 0 deletions
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-SnP.h b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-SnP.h
new file mode 100644
index 000000000..9698a922f
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-SnP.h
@@ -0,0 +1,82 @@
+/*
+The Keccak-p permutations, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
+
+Implementation by Gilles Van Assche, hereby denoted as "the implementer".
+
+For more information, feedback or questions, please refer to the Keccak Team website:
+https://keccak.team/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+
+---
+
+Please refer to PlSnP-documentation.h for more details.
+*/
+
+#ifndef _KeccakP_1600_times4_SnP_h_
+#define _KeccakP_1600_times4_SnP_h_
+
+#include "KeccakP-1600-SnP.h"
+
+#if defined(ADD_SYMBOL_SUFFIX)
+#define KECCAKTIMES4_NAMESPACE(x) KeccakP1600times4_##x##_serial
+#else
+#define KECCAKTIMES4_NAMESPACE(x) KeccakP1600times4_##x
+#endif
+
+#define KeccakP1600times4_implementation "fallback on serial implementation (" KeccakP1600_implementation ")"
+#define KeccakP1600times4_isFallback
+#define KeccakP1600times4_statesAlignment KeccakP1600_stateAlignment
+#define KeccakP1600times4_statesSizeInBytes (((KeccakP1600_stateSizeInBytes+(KeccakP1600_stateAlignment-1))/KeccakP1600_stateAlignment)*KeccakP1600_stateAlignment*4)
+
+#define KeccakP1600times4_StaticInitialize KECCAKTIMES4_NAMESPACE(KeccakP1600times4_StaticInitialize)
+void KeccakP1600times4_StaticInitialize( void );
+
+#define KeccakP1600times4_InitializeAll KECCAKTIMES4_NAMESPACE(KeccakP1600times4_InitializeAll)
+void KeccakP1600times4_InitializeAll(void *states);
+
+#define KeccakP1600times4_AddByte KECCAKTIMES4_NAMESPACE(KeccakP1600times4_AddByte)
+void KeccakP1600times4_AddByte(void *states, unsigned int instanceIndex, unsigned char data, unsigned int offset);
+
+#define KeccakP1600times4_AddBytes KECCAKTIMES4_NAMESPACE(KeccakP1600times4_AddBytes)
+void KeccakP1600times4_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
+
+#define KeccakP1600times4_AddLanesAll KECCAKTIMES4_NAMESPACE(KeccakP1600times4_AddLanesAll)
+void KeccakP1600times4_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
+
+#define KeccakP1600times4_OverwriteBytes KECCAKTIMES4_NAMESPACE(KeccakP1600times4_OverwriteBytes)
+void KeccakP1600times4_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
+
+#define KeccakP1600times4_OverwriteLanesAll KECCAKTIMES4_NAMESPACE(KeccakP1600times4_OverwriteLanesAll)
+void KeccakP1600times4_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
+
+#define KeccakP1600times4_OverwriteWithZeroes KECCAKTIMES4_NAMESPACE(KeccakP1600times4_OverwriteWithZeroes)
+void KeccakP1600times4_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount);
+
+#define KeccakP1600times4_PermuteAll_4rounds KECCAKTIMES4_NAMESPACE(KeccakP1600times4_PermuteAll_4rounds)
+void KeccakP1600times4_PermuteAll_4rounds(void *states);
+
+#define KeccakP1600times4_PermuteAll_6rounds KECCAKTIMES4_NAMESPACE(KeccakP1600times4_PermuteAll_6rounds)
+void KeccakP1600times4_PermuteAll_6rounds(void *states);
+
+#define KeccakP1600times4_PermuteAll_12rounds KECCAKTIMES4_NAMESPACE(KeccakP1600times4_PermuteAll_12rounds)
+void KeccakP1600times4_PermuteAll_12rounds(void *states);
+
+#define KeccakP1600times4_PermuteAll_24rounds KECCAKTIMES4_NAMESPACE(KeccakP1600times4_PermuteAll_24rounds)
+void KeccakP1600times4_PermuteAll_24rounds(void *states);
+
+#define KeccakP1600times4_ExtractBytes KECCAKTIMES4_NAMESPACE(KeccakP1600times4_ExtractBytes)
+void KeccakP1600times4_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length);
+
+#define KeccakP1600times4_ExtractLanesAll KECCAKTIMES4_NAMESPACE(KeccakP1600times4_ExtractLanesAll)
+void KeccakP1600times4_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
+
+#define KeccakP1600times4_ExtractAndAddBytes KECCAKTIMES4_NAMESPACE(KeccakP1600times4_ExtractAndAddBytes)
+void KeccakP1600times4_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
+
+#define KeccakP1600times4_ExtractAndAddLanesAll KECCAKTIMES4_NAMESPACE(KeccakP1600times4_ExtractAndAddLanesAll)
+void KeccakP1600times4_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset);
+
+#endif
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-on1.c b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-on1.c
new file mode 100644
index 000000000..629757054
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/KeccakP-1600-times4-on1.c
@@ -0,0 +1,56 @@
+/*
+The Keccak-p permutations, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
+
+Implementation by Gilles Van Assche, hereby denoted as "the implementer".
+
+For more information, feedback or questions, please refer to the Keccak Team website:
+https://keccak.team/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+
+---
+
+This file implements Keccak-p[1600]×4 in a PlSnP-compatible way.
+Please refer to PlSnP-documentation.h for more details.
+
+This implementation comes with KeccakP-1600-times4-SnP.h in the same folder.
+Please refer to LowLevel.build for the exact list of other files it must be combined with.
+*/
+
+#include "KeccakP-1600-SnP.h"
+
+#define prefix KeccakP1600times4
+#define suffix serial
+#define PlSnP_baseParallelism 1
+#define PlSnP_targetParallelism 4
+#define SnP_laneLengthInBytes 8
+#define SnP_prefix KeccakP1600
+#define SnP_suffix KECCAK_SYMBOL_SUFFIX
+
+#if defined(ADD_SYMBOL_SUFFIX)
+#define JOIN0(a,b,c) a##_##b##_##c
+#define JOIN(a,b) JOIN0(a,b,c)
+
+#define SnP_Permute JOIN(SnP_prefix, Permute_24rounds, SnP_suffix)
+#define SnP_Permute_12rounds JOIN(SnP_prefix, Permute_12rounds, SnP_suffix)
+#define SnP_Permute_Nrounds JOIN(SnP_prefix, Permute_Nrounds, SnP_suffix)
+#define PlSnP_PermuteAll JOIN(prefix, PermuteAll_24rounds, suffix)
+#define PlSnP_PermuteAll_12rounds JOIN(prefix, PermuteAll_12rounds, suffix)
+#define PlSnP_PermuteAll_6rounds JOIN(prefix, PermuteAll_6rounds, suffix)
+#define PlSnP_PermuteAll_4rounds JOIN(prefix, PermuteAll_4rounds, suffix)
+
+#undef JOIN0
+#undef JOIN
+#else
+#define SnP_Permute KeccakP1600_Permute_24rounds
+#define SnP_Permute_12rounds KeccakP1600_Permute_12rounds
+#define SnP_Permute_Nrounds KeccakP1600_Permute_Nrounds
+#define PlSnP_PermuteAll KeccakP1600times4_PermuteAll_24rounds
+#define PlSnP_PermuteAll_12rounds KeccakP1600times4_PermuteAll_12rounds
+#define PlSnP_PermuteAll_6rounds KeccakP1600times4_PermuteAll_6rounds
+#define PlSnP_PermuteAll_4rounds KeccakP1600times4_PermuteAll_4rounds
+#endif
+
+#include "PlSnP-Fallback.inc"
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/Makefile b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/Makefile
new file mode 100644
index 000000000..fe090f3ff
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/Makefile
@@ -0,0 +1,49 @@
+#! gmake
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+USE_GCOV =
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+include config.mk
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+WARNING_CFLAGS = $(NULL)
+
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/PlSnP-Fallback.inc b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/PlSnP-Fallback.inc
new file mode 100644
index 000000000..7006c126b
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/PlSnP-Fallback.inc
@@ -0,0 +1,295 @@
+/*
+The eXtended Keccak Code Package (XKCP)
+https://github.com/XKCP/XKCP
+
+Implementation by Gilles Van Assche, hereby denoted as "the implementer".
+
+For more information, feedback or questions, please refer to the Keccak Team website:
+https://keccak.team/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+
+---
+
+This file contains macros that help make a PlSnP-compatible implementation by
+serially falling back on a SnP-compatible implementation or on a PlSnP-compatible
+implementation of lower parallism degree.
+
+Please refer to PlSnP-documentation.h for more details.
+*/
+
+/* expect PlSnP_baseParallelism, PlSnP_targetParallelism */
+/* expect SnP_stateSizeInBytes, SnP_stateAlignment */
+/* expect prefix */
+/* expect SnP_* */
+
+#if defined(ADD_SYMBOL_SUFFIX)
+#define JOIN0(a, b, c) a ## _ ## b ## _ ## c
+#define JOIN(a, b, c) JOIN0(a, b, c)
+#else
+#define JOIN0(a, b) a ## _ ## b
+#define JOIN(a, b, c) JOIN0(a, b)
+#endif
+
+#define PlSnP_StaticInitialize JOIN(prefix, StaticInitialize, suffix)
+#define PlSnP_InitializeAll JOIN(prefix, InitializeAll, suffix)
+#define PlSnP_AddByte JOIN(prefix, AddByte, suffix)
+#define PlSnP_AddBytes JOIN(prefix, AddBytes, suffix)
+#define PlSnP_AddLanesAll JOIN(prefix, AddLanesAll, suffix)
+#define PlSnP_OverwriteBytes JOIN(prefix, OverwriteBytes, suffix)
+#define PlSnP_OverwriteLanesAll JOIN(prefix, OverwriteLanesAll, suffix)
+#define PlSnP_OverwriteWithZeroes JOIN(prefix, OverwriteWithZeroes, suffix)
+#define PlSnP_ExtractBytes JOIN(prefix, ExtractBytes, suffix)
+#define PlSnP_ExtractLanesAll JOIN(prefix, ExtractLanesAll, suffix)
+#define PlSnP_ExtractAndAddBytes JOIN(prefix, ExtractAndAddBytes, suffix)
+#define PlSnP_ExtractAndAddLanesAll JOIN(prefix, ExtractAndAddLanesAll, suffix)
+
+#if (PlSnP_baseParallelism == 1)
+ #define SnP_stateSizeInBytes JOIN(SnP_prefix, stateSizeInBytes, SnP_suffix)
+ #define SnP_stateAlignment JOIN(SnP_prefix, stateAlignment, SnP_suffix)
+#else
+ #define SnP_stateSizeInBytes JOIN(SnP_prefix, statesSizeInBytes, SnP_suffix)
+ #define SnP_stateAlignment JOIN(SnP_prefix, statesAlignment, SnP_suffix)
+#endif
+#define PlSnP_factor ((PlSnP_targetParallelism)/(PlSnP_baseParallelism))
+#define SnP_stateOffset (((SnP_stateSizeInBytes+(SnP_stateAlignment-1))/SnP_stateAlignment)*SnP_stateAlignment)
+#define stateWithIndex(i) ((unsigned char *)states+((i)*SnP_stateOffset))
+
+#define SnP_StaticInitialize JOIN(SnP_prefix, StaticInitialize, SnP_suffix)
+#define SnP_Initialize JOIN(SnP_prefix, Initialize, SnP_suffix)
+#define SnP_InitializeAll JOIN(SnP_prefix, InitializeAll, SnP_suffix)
+#define SnP_AddByte JOIN(SnP_prefix, AddByte, SnP_suffix)
+#define SnP_AddBytes JOIN(SnP_prefix, AddBytes, SnP_suffix)
+#define SnP_AddLanesAll JOIN(SnP_prefix, AddLanesAll, SnP_suffix)
+#define SnP_OverwriteBytes JOIN(SnP_prefix, OverwriteBytes, SnP_suffix)
+#define SnP_OverwriteLanesAll JOIN(SnP_prefix, OverwriteLanesAll, SnP_suffix)
+#define SnP_OverwriteWithZeroes JOIN(SnP_prefix, OverwriteWithZeroes, SnP_suffix)
+#define SnP_ExtractBytes JOIN(SnP_prefix, ExtractBytes, SnP_suffix)
+#define SnP_ExtractLanesAll JOIN(SnP_prefix, ExtractLanesAll, SnP_suffix)
+#define SnP_ExtractAndAddBytes JOIN(SnP_prefix, ExtractAndAddBytes, SnP_suffix)
+#define SnP_ExtractAndAddLanesAll JOIN(SnP_prefix, ExtractAndAddLanesAll, SnP_suffix)
+
+void PlSnP_StaticInitialize( void )
+{
+ SnP_StaticInitialize();
+}
+
+void PlSnP_InitializeAll(void *states)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++)
+ #if (PlSnP_baseParallelism == 1)
+ SnP_Initialize(stateWithIndex(i));
+ #else
+ SnP_InitializeAll(stateWithIndex(i));
+ #endif
+}
+
+void PlSnP_AddByte(void *states, unsigned int instanceIndex, unsigned char byte, unsigned int offset)
+{
+ #if (PlSnP_baseParallelism == 1)
+ SnP_AddByte(stateWithIndex(instanceIndex), byte, offset);
+ #else
+ SnP_AddByte(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, byte, offset);
+ #endif
+}
+
+void PlSnP_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
+{
+ #if (PlSnP_baseParallelism == 1)
+ SnP_AddBytes(stateWithIndex(instanceIndex), data, offset, length);
+ #else
+ SnP_AddBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, data, offset, length);
+ #endif
+}
+
+void PlSnP_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_AddBytes(stateWithIndex(i), data, 0, laneCount*SnP_laneLengthInBytes);
+ #else
+ SnP_AddLanesAll(stateWithIndex(i), data, laneCount, laneOffset);
+ #endif
+ data += PlSnP_baseParallelism*laneOffset*SnP_laneLengthInBytes;
+ }
+}
+
+void PlSnP_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
+{
+ #if (PlSnP_baseParallelism == 1)
+ SnP_OverwriteBytes(stateWithIndex(instanceIndex), data, offset, length);
+ #else
+ SnP_OverwriteBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, data, offset, length);
+ #endif
+}
+
+void PlSnP_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_OverwriteBytes(stateWithIndex(i), data, 0, laneCount*SnP_laneLengthInBytes);
+ #else
+ SnP_OverwriteLanesAll(stateWithIndex(i), data, laneCount, laneOffset);
+ #endif
+ data += PlSnP_baseParallelism*laneOffset*SnP_laneLengthInBytes;
+ }
+}
+
+void PlSnP_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount)
+{
+ #if (PlSnP_baseParallelism == 1)
+ SnP_OverwriteWithZeroes(stateWithIndex(instanceIndex), byteCount);
+ #else
+ SnP_OverwriteWithZeroes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, byteCount);
+ #endif
+}
+
+void PlSnP_PermuteAll(void *states)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_Permute(stateWithIndex(i));
+ #else
+ SnP_PermuteAll(stateWithIndex(i));
+ #endif
+ }
+}
+
+#if (defined(SnP_Permute_12rounds) || defined(SnP_PermuteAll_12rounds))
+void PlSnP_PermuteAll_12rounds(void *states)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_Permute_12rounds(stateWithIndex(i));
+ #else
+ SnP_PermuteAll_12rounds(stateWithIndex(i));
+ #endif
+ }
+}
+#endif
+
+#if (defined(SnP_Permute_Nrounds) || defined(SnP_PermuteAll_6rounds))
+void PlSnP_PermuteAll_6rounds(void *states)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_Permute_Nrounds(stateWithIndex(i), 6);
+ #else
+ SnP_PermuteAll_6rounds(stateWithIndex(i));
+ #endif
+ }
+}
+#endif
+
+#if (defined(SnP_Permute_Nrounds) || defined(SnP_PermuteAll_4rounds))
+void PlSnP_PermuteAll_4rounds(void *states)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_Permute_Nrounds(stateWithIndex(i), 4);
+ #else
+ SnP_PermuteAll_4rounds(stateWithIndex(i));
+ #endif
+ }
+}
+#endif
+
+void PlSnP_ExtractBytes(void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length)
+{
+ #if (PlSnP_baseParallelism == 1)
+ SnP_ExtractBytes(stateWithIndex(instanceIndex), data, offset, length);
+ #else
+ SnP_ExtractBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, data, offset, length);
+ #endif
+}
+
+void PlSnP_ExtractLanesAll(void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_ExtractBytes(stateWithIndex(i), data, 0, laneCount*SnP_laneLengthInBytes);
+ #else
+ SnP_ExtractLanesAll(stateWithIndex(i), data, laneCount, laneOffset);
+ #endif
+ data += laneOffset*SnP_laneLengthInBytes*PlSnP_baseParallelism;
+ }
+}
+
+void PlSnP_ExtractAndAddBytes(void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
+{
+ #if (PlSnP_baseParallelism == 1)
+ SnP_ExtractAndAddBytes(stateWithIndex(instanceIndex), input, output, offset, length);
+ #else
+ SnP_ExtractAndAddBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, input, output, offset, length);
+ #endif
+}
+
+void PlSnP_ExtractAndAddLanesAll(void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset)
+{
+ unsigned int i;
+
+ for(i=0; i<PlSnP_factor; i++) {
+ #if (PlSnP_baseParallelism == 1)
+ SnP_ExtractAndAddBytes(stateWithIndex(i), input, output, 0, laneCount*SnP_laneLengthInBytes);
+ #else
+ SnP_ExtractAndAddLanesAll(stateWithIndex(i), input, output, laneCount, laneOffset);
+ #endif
+ input += laneOffset*SnP_laneLengthInBytes*PlSnP_baseParallelism;
+ output += laneOffset*SnP_laneLengthInBytes*PlSnP_baseParallelism;
+ }
+}
+
+#undef PlSnP_factor
+#undef SnP_stateOffset
+#undef stateWithIndex
+#undef JOIN0
+#undef JOIN
+#undef PlSnP_StaticInitialize
+#undef PlSnP_InitializeAll
+#undef PlSnP_AddByte
+#undef PlSnP_AddBytes
+#undef PlSnP_AddLanesAll
+#undef PlSnP_OverwriteBytes
+#undef PlSnP_OverwriteLanesAll
+#undef PlSnP_OverwriteWithZeroes
+#undef PlSnP_PermuteAll
+#undef PlSnP_ExtractBytes
+#undef PlSnP_ExtractLanesAll
+#undef PlSnP_ExtractAndAddBytes
+#undef PlSnP_ExtractAndAddLanesAll
+#undef SnP_stateAlignment
+#undef SnP_stateSizeInBytes
+#undef PlSnP_factor
+#undef SnP_stateOffset
+#undef stateWithIndex
+#undef SnP_StaticInitialize
+#undef SnP_Initialize
+#undef SnP_InitializeAll
+#undef SnP_AddByte
+#undef SnP_AddBytes
+#undef SnP_AddLanesAll
+#undef SnP_OverwriteBytes
+#undef SnP_OverwriteWithZeroes
+#undef SnP_OverwriteLanesAll
+#undef SnP_ExtractBytes
+#undef SnP_ExtractLanesAll
+#undef SnP_ExtractAndAddBytes
+#undef SnP_ExtractAndAddLanesAll
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/config.mk b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/config.mk
new file mode 100644
index 000000000..3bd40a5ea
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/config.mk
@@ -0,0 +1,12 @@
+# DO NOT EDIT: generated from config.mk.subdirs.template
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# add fixes for platform integration issues here.
+#
+# liboqs programs expect the public include files to be in oqs/xxxx,
+# So we put liboqs in it's own module, oqs, and point to the dist files
+INCLUDES += -I$(CORE_DEPTH)/lib/liboqs/src/common/pqclean_shims -I$(CORE_DEPTH)/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600/plain-64bits
+DEFINES +=
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/manifest.mn b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/manifest.mn
new file mode 100644
index 000000000..73dc52adb
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/manifest.mn
@@ -0,0 +1,23 @@
+# DO NOT EDIT: generated from manifest.mn.subdirs.template
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+CORE_DEPTH = ../../../../../../../..
+
+MODULE = oqs
+
+LIBRARY_NAME = oqs_src_common_sha3_xkcp_low_KeccakP-1600times4_serial
+SHARED_LIBRARY = $(NULL)
+
+CSRCS = \
+ KeccakP-1600-times4-on1.c \
+ $(NULL)
+
+# only add module debugging in opt builds if DEBUG_PKCS11 is set
+ifdef DEBUG_PKCS11
+ DEFINES += -DDEBUG_MODULE
+endif
+
+# This part of the code, including all sub-dirs, can be optimized for size
+export ALLOW_OPT_CODE_SIZE = 1
diff --git a/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/serial.gyp b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/serial.gyp
new file mode 100644
index 000000000..43668be20
--- /dev/null
+++ b/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600times4/serial/serial.gyp
@@ -0,0 +1,32 @@
+# DO NOT EDIT: generated from subdir.gyp.template
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+{
+ 'includes': [
+ '../../../../../../../../coreconf/config.gypi'
+ ],
+ 'targets': [
+ {
+ 'target_name': 'oqs_src_common_sha3_xkcp_low_KeccakP-1600times4_serial',
+ 'type': 'static_library',
+ 'sources': [
+ 'KeccakP-1600-times4-on1.c',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/exports.gyp:nss_exports'
+ ]
+ }
+ ],
+ 'target_defaults': {
+ 'defines': [
+ ],
+ 'include_dirs': [
+ '<(DEPTH)/lib/liboqs/src/common/pqclean_shims',
+ '<(DEPTH)/lib/liboqs/src/common/sha3/xkcp_low/KeccakP-1600/plain-64bits',
+ ]
+ },
+ 'variables': {
+ 'module': 'oqs'
+ }
+}