freebsd-dev/crypto/openssh/sntrup761.sh
Ed Maste 19261079b7 openssh: update to OpenSSH v8.7p1
Some notable changes, from upstream's release notes:

- sshd(8): Remove support for obsolete "host/port" syntax.
- ssh(1): When prompting whether to record a new host key, accept the key
  fingerprint as a synonym for "yes".
- ssh-keygen(1): when acting as a CA and signing certificates with an RSA
  key, default to using the rsa-sha2-512 signature algorithm.
- ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa"
  (RSA/SHA1) algorithm from those accepted for certificate signatures.
- ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F
  support to provide address-space isolation for token middleware
  libraries (including the internal one).
- ssh(1): this release enables UpdateHostkeys by default subject to some
  conservative preconditions.
- scp(1): this release changes the behaviour of remote to remote copies
  (e.g. "scp host-a:/path host-b:") to transfer through the local host
  by default.
- scp(1): experimental support for transfers using the SFTP protocol as
  a replacement for the venerable SCP/RCP protocol that it has
  traditionally used.

Additional integration work is needed to support FIDO/U2F in the base
system.

Deprecation Notice
------------------

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Reviewed by:	imp
MFC after:	1 month
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29985
2021-09-07 21:05:51 -04:00

86 lines
2.7 KiB
Bash

#!/bin/sh
# $OpenBSD: sntrup761.sh,v 1.5 2021/01/08 02:33:13 dtucker Exp $
# Placed in the Public Domain.
#
AUTHOR="supercop-20201130/crypto_kem/sntrup761/ref/implementors"
FILES="
supercop-20201130/crypto_sort/int32/portable4/int32_minmax.inc
supercop-20201130/crypto_sort/int32/portable4/sort.c
supercop-20201130/crypto_sort/uint32/useint32/sort.c
supercop-20201130/crypto_kem/sntrup761/ref/uint32.c
supercop-20201130/crypto_kem/sntrup761/ref/int32.c
supercop-20201130/crypto_kem/sntrup761/ref/paramsmenu.h
supercop-20201130/crypto_kem/sntrup761/ref/params.h
supercop-20201130/crypto_kem/sntrup761/ref/Decode.h
supercop-20201130/crypto_kem/sntrup761/ref/Decode.c
supercop-20201130/crypto_kem/sntrup761/ref/Encode.h
supercop-20201130/crypto_kem/sntrup761/ref/Encode.c
supercop-20201130/crypto_kem/sntrup761/ref/kem.c
"
###
set -e
cd $1
echo -n '/* $'
echo 'OpenBSD: $ */'
echo
echo '/*'
echo ' * Public Domain, Authors:'
sed -e '/Alphabetical order:/d' -e 's/^/ * - /' < $AUTHOR
echo ' */'
echo
echo '#include <string.h>'
echo '#include "crypto_api.h"'
echo
# Map the types used in this code to the ones in crypto_api.h. We use #define
# instead of typedef since some systems have existing intXX types and do not
# permit multiple typedefs even if they do not conflict.
for t in int8 uint8 int16 uint16 int32 uint32 int64 uint64; do
echo "#define $t crypto_${t}"
done
echo
for i in $FILES; do
echo "/* from $i */"
# Changes to all files:
# - remove all includes, we inline everything required.
# - make functions not required elsewhere static.
# - rename the functions we do use.
# - remove unneccesary defines and externs.
sed -e "/#include/d" \
-e "s/crypto_kem_/crypto_kem_sntrup761_/g" \
-e "s/^void /static void /g" \
-e "s/^int16 /static int16 /g" \
-e "s/^uint16 /static uint16 /g" \
-e "/^extern /d" \
-e '/CRYPTO_NAMESPACE/d' \
-e "/^#define int32 crypto_int32/d" \
$i | \
case "$i" in
# Use int64_t for intermediate values in int32_MINMAX to prevent signed
# 32-bit integer overflow when called by crypto_sort_uint32.
*/int32_minmax.inc)
sed -e "s/int32 ab = b ^ a/int64_t ab = (int64_t)b ^ (int64_t)a/" \
-e "s/int32 c = b - a/int64_t c = (int64_t)b - (int64_t)a/"
;;
*/int32/portable4/sort.c)
sed -e "s/void crypto_sort/void crypto_sort_int32/g"
;;
*/uint32/useint32/sort.c)
sed -e "s/void crypto_sort/void crypto_sort_uint32/g"
;;
# Remove unused function to prevent warning.
*/crypto_kem/sntrup761/ref/int32.c)
sed -e '/ int32_div_uint14/,/^}$/d'
;;
# Remove unused function to prevent warning.
*/crypto_kem/sntrup761/ref/uint32.c)
sed -e '/ uint32_div_uint14/,/^}$/d'
;;
# Default: pass through.
*)
cat
;;
esac
echo
done