1
2
3
4
5
6
7
8
9
10
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
+
+
+
+
+
+
+
+
+
+
+
|
#! /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
o_output="`echo "${o_output}" | sed '/^-----BEGIN DH PARAMETERS-----$/,/^-----END DH PARAMETERS-----$/ d;/^#/ d'`" || return 1
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
-
+
|
return 0
fi
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
fi
|