Check-in [43e088c82f]
Overview
Comment:Updated gen_dh_params to be really POSIX sh compliant
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tls-1-7
Files: files | file ages | folders
SHA1: 43e088c82f966bbc9b4952297000b9eb5712c71f
User & Date: rkeene on 2016-12-07 21:32:48
Other Links: branch diff | manifest | tags
Context
2016-12-07
21:34
TclTLS 1.7.3 check-in: ce64f41aec user: rkeene tags: tls-1-7, tls-1-7-3
21:32
Updated gen_dh_params to be really POSIX sh compliant check-in: 43e088c82f user: rkeene tags: tls-1-7
21:27
Updated to latest version of tcl.m4 check-in: 9e86ba53f9 user: rkeene tags: tls-1-7
Changes

Modified gen_dh_params from [41bf4180f0] to [d60a4dc243].

1
2
3
4
5

6
7
8
9
10


11
12

13
14
15
16
17
18
19
20

21
22
23
24
25

26
27
28
29
30
31


32
33
34


35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
1
2
3
4

5


6


7
8
9

10
11
12
13
14
15
16
17

18
19
20
21
22

23


24
25


26
27
28


29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45




-
+
-
-

-
-
+
+

-
+







-
+




-
+
-
-


-
-
+
+

-
-
+
+







-
+







#! /usr/bin/env sh

bits='2048'

function openssl_dhparam() {
openssl_dhparam() {
	local output

	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() {
gen_dh_params_remote() {
	local input output url

	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,
		0x20,0x2E,0xD3,0xFC,0x19,0xEE,0xB8,0xF3,0x35,0x7D,0xBA,0x86,
		0x2A,0xC3,0xC8,0x6E,0xF4,0x99,0x75,0x65,0xD3,0x7A,0x9E,0xDF,