[BACK]Return to sntrup761.sh CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Annotation of src/usr.bin/ssh/sntrup761.sh, Revision 1.4

1.1       djm         1: #!/bin/sh
1.4     ! dtucker     2: #       $OpenBSD: sntrup761.sh,v 1.3 2021/01/03 18:05:21 tobhe Exp $
1.1       djm         3: #       Placed in the Public Domain.
                      4: #
                      5: AUTHOR="supercop-20201130/crypto_kem/sntrup761/ref/implementors"
                      6: FILES="
1.4     ! dtucker     7:        supercop-20201130/crypto_sort/int32/portable4/int32_minmax.inc
        !             8:        supercop-20201130/crypto_sort/int32/portable4/sort.c
        !             9:        supercop-20201130/crypto_sort/uint32/useint32/sort.c
1.1       djm        10:        supercop-20201130/crypto_kem/sntrup761/ref/uint64.h
                     11:        supercop-20201130/crypto_kem/sntrup761/ref/uint16.h
                     12:        supercop-20201130/crypto_kem/sntrup761/ref/uint32.h
                     13:        supercop-20201130/crypto_kem/sntrup761/ref/int8.h
                     14:        supercop-20201130/crypto_kem/sntrup761/ref/int16.h
                     15:        supercop-20201130/crypto_kem/sntrup761/ref/int32.h
                     16:        supercop-20201130/crypto_kem/sntrup761/ref/uint32.c
                     17:        supercop-20201130/crypto_kem/sntrup761/ref/int32.c
                     18:        supercop-20201130/crypto_kem/sntrup761/ref/paramsmenu.h
                     19:        supercop-20201130/crypto_kem/sntrup761/ref/params.h
                     20:        supercop-20201130/crypto_kem/sntrup761/ref/Decode.h
                     21:        supercop-20201130/crypto_kem/sntrup761/ref/Decode.c
                     22:        supercop-20201130/crypto_kem/sntrup761/ref/Encode.h
                     23:        supercop-20201130/crypto_kem/sntrup761/ref/Encode.c
                     24:        supercop-20201130/crypto_kem/sntrup761/ref/kem.c
                     25: "
                     26: ###
                     27:
                     28: set -e
                     29: cd $1
                     30: echo -n '/*  $'
                     31: echo 'OpenBSD: $ */'
                     32: echo
                     33: echo '/*'
                     34: echo ' * Public Domain, Authors:'
                     35: sed -e '/Alphabetical order:/d' -e 's/^/ * - /' < $AUTHOR
                     36: echo ' */'
                     37: echo
                     38: echo '#include <string.h>'
                     39: echo '#include "crypto_api.h"'
                     40: echo
                     41: echo '#define CRYPTO_NAMESPACE(s) s'
                     42: echo
                     43: for i in $FILES; do
                     44:        echo "/* from $i */"
                     45:        grep \
                     46:           -v '#include' $i | \
1.4     ! dtucker    47:        case "$i" in
        !            48:        # Use int64_t for intermediate values in int32_MINMAX to prevent signed
        !            49:        # 32-bit integer overflow when called by crypto_sort_uint32.
        !            50:        */int32_minmax.inc)
        !            51:            sed -e "s/int32 ab = b ^ a/int64_t ab = (int64_t)b ^ (int64_t)a/" \
        !            52:            -e "s/int32 c = b - a/int64_t c = (int64_t)b - (int64_t)a/"
        !            53:            ;;
        !            54:        */int32/portable4/sort.c)
        !            55:            sed -e "s/void crypto_sort/static void crypto_sort_int32/g"
        !            56:            ;;
        !            57:        */uint32/useint32/sort.c)
        !            58:            sed -e "s/void crypto_sort/static void crypto_sort_uint32/g"
        !            59:            ;;
        !            60:        *)
        !            61:            sed -e "s/crypto_kem_/crypto_kem_sntrup761_/g" \
1.1       djm        62:                -e "s/^extern void /static void /" \
1.3       tobhe      63:                -e "s/^void /static void /" \
                     64:                -e "/^typedef int32_t int32;$/d"
1.4     ! dtucker    65:        esac
1.1       djm        66:        echo
                     67: done