[PATCH] mceliece6688128f: update generation script to apply changes from git

Jussi Kivilinna jussi.kivilinna at iki.fi
Sun Oct 5 11:59:09 CEST 2025


* cipher/mceliece6688128f.sh: Apply changes to 'mceliece6688128f.c'
from git history.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/mceliece6688128f.sh | 47 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/cipher/mceliece6688128f.sh b/cipher/mceliece6688128f.sh
index 84245432..aab50b25 100755
--- a/cipher/mceliece6688128f.sh
+++ b/cipher/mceliece6688128f.sh
@@ -77,10 +77,42 @@ FILES="	libmceliece-20230612/include-build/crypto_declassify.h
 	libmceliece-20230612/crypto_kem/6688128f/vec/wrap_dec.c
 	libmceliece-20230612/crypto_kem/6688128f/vec/wrap_enc.c
 	libmceliece-20230612/crypto_kem/6688128f/vec/wrap_keypair.c"
+
+# First commit with "cipher/mceliece6688128f.c" generated using script:
+START_COMMIT="47ed744465ae7461771a3ca08799264a3d32a7fd"
+if [ "x$GIT_BASE_DIR" = "x" ]; then
+  GIT_BASE_DIR="$1/.."
+fi
+if [ "x$GIT_TARGET_FILE" = "x" ]; then
+  GIT_TARGET_FILE="cipher/mceliece6688128f.c"
+fi
+
 ###
 
 set -e
-cd $1
+
+( cd "$1"; mkdir -p "mceliece6688128f-tmp" )
+
+# Generate patches from git commit history of target file
+COMMIT_LIST=$( \
+  cd "$GIT_BASE_DIR"; \
+  git log --reverse --pretty=format:%H ${START_COMMIT}..HEAD -- \
+    "${GIT_TARGET_FILE}" )
+i=0
+PATCHES=""
+for commit in $COMMIT_LIST
+do
+  i=$(expr $i + 1)
+  (
+    cd "$GIT_BASE_DIR"
+    git format-patch -1 "${commit}" --stdout -- "${GIT_TARGET_FILE}"
+  ) > "$1/mceliece6688128f-tmp/${i}.patch"
+  PATCHES="$PATCHES mceliece6688128f-tmp/${i}.patch"
+done
+
+cd "$1"
+
+(
 echo '/* mceliece6688128f.c - Classic McEliece for libgcrypt'
 echo ' * Copyright (C) 2023-2024 Simon Josefsson <simon at josefsson.org>'
 echo ' *'
@@ -248,3 +280,16 @@ void mceliece6688128f_keypair(uint8_t *pk,
   crypto_kem_keypair((unsigned char*) pk, (unsigned char*) sk);
 }
 EOF
+
+) > mceliece6688128f-tmp/mceliece6688128f.c
+cd mceliece6688128f-tmp
+for patchfile in $PATCHES; do
+  patch -s -p2 < "../$patchfile"
+done
+cd ..
+cat mceliece6688128f-tmp/mceliece6688128f.c
+rm mceliece6688128f-tmp/mceliece6688128f.c
+for patchfile in $PATCHES; do
+  rm "$patchfile"
+done
+rmdir mceliece6688128f-tmp
-- 
2.48.1




More information about the Gcrypt-devel mailing list