Check-in [32ccafd13f]
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA
Overview
Comment:Updated gen_dh_params to run with the POSIX shell
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tls-1-7
Files: files | file ages | folders
SHA1: 32ccafd13f74bd084d1974b757b0f0b40a0b1251
User & Date: rkeene on 2016-12-07 20:57:22
Other Links: branch diff | manifest | tags
Context
2016-12-07
21:27
Updated to latest version of tcl.m4 check-in: 9e86ba53f9 user: rkeene tags: tls-1-7
20:57
Updated gen_dh_params to run with the POSIX shell check-in: 32ccafd13f user: rkeene tags: tls-1-7
20:45
Removed dependency on Makefile for tls.tcl -- so distributions don't try to rebuild it check-in: a23793abf0 user: rkeene tags: tls-1-7
Changes

Modified gen_dh_params from [121b16da7e] to [41bf4180f0].

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

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
-
+






-
-
+
+
+



















-
-
+
+

-
+







#! /usr/bin/env bash
#! /usr/bin/env sh

bits='2048'

function openssl_dhparam() {
	local output

	if [ -x "$(which openssl 2>/dev/null)" ]; then
		output="$(set -o pipefail; openssl dhparam -C "$@" 2>/dev/null | sed '/^-----BEGIN DH PARAMETERS-----$/,/^-----END DH PARAMETERS-----$/ d;/^#/ d')" || return 1
	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

		echo "${output}"

		return 0
	fi

	return 1
}

function gen_dh_params_openssl() {
	openssl_dhparam "${bits}" < /dev/null || return 1
	return 0
}

function gen_dh_params_remote() {
	local input output url

	url="https://2ton.com.au/dhparam/${bits}"

	input="$(curl "${url}")" || \
		input="$(wget -O - -o /dev/null "${url}")" || return 1
	input="`curl -sS "${url}"`" || \
		input="`wget -O - -o /dev/null "${url}"`" || return 1

	if output="$(echo "${input}" | openssl_dhparam)"; then
	if output="`echo "${input}" | openssl_dhparam`"; then
		echo "${output}"

		return 0
	fi

	return 1
}