djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 1 | #!/bin/sh |
markus@openbsd.org | 5f00462 | 2019-01-30 19:51:15 +0000 | [diff] [blame] | 2 | # $OpenBSD: sntrup4591761.sh,v 1.3 2019/01/30 19:51:15 markus Exp $ |
| 3 | # Placed in the Public Domain. |
| 4 | # |
| 5 | AUTHOR="libpqcrypto-20180314/crypto_kem/sntrup4591761/ref/implementors" |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 6 | FILES=" |
djm@openbsd.org | 533cfb0 | 2019-01-21 22:18:24 +0000 | [diff] [blame] | 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 |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 30 | " |
| 31 | ### |
| 32 | |
| 33 | set -e |
markus@openbsd.org | 5f00462 | 2019-01-30 19:51:15 +0000 | [diff] [blame] | 34 | cd $1 |
| 35 | echo -n '/* $' |
| 36 | echo 'OpenBSD: $ */' |
| 37 | echo |
| 38 | echo '/*' |
| 39 | echo ' * Public Domain, Authors:' |
| 40 | sed -e '/Alphabetical order:/d' -e 's/^/ * - /' < $AUTHOR |
| 41 | echo ' */' |
| 42 | echo |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 43 | echo '#include <string.h>' |
| 44 | echo '#include "crypto_api.h"' |
| 45 | echo |
| 46 | for 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" \ |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 54 | -e "s/^extern void /static void /" \ |
| 55 | -e "s/^void /static void /" |
| 56 | echo |
| 57 | done |