blob: e684c3329c2ebfb2b6befa792067d9fc4221ccdb [file] [log] [blame]
djm@openbsd.orgdfd59162019-01-21 10:20:12 +00001#!/bin/sh
markus@openbsd.org5f004622019-01-30 19:51:15 +00002# $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"
djm@openbsd.orgdfd59162019-01-21 10:20:12 +00006FILES="
djm@openbsd.org533cfb02019-01-21 22:18:24 +00007 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.orgdfd59162019-01-21 10:20:12 +000030"
31###
32
33set -e
markus@openbsd.org5f004622019-01-30 19:51:15 +000034cd $1
35echo -n '/* $'
36echo 'OpenBSD: $ */'
37echo
38echo '/*'
39echo ' * Public Domain, Authors:'
40sed -e '/Alphabetical order:/d' -e 's/^/ * - /' < $AUTHOR
41echo ' */'
42echo
djm@openbsd.orgdfd59162019-01-21 10:20:12 +000043echo '#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" \
djm@openbsd.orgdfd59162019-01-21 10:20:12 +000054 -e "s/^extern void /static void /" \
55 -e "s/^void /static void /"
56 echo
57done