]> Cypherpunks.ru repositories - gostls13.git/blob - gogost-install
Use GoGOST's PublicKey wrappers
[gostls13.git] / gogost-install
1 #!/bin/sh -ex
2
3 command -v fetch >/dev/null && DL="fetch -o" || DL="wget -O"
4 command -v sha256 >/dev/null && SHA256="sha256" || SHA256="sha256sum --binary"
5 PERL=${PERL:-perl}
6
7 TARBALL=gogost-5.13.0.tar.zst
8 [ -r $TARBALL ] || {
9     $DL $TARBALL.tmp http://www.gogost.cypherpunks.ru/$TARBALL
10     mv $TARBALL.tmp $TARBALL
11 }
12 [ "`$SHA256 < $TARBALL | $PERL -lane 'print $F[0]'`" = "ee0deeb665aee4246c21c8c9f814860502468e37216f43d9acee8c309cc4843e" ]
13 tar xf $TARBALL
14 mkdir -p src/crypto/go.cypherpunks.ru/gogost
15 mv ${TARBALL%.tar.zst} src/crypto/go.cypherpunks.ru/gogost/v5
16 crypto_version=$(sed -n 's#^.*golang.org/x/crypto \(.*\)$#\1#p' < src/go.mod)
17 cd src/crypto/go.cypherpunks.ru/gogost/v5
18 rm -r cmd bench
19 rm gost341194/pbkdf2_test.go
20 for len in 256 512 ; do
21     fn=gost34112012${len}/hash.go
22     echo "func init() { crypto.RegisterHash(crypto.GOSTR34112012${len}, New) }" >> $fn
23     $PERL -i -npe '/"hash"/ and print "\t\"crypto\"\n"' $fn
24 done
25 find . -name "*.go" -exec $PERL -i -npe "s#go.cypherpunks.ru#crypto/go.cypherpunks.ru#" {} \+
26 $PERL -i -ne "s#^(require golang.org/x/crypto) .*\$#\$1 $crypto_version#" go.mod
27 rm go.sum