mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
git-subtree-dir: crypto/libecc git-subtree-mainline:f59bb61e1egit-subtree-split:736d663976
53 lines
1.6 KiB
Bash
53 lines
1.6 KiB
Bash
#/*
|
|
# * Copyright (C) 2017 - This file is part of libecc project
|
|
# *
|
|
# * Authors:
|
|
# * Ryad BENADJILA <[email protected]>
|
|
# * Arnaud EBALARD <[email protected]>
|
|
# * Jean-Pierre FLORI <[email protected]>
|
|
# *
|
|
# * Contributors:
|
|
# * Nicolas VIVET <[email protected]>
|
|
# * Karim KHALFALLAH <[email protected]>
|
|
# *
|
|
# * This software is licensed under a dual BSD and GPL v2 license.
|
|
# * See LICENSE file at the root folder of the project.
|
|
# */
|
|
#!/bin/sh
|
|
|
|
CURVES=`openssl ecparam -list_curves | grep prime | cut -d':' -f1 | tr '\n' ' '`
|
|
|
|
# Find a suitable python command if none has been provided
|
|
if [ -z "$PYTHON" ]
|
|
then
|
|
echo "Looking for suitable python and deps"
|
|
# Try to guess which python we want to use depending on the installed
|
|
# packages. We need Pyscard, Crypto, and IntelHex
|
|
for i in python python3 python2; do
|
|
if [ -x "`which $i`" ]; then
|
|
echo "Found and using python=$i"
|
|
PYTHON=$i
|
|
break
|
|
fi
|
|
done
|
|
else
|
|
echo "Using user provided python=$PYTHON"
|
|
fi
|
|
|
|
if [ -z "$PYTHON" ]; then
|
|
echo "Failed to find working python cmd!" >&2
|
|
exit
|
|
fi
|
|
|
|
# Get the expand_libecc python script path
|
|
BASEDIR=$(dirname "$0")
|
|
EXPAND_LIBECC=$BASEDIR/expand_libecc.py
|
|
|
|
for curve in $CURVES
|
|
do
|
|
echo "Adding $curve"
|
|
openssl ecparam -param_enc explicit -outform DER -name $curve -out "$curve".der
|
|
$PYTHON $EXPAND_LIBECC --name="$curve" --ECfile="$curve".der --add-test-vectors=2
|
|
rm "$curve".der
|
|
done
|