summaryrefslogtreecommitdiff
path: root/sntrup4591761.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sntrup4591761.sh')
-rw-r--r--sntrup4591761.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/sntrup4591761.sh b/sntrup4591761.sh
new file mode 100644
index 000000000..e684c3329
--- /dev/null
+++ b/sntrup4591761.sh
@@ -0,0 +1,57 @@
1#!/bin/sh
2# $OpenBSD: sntrup4591761.sh,v 1.3 2019/01/30 19:51:15 markus Exp $
3# Placed in the Public Domain.
4#
5AUTHOR="libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/implementors"
6FILES="
7 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/int32_sort.h
8 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/int32_sort.c
9 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/small.h
10 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/mod3.h
11 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/modq.h
12 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/params.h
13 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/r3.h
14 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/rq.h
15 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/swap.h
16 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/dec.c
17 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/enc.c
18 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/keypair.c
19 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/r3_mult.c
20 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/r3_recip.c
21 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/randomsmall.c
22 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/randomweightw.c
23 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/rq.c
24 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/rq_mult.c
25 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/rq_recip3.c
26 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/rq_round3.c
27 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/rq_rounded.c
28 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/small.c
29 libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/swap.c
30"
31###
32
33set -e
34cd $1
35echo -n '/* $'
36echo 'OpenBSD: $ */'
37echo
38echo '/*'
39echo ' * Public Domain, Authors:'
40sed -e '/Alphabetical order:/d' -e 's/^/ * - /' < $AUTHOR
41echo ' */'
42echo
43echo '#include <string.h>'
44echo '#include "crypto_api.h"'
45echo
46for i in $FILES; do
47 echo "/* from $i */"
48 b=$(basename $i .c)
49 grep \
50 -v '#include' $i | \
51 grep -v "extern crypto_int32 small_random32" |
52 sed -e "s/crypto_kem_/crypto_kem_sntrup4591761_/g" \
53 -e "s/smaller_mask/smaller_mask_${b}/g" \
54 -e "s/^extern void /static void /" \
55 -e "s/^void /static void /"
56 echo
57done