liboqs/scripts/copy_from_xkcp/update_patches.sh
John Schanck 7dc4b378d6
Refactor SHA3 implementations and improve API (#922)
* sha3: remove old implementations

* sha3: new implementations

* picnic: use liboqs sha3 and sha3x4

* frodo: use new sha3x4 interface

* sphincs: use liboqs sha3x4

* fixup

* skip test_spdx on xkcp_low directory
* xkcp_sha3: explicit casts to avoid narrowing warnings
* xkcp_sha3x4: explicit casts to avoid narrowing warnings
* sha3: disable platform specific xkcp if OQS_PORTABLE_BUILD
* sha3: fix Wcast-qual warnings on clang-9
* fix 'reset' functions
* xkcp_sha3: skip fastloop call if input is not long enough
* xkcp_low: Enable lane complementing for plain-64bits
* xkcp_low: remove Kravatte definitions from times4/avx2

* Add common OQS_MEM_aligned_alloc and OQS_MEM_aligned_free

* Require both OQS_USE_OPENSSL and OQS_USE_SHA3_OPENSSL to enable OpenSSL's SHA3

* Fix some undefined behaviour in KeccakP-1600/plain-64bits

* Fix some undefined behaviour in KeccakP-1600times4/avx2

* Expand shake tests

* Add sha3x4.h include to oqs.h

* Add xkcp_low license info to readme [skip-ci]

* Add copy_from_xkcp scripts [skip-ci]

* SPDX License Info for new scripts [skip-ci]
2021-03-22 19:54:32 -04:00

48 lines
835 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: MIT
BASE=$(dirname "$0")
BASE=$(cd "${BASE}" && pwd)
cd "${BASE}" || exit
PATCHES="${BASE}/patches"
V1=upstream
V2=upstream-patched
if [ ! -e "${V1}" ]
then
echo "${BASE}/${V1} not found"
exit
fi
if [ ! -e "${V2}" ]
then
echo "${BASE}/${V2} not found"
exit
fi
rm -rf "${PATCHES}"
mkdir -p "${PATCHES}/tmp/"
diff -ruN --no-dereference "${V1}" "${V2}" > "${PATCHES}/tmp/p"
( cd "${PATCHES}/tmp/" || exit
splitpatch "${PATCHES}/tmp/p"
rm "${PATCHES}/tmp/p"
for X in *
do
Y=$(echo "${X}" \
| head -n 1 "${X}" \
| tr '\t' ' ' \
| cut -d ' ' -f 2 \
| cut -d'/' -f 2- \
| tr '/' '_')
mv "${X}" "${Y}"
sed -i '1,2 s/\t.*$//' "${Y}"
sed -i '$ s/diff.*//' "${Y}"
done
)
mv "${PATCHES}"/tmp/* "${PATCHES}"
rm -rf "${PATCHES}"/tmp/