Index: gen_dh_params ================================================================== --- gen_dh_params +++ gen_dh_params @@ -1,8 +1,19 @@ #! /usr/bin/env sh bits='2048' +option_fallback='0' +for arg in "$@"; do + case "${arg}" in + fallback) + option_fallback='1' + ;; + bits=*) + bits="`echo "${arg}" | cut -f 2 -d =`" + ;; + esac +done openssl_dhparam() { if [ -x "`which openssl 2>/dev/null`" ]; then o_output="`openssl dhparam -C "$@" 2>/dev/null`" || return 1 o_output="`echo "${o_output}" | sed 's/get_dh[0-9]\+/get_dhParams/'`" || return 1 @@ -101,11 +112,11 @@ return 1 } # Enable support for giving the same DH params each time -if [ "$1" = 'fallback' ]; then +if [ "${option_fallback}" = '1' ]; then gen_dh_params_fallback && exit 0 echo "Unable to generate fallback parameters for DH of ${bits} bits" >&2 exit 1