From 56a5852d8dea0486ba19bd2e9b4f92760eafeae2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Dec 2015 11:03:20 +0000 Subject: [PATCH] Make fast calculation of DH params optional --- src/freedombone-dhparam | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/freedombone-dhparam b/src/freedombone-dhparam index 23b3296a..9d9d9b39 100755 --- a/src/freedombone-dhparam +++ b/src/freedombone-dhparam @@ -36,16 +36,17 @@ export TEXTDOMAINDIR="/usr/share/locale" HOSTNAME= KEYLENGTH=2048 RECALCULATE="no" +FAST='' function show_help { echo '' - echo $"${PROJECT_NAME}-dhparam -h [hostname] -l [length in bits] --recalc [yes|no]" + echo $"${PROJECT_NAME}-dhparam -h [hostname] -l [length in bits] --recalc [yes|no] --fast [yes|no]" echo '' exit 0 } function calc_dh { - openssl dhparam -check -text -dsaparam $KEYLENGTH -out ${1} + openssl dhparam -check -text $FAST $KEYLENGTH -out ${1} if [ ! "$?" = "0" ]; then exit 3674 fi @@ -85,6 +86,12 @@ case $key in shift RECALCULATE=${1} ;; + --fast) + shift + if [[ ${1} == "yes" || ${1} == "y" ]]; then + FAST='-dsaparam' + fi + ;; *) # unknown option ;;