Index: gen_dh_params ================================================================== --- gen_dh_params +++ gen_dh_params @@ -1,47 +1,43 @@ #! /usr/bin/env sh bits='2048' -function openssl_dhparam() { - local output - +openssl_dhparam() { if [ -x "`which openssl 2>/dev/null`" ]; then - output="`openssl dhparam -C "$@" 2>/dev/null`" || return 1 - output="`echo "${output}" | sed '/^-----BEGIN DH PARAMETERS-----$/,/^-----END DH PARAMETERS-----$/ d;/^#/ d'`" || return 1 + o_output="`openssl dhparam -C "$@" 2>/dev/null`" || return 1 + o_output="`echo "${o_output}" | sed '/^-----BEGIN DH PARAMETERS-----$/,/^-----END DH PARAMETERS-----$/ d;/^#/ d'`" || return 1 - echo "${output}" + echo "${o_output}" return 0 fi return 1 } -function gen_dh_params_openssl() { +gen_dh_params_openssl() { openssl_dhparam "${bits}" < /dev/null || return 1 return 0 } -function gen_dh_params_remote() { - local input output url - +gen_dh_params_remote() { url="https://2ton.com.au/dhparam/${bits}" - input="`curl -sS "${url}"`" || \ - input="`wget -O - -o /dev/null "${url}"`" || return 1 + r_input="`curl -sS "${url}"`" || \ + r_input="`wget -O - -o /dev/null "${url}"`" || return 1 - if output="`echo "${input}" | openssl_dhparam`"; then - echo "${output}" + if r_output="`echo "${r_input}" | openssl_dhparam`"; then + echo "${r_output}" return 0 fi return 1 } -function gen_dh_params_fallback() { +gen_dh_params_fallback() { cat << \_EOF_ DH *get_dh2048() { static unsigned char dh2048_p[]={ 0xC1,0x51,0x58,0x69,0xFB,0xE8,0x6C,0x47,0x2B,0x86,0x61,0x4F,