0000: 23 21 20 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 #! /usr/bin/env
0010: 73 68 0a 0a 62 69 74 73 3d 27 32 30 34 38 27 0a sh..bits='2048'.
0020: 6f 70 74 69 6f 6e 5f 66 61 6c 6c 62 61 63 6b 3d option_fallback=
0030: 27 30 27 0a 66 6f 72 20 61 72 67 20 69 6e 20 22 '0'.for arg in "
0040: 24 40 22 3b 20 64 6f 0a 09 63 61 73 65 20 22 24 $@"; do..case "$
0050: 7b 61 72 67 7d 22 20 69 6e 0a 09 09 66 61 6c 6c {arg}" in...fall
0060: 62 61 63 6b 29 0a 09 09 09 6f 70 74 69 6f 6e 5f back)....option_
0070: 66 61 6c 6c 62 61 63 6b 3d 27 31 27 0a 09 09 09 fallback='1'....
0080: 3b 3b 0a 09 09 62 69 74 73 3d 2a 29 0a 09 09 09 ;;...bits=*)....
0090: 62 69 74 73 3d 22 60 65 63 68 6f 20 22 24 7b 61 bits="`echo "${a
00a0: 72 67 7d 22 20 7c 20 63 75 74 20 2d 66 20 32 20 rg}" | cut -f 2
00b0: 2d 64 20 3d 60 22 0a 09 09 09 3b 3b 0a 09 65 73 -d =`"....;;..es
00c0: 61 63 0a 64 6f 6e 65 0a 0a 6f 70 65 6e 73 73 6c ac.done..openssl
00d0: 5f 64 68 70 61 72 61 6d 28 29 20 7b 0a 09 69 66 _dhparam() {..if
00e0: 20 5b 20 2d 78 20 22 60 77 68 69 63 68 20 6f 70 [ -x "`which op
00f0: 65 6e 73 73 6c 20 32 3e 2f 64 65 76 2f 6e 75 6c enssl 2>/dev/nul
0100: 6c 60 22 20 5d 3b 20 74 68 65 6e 0a 09 09 6f 5f l`" ]; then...o_
0110: 6f 75 74 70 75 74 3d 22 60 6f 70 65 6e 73 73 6c output="`openssl
0120: 20 64 68 70 61 72 61 6d 20 2d 43 20 22 24 40 22 dhparam -C "$@"
0130: 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 60 22 20 7c 2>/dev/null`" |
0140: 7c 20 72 65 74 75 72 6e 20 31 0a 09 09 6f 5f 6f | return 1...o_o
0150: 75 74 70 75 74 3d 22 60 65 63 68 6f 20 22 24 7b utput="`echo "${
0160: 6f 5f 6f 75 74 70 75 74 7d 22 20 7c 20 73 65 64 o_output}" | sed
0170: 20 27 73 2f 67 65 74 5f 64 68 5b 30 2d 39 5d 5c 's/get_dh[0-9]\
0180: 2b 2f 67 65 74 5f 64 68 50 61 72 61 6d 73 2f 27 +/get_dhParams/'
0190: 60 22 20 7c 7c 20 72 65 74 75 72 6e 20 31 0a 09 `" || return 1..
01a0: 09 6f 5f 6f 75 74 70 75 74 3d 22 60 65 63 68 6f .o_output="`echo
01b0: 20 22 24 7b 6f 5f 6f 75 74 70 75 74 7d 22 20 7c "${o_output}" |
01c0: 20 73 65 64 20 27 2f 5e 2d 2d 2d 2d 2d 42 45 47 sed '/^-----BEG
01d0: 49 4e 20 44 48 20 50 41 52 41 4d 45 54 45 52 53 IN DH PARAMETERS
01e0: 2d 2d 2d 2d 2d 24 2f 2c 2f 5e 2d 2d 2d 2d 2d 45 -----$/,/^-----E
01f0: 4e 44 20 44 48 20 50 41 52 41 4d 45 54 45 52 53 ND DH PARAMETERS
0200: 2d 2d 2d 2d 2d 24 2f 20 64 3b 2f 5e 23 2f 20 64 -----$/ d;/^#/ d
0210: 27 60 22 20 7c 7c 20 72 65 74 75 72 6e 20 31 0a '`" || return 1.
0220: 0a 09 09 65 63 68 6f 20 22 24 7b 6f 5f 6f 75 74 ...echo "${o_out
0230: 70 75 74 7d 22 0a 0a 09 09 72 65 74 75 72 6e 20 put}"....return
0240: 30 0a 09 66 69 0a 0a 09 72 65 74 75 72 6e 20 31 0..fi...return 1
0250: 0a 7d 0a 0a 67 65 6e 5f 64 68 5f 70 61 72 61 6d .}..gen_dh_param
0260: 73 5f 6f 70 65 6e 73 73 6c 28 29 20 7b 0a 09 6f s_openssl() {..o
0270: 70 65 6e 73 73 6c 5f 64 68 70 61 72 61 6d 20 22 penssl_dhparam "
0280: 24 7b 62 69 74 73 7d 22 20 3c 20 2f 64 65 76 2f ${bits}" < /dev/
0290: 6e 75 6c 6c 20 7c 7c 20 72 65 74 75 72 6e 20 31 null || return 1
02a0: 0a 09 72 65 74 75 72 6e 20 30 0a 7d 0a 0a 67 65 ..return 0.}..ge
02b0: 6e 5f 64 68 5f 70 61 72 61 6d 73 5f 72 65 6d 6f n_dh_params_remo
02c0: 74 65 28 29 20 7b 0a 09 75 72 6c 3d 22 68 74 74 te() {..url="htt
02d0: 70 73 3a 2f 2f 32 74 6f 6e 2e 63 6f 6d 2e 61 75 ps://2ton.com.au
02e0: 2f 64 68 70 61 72 61 6d 2f 24 7b 62 69 74 73 7d /dhparam/${bits}
02f0: 22 0a 0a 09 72 5f 69 6e 70 75 74 3d 22 60 63 75 "...r_input="`cu
0300: 72 6c 20 2d 73 53 20 22 24 7b 75 72 6c 7d 22 60 rl -sS "${url}"`
0310: 22 20 7c 7c 20 5c 0a 09 09 72 5f 69 6e 70 75 74 " || \...r_input
0320: 3d 22 60 77 67 65 74 20 2d 4f 20 2d 20 2d 6f 20 ="`wget -O - -o
0330: 2f 64 65 76 2f 6e 75 6c 6c 20 22 24 7b 75 72 6c /dev/null "${url
0340: 7d 22 60 22 20 7c 7c 20 72 65 74 75 72 6e 20 31 }"`" || return 1
0350: 0a 0a 09 69 66 20 72 5f 6f 75 74 70 75 74 3d 22 ...if r_output="
0360: 60 65 63 68 6f 20 22 24 7b 72 5f 69 6e 70 75 74 `echo "${r_input
0370: 7d 22 20 7c 20 6f 70 65 6e 73 73 6c 5f 64 68 70 }" | openssl_dhp
0380: 61 72 61 6d 60 22 3b 20 74 68 65 6e 0a 09 09 65 aram`"; then...e
0390: 63 68 6f 20 22 24 7b 72 5f 6f 75 74 70 75 74 7d cho "${r_output}
03a0: 22 0a 0a 09 09 72 65 74 75 72 6e 20 30 0a 09 66 "....return 0..f
03b0: 69 0a 0a 09 72 65 74 75 72 6e 20 31 0a 7d 0a 0a i...return 1.}..
03c0: 67 65 6e 5f 64 68 5f 70 61 72 61 6d 73 5f 66 61 gen_dh_params_fa
03d0: 6c 6c 62 61 63 6b 28 29 20 7b 0a 09 69 66 20 5b llback() {..if [
03e0: 20 22 24 7b 62 69 74 73 7d 22 20 3d 20 27 32 30 "${bits}" = '20
03f0: 34 38 27 20 5d 3b 20 74 68 65 6e 0a 09 09 63 61 48' ]; then...ca
0400: 74 20 3c 3c 20 5c 5f 45 4f 46 5f 0a 44 48 20 2a t << \_EOF_.DH *
0410: 67 65 74 5f 64 68 50 61 72 61 6d 73 28 76 6f 69 get_dhParams(voi
0420: 64 29 20 7b 0a 09 73 74 61 74 69 63 20 75 6e 73 d) {..static uns
0430: 69 67 6e 65 64 20 63 68 61 72 20 64 68 70 5f 32 igned char dhp_2
0440: 30 34 38 5b 5d 20 3d 20 7b 0a 09 09 30 78 43 31 048[] = {...0xC1
0450: 2c 30 78 35 31 2c 30 78 35 38 2c 30 78 36 39 2c ,0x51,0x58,0x69,
0460: 30 78 46 42 2c 30 78 45 38 2c 30 78 36 43 2c 30 0xFB,0xE8,0x6C,0
0470: 78 34 37 2c 30 78 32 42 2c 30 78 38 36 2c 30 78 x47,0x2B,0x86,0x
0480: 36 31 2c 30 78 34 46 2c 0a 09 09 30 78 32 30 2c 61,0x4F,...0x20,
0490: 30 78 32 45 2c 30 78 44 33 2c 30 78 46 43 2c 30 0x2E,0xD3,0xFC,0
04a0: 78 31 39 2c 30 78 45 45 2c 30 78 42 38 2c 30 78 x19,0xEE,0xB8,0x
04b0: 46 33 2c 30 78 33 35 2c 30 78 37 44 2c 30 78 42 F3,0x35,0x7D,0xB
04c0: 41 2c 30 78 38 36 2c 0a 09 09 30 78 32 41 2c 30 A,0x86,...0x2A,0
04d0: 78 43 33 2c 30 78 43 38 2c 30 78 36 45 2c 30 78 xC3,0xC8,0x6E,0x
04e0: 46 34 2c 30 78 39 39 2c 30 78 37 35 2c 30 78 36 F4,0x99,0x75,0x6
04f0: 35 2c 30 78 44 33 2c 30 78 37 41 2c 30 78 39 45 5,0xD3,0x7A,0x9E
0500: 2c 30 78 44 46 2c 0a 09 09 30 78 44 34 2c 30 78 ,0xDF,...0xD4,0x
0510: 31 46 2c 30 78 38 38 2c 30 78 45 33 2c 30 78 31 1F,0x88,0xE3,0x1
0520: 37 2c 30 78 46 43 2c 30 78 41 31 2c 30 78 45 44 7,0xFC,0xA1,0xED
0530: 2c 30 78 41 32 2c 30 78 42 36 2c 30 78 37 37 2c ,0xA2,0xB6,0x77,
0540: 30 78 38 34 2c 0a 09 09 30 78 41 41 2c 30 78 30 0x84,...0xAA,0x0
0550: 38 2c 30 78 46 32 2c 30 78 39 37 2c 30 78 35 39 8,0xF2,0x97,0x59
0560: 2c 30 78 37 41 2c 30 78 41 30 2c 30 78 30 33 2c ,0x7A,0xA0,0x03,
0570: 30 78 30 44 2c 30 78 33 45 2c 30 78 37 45 2c 30 0x0D,0x3E,0x7E,0
0580: 78 36 44 2c 0a 09 09 30 78 36 35 2c 30 78 36 41 x6D,...0x65,0x6A
0590: 2c 30 78 41 34 2c 30 78 45 41 2c 30 78 35 34 2c ,0xA4,0xEA,0x54,
05a0: 30 78 41 39 2c 30 78 35 32 2c 30 78 35 46 2c 30 0xA9,0x52,0x5F,0
05b0: 78 36 33 2c 30 78 42 34 2c 30 78 42 43 2c 30 78 x63,0xB4,0xBC,0x
05c0: 39 38 2c 0a 09 09 30 78 34 45 2c 30 78 46 36 2c 98,...0x4E,0xF6,
05d0: 30 78 45 31 2c 30 78 41 34 2c 30 78 45 45 2c 30 0xE1,0xA4,0xEE,0
05e0: 78 31 36 2c 30 78 30 41 2c 30 78 42 30 2c 30 78 x16,0x0A,0xB0,0x
05f0: 30 31 2c 30 78 42 44 2c 30 78 39 46 2c 30 78 41 01,0xBD,0x9F,0xA
0600: 31 2c 0a 09 09 30 78 45 38 2c 30 78 32 33 2c 30 1,...0xE8,0x23,0
0610: 78 32 39 2c 30 78 35 36 2c 30 78 34 30 2c 30 78 x29,0x56,0x40,0x
0620: 39 35 2c 30 78 31 33 2c 30 78 45 42 2c 30 78 43 95,0x13,0xEB,0xC
0630: 42 2c 30 78 44 35 2c 30 78 46 43 2c 30 78 37 36 B,0xD5,0xFC,0x76
0640: 2c 0a 09 09 30 78 31 41 2c 30 78 34 31 2c 30 78 ,...0x1A,0x41,0x
0650: 32 36 2c 30 78 43 45 2c 30 78 32 30 2c 30 78 45 26,0xCE,0x20,0xE
0660: 42 2c 30 78 33 30 2c 30 78 31 30 2c 30 78 31 37 B,0x30,0x10,0x17
0670: 2c 30 78 30 37 2c 30 78 45 31 2c 30 78 38 43 2c ,0x07,0xE1,0x8C,
0680: 0a 09 09 30 78 41 43 2c 30 78 35 37 2c 30 78 33 ...0xAC,0x57,0x3
0690: 37 2c 30 78 38 42 2c 30 78 45 38 2c 30 78 30 31 7,0x8B,0xE8,0x01
06a0: 2c 30 78 44 45 2c 30 78 41 39 2c 30 78 45 46 2c ,0xDE,0xA9,0xEF,
06b0: 30 78 41 34 2c 30 78 43 32 2c 30 78 41 34 2c 0a 0xA4,0xC2,0xA4,.
06c0: 09 09 30 78 36 45 2c 30 78 34 38 2c 30 78 32 35 ..0x6E,0x48,0x25
06d0: 2c 30 78 31 31 2c 30 78 33 33 2c 30 78 31 31 2c ,0x11,0x33,0x11,
06e0: 30 78 44 34 2c 30 78 35 32 2c 30 78 37 39 2c 30 0xD4,0x52,0x79,0
06f0: 78 38 37 2c 30 78 39 46 2c 30 78 37 35 2c 0a 09 x87,0x9F,0x75,..
0700: 09 30 78 36 31 2c 30 78 46 37 2c 30 78 39 43 2c .0x61,0xF7,0x9C,
0710: 30 78 37 44 2c 30 78 33 36 2c 30 78 34 31 2c 30 0x7D,0x36,0x41,0
0720: 78 43 42 2c 30 78 45 43 2c 30 78 38 46 2c 30 78 xCB,0xEC,0x8F,0x
0730: 45 41 2c 30 78 34 41 2c 30 78 34 37 2c 0a 09 09 EA,0x4A,0x47,...
0740: 30 78 36 41 2c 30 78 33 36 2c 30 78 33 37 2c 30 0x6A,0x36,0x37,0
0750: 78 37 35 2c 30 78 42 39 2c 30 78 38 45 2c 30 78 x75,0xB9,0x8E,0x
0760: 46 35 2c 30 78 35 46 2c 30 78 36 37 2c 30 78 43 F5,0x5F,0x67,0xC
0770: 46 2c 30 78 31 46 2c 30 78 44 38 2c 0a 09 09 30 F,0x1F,0xD8,...0
0780: 78 43 41 2c 30 78 37 30 2c 30 78 34 32 2c 30 78 xCA,0x70,0x42,0x
0790: 43 37 2c 30 78 41 32 2c 30 78 45 44 2c 30 78 30 C7,0xA2,0xED,0x0
07a0: 46 2c 30 78 37 44 2c 30 78 42 45 2c 30 78 34 33 F,0x7D,0xBE,0x43
07b0: 2c 30 78 30 38 2c 30 78 32 38 2c 0a 09 09 30 78 ,0x08,0x28,...0x
07c0: 36 36 2c 30 78 33 44 2c 30 78 44 44 2c 30 78 38 66,0x3D,0xDD,0x8
07d0: 37 2c 30 78 30 44 2c 30 78 36 31 2c 30 78 36 45 7,0x0D,0x61,0x6E
07e0: 2c 30 78 44 30 2c 30 78 45 37 2c 30 78 34 39 2c ,0xD0,0xE7,0x49,
07f0: 30 78 44 31 2c 30 78 37 30 2c 0a 09 09 30 78 41 0xD1,0x70,...0xA
0800: 39 2c 30 78 34 44 2c 30 78 44 35 2c 30 78 46 44 9,0x4D,0xD5,0xFD
0810: 2c 30 78 45 44 2c 30 78 46 32 2c 30 78 36 44 2c ,0xED,0xF2,0x6D,
0820: 30 78 33 32 2c 30 78 31 37 2c 30 78 39 37 2c 30 0x32,0x17,0x97,0
0830: 78 35 42 2c 30 78 30 36 2c 0a 09 09 30 78 36 30 x5B,0x06,...0x60
0840: 2c 30 78 39 43 2c 30 78 35 46 2c 30 78 41 33 2c ,0x9C,0x5F,0xA3,
0850: 30 78 35 44 2c 30 78 33 34 2c 30 78 31 34 2c 30 0x5D,0x34,0x14,0
0860: 78 37 45 2c 30 78 36 33 2c 30 78 35 34 2c 30 78 x7E,0x63,0x54,0x
0870: 45 34 2c 30 78 37 45 2c 0a 09 09 30 78 30 39 2c E4,0x7E,...0x09,
0880: 30 78 38 46 2c 30 78 42 42 2c 30 78 38 45 2c 30 0x8F,0xBB,0x8E,0
0890: 78 41 30 2c 30 78 44 30 2c 30 78 39 36 2c 30 78 xA0,0xD0,0x96,0x
08a0: 41 43 2c 30 78 33 30 2c 30 78 32 30 2c 30 78 33 AC,0x30,0x20,0x3
08b0: 39 2c 30 78 33 42 2c 0a 09 09 30 78 38 43 2c 30 9,0x3B,...0x8C,0
08c0: 78 39 32 2c 30 78 36 35 2c 30 78 33 37 2c 30 78 x92,0x65,0x37,0x
08d0: 30 41 2c 30 78 38 46 2c 30 78 45 43 2c 30 78 37 0A,0x8F,0xEC,0x7
08e0: 32 2c 30 78 38 42 2c 30 78 36 31 2c 30 78 37 44 2,0x8B,0x61,0x7D
08f0: 2c 30 78 36 32 2c 0a 09 09 30 78 32 34 2c 30 78 ,0x62,...0x24,0x
0900: 35 34 2c 30 78 45 39 2c 30 78 31 44 2c 30 78 30 54,0xE9,0x1D,0x0
0910: 31 2c 30 78 36 38 2c 30 78 38 39 2c 30 78 43 34 1,0x68,0x89,0xC4
0920: 2c 30 78 37 42 2c 30 78 33 43 2c 30 78 34 38 2c ,0x7B,0x3C,0x48,
0930: 30 78 36 32 2c 0a 09 09 30 78 39 42 2c 30 78 38 0x62,...0x9B,0x8
0940: 33 2c 30 78 31 31 2c 30 78 33 41 2c 30 78 30 42 3,0x11,0x3A,0x0B
0950: 2c 30 78 30 44 2c 30 78 45 46 2c 30 78 35 41 2c ,0x0D,0xEF,0x5A,
0960: 30 78 45 34 2c 30 78 37 41 2c 30 78 41 30 2c 30 0xE4,0x7A,0xA0,0
0970: 78 36 39 2c 0a 09 09 30 78 46 34 2c 30 78 35 34 x69,...0xF4,0x54
0980: 2c 30 78 42 35 2c 30 78 35 42 2c 0a 09 7d 3b 0a ,0xB5,0x5B,..};.
0990: 09 73 74 61 74 69 63 20 75 6e 73 69 67 6e 65 64 .static unsigned
09a0: 20 63 68 61 72 20 64 68 67 5f 32 30 34 38 5b 5d char dhg_2048[]
09b0: 20 3d 20 7b 0a 09 09 30 78 30 32 2c 0a 09 7d 3b = {...0x02,..};
09c0: 0a 0a 09 44 48 20 2a 64 68 20 3d 20 44 48 5f 6e ...DH *dh = DH_n
09d0: 65 77 28 29 3b 3b 0a 09 42 49 47 4e 55 4d 20 2a ew();;..BIGNUM *
09e0: 64 68 70 5f 62 6e 2c 20 2a 64 68 67 5f 62 6e 3b dhp_bn, *dhg_bn;
09f0: 0a 0a 09 69 66 20 28 64 68 20 3d 3d 20 4e 55 4c ...if (dh == NUL
0a00: 4c 29 20 7b 0a 09 09 72 65 74 75 72 6e 20 4e 55 L) {...return NU
0a10: 4c 4c 3b 0a 09 7d 0a 0a 09 64 68 70 5f 62 6e 20 LL;..}...dhp_bn
0a20: 3d 20 42 4e 5f 62 69 6e 32 62 6e 28 64 68 70 5f = BN_bin2bn(dhp_
0a30: 32 30 34 38 2c 20 73 69 7a 65 6f 66 20 28 64 68 2048, sizeof (dh
0a40: 70 5f 32 30 34 38 29 2c 20 4e 55 4c 4c 29 3b 0a p_2048), NULL);.
0a50: 09 64 68 67 5f 62 6e 20 3d 20 42 4e 5f 62 69 6e .dhg_bn = BN_bin
0a60: 32 62 6e 28 64 68 67 5f 32 30 34 38 2c 20 73 69 2bn(dhg_2048, si
0a70: 7a 65 6f 66 20 28 64 68 67 5f 32 30 34 38 29 2c zeof (dhg_2048),
0a80: 20 4e 55 4c 4c 29 3b 0a 0a 23 69 66 64 65 66 20 NULL);..#ifdef
0a90: 54 43 4c 54 4c 53 5f 4f 50 45 4e 53 53 4c 5f 50 TCLTLS_OPENSSL_P
0aa0: 52 45 5f 31 5f 31 5f 41 50 49 0a 09 64 68 2d 3e RE_1_1_API..dh->
0ab0: 70 20 3d 20 64 68 70 5f 62 6e 3b 0a 09 64 68 2d p = dhp_bn;..dh-
0ac0: 3e 67 20 3d 20 64 68 67 5f 62 6e 3b 0a 0a 09 69 >g = dhg_bn;...i
0ad0: 66 20 28 64 68 70 5f 62 6e 20 3d 3d 20 4e 55 4c f (dhp_bn == NUL
0ae0: 4c 20 7c 7c 20 64 68 67 5f 62 6e 20 3d 3d 20 4e L || dhg_bn == N
0af0: 55 4c 4c 29 20 7b 0a 23 65 6c 73 65 0a 09 69 66 ULL) {.#else..if
0b00: 20 28 64 68 70 5f 62 6e 20 3d 3d 20 4e 55 4c 4c (dhp_bn == NULL
0b10: 20 7c 7c 20 64 68 67 5f 62 6e 20 3d 3d 20 4e 55 || dhg_bn == NU
0b20: 4c 4c 20 7c 7c 20 21 44 48 5f 73 65 74 30 5f 70 LL || !DH_set0_p
0b30: 71 67 28 64 68 2c 20 64 68 70 5f 62 6e 2c 20 4e qg(dh, dhp_bn, N
0b40: 55 4c 4c 2c 20 64 68 67 5f 62 6e 29 29 20 7b 0a ULL, dhg_bn)) {.
0b50: 23 65 6e 64 69 66 0a 09 09 44 48 5f 66 72 65 65 #endif...DH_free
0b60: 28 64 68 29 3b 0a 09 09 42 4e 5f 66 72 65 65 28 (dh);...BN_free(
0b70: 64 68 70 5f 62 6e 29 3b 0a 09 09 42 4e 5f 66 72 dhp_bn);...BN_fr
0b80: 65 65 28 64 68 67 5f 62 6e 29 3b 0a 09 09 72 65 ee(dhg_bn);...re
0b90: 74 75 72 6e 28 4e 55 4c 4c 29 3b 0a 09 7d 0a 0a turn(NULL);..}..
0ba0: 09 72 65 74 75 72 6e 28 64 68 29 3b 0a 7d 0a 5f .return(dh);.}._
0bb0: 45 4f 46 5f 0a 0a 09 09 72 65 74 75 72 6e 20 30 EOF_....return 0
0bc0: 0a 09 66 69 0a 0a 09 72 65 74 75 72 6e 20 31 0a ..fi...return 1.
0bd0: 7d 0a 0a 23 20 45 6e 61 62 6c 65 20 73 75 70 70 }..# Enable supp
0be0: 6f 72 74 20 66 6f 72 20 67 69 76 69 6e 67 20 74 ort for giving t
0bf0: 68 65 20 73 61 6d 65 20 44 48 20 70 61 72 61 6d he same DH param
0c00: 73 20 65 61 63 68 20 74 69 6d 65 0a 69 66 20 5b s each time.if [
0c10: 20 22 24 7b 6f 70 74 69 6f 6e 5f 66 61 6c 6c 62 "${option_fallb
0c20: 61 63 6b 7d 22 20 3d 20 27 31 27 20 5d 3b 20 74 ack}" = '1' ]; t
0c30: 68 65 6e 0a 09 67 65 6e 5f 64 68 5f 70 61 72 61 hen..gen_dh_para
0c40: 6d 73 5f 66 61 6c 6c 62 61 63 6b 20 26 26 20 65 ms_fallback && e
0c50: 78 69 74 20 30 0a 0a 09 65 63 68 6f 20 22 55 6e xit 0...echo "Un
0c60: 61 62 6c 65 20 74 6f 20 67 65 6e 65 72 61 74 65 able to generate
0c70: 20 66 61 6c 6c 62 61 63 6b 20 70 61 72 61 6d 65 fallback parame
0c80: 74 65 72 73 20 66 6f 72 20 44 48 20 6f 66 20 24 ters for DH of $
0c90: 7b 62 69 74 73 7d 20 62 69 74 73 22 20 3e 26 32 {bits} bits" >&2
0ca0: 0a 0a 09 65 78 69 74 20 31 0a 66 69 0a 0a 65 63 ...exit 1.fi..ec
0cb0: 68 6f 20 22 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ho "************
0cc0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0cd0: 2a 22 20 3e 26 32 0a 65 63 68 6f 20 22 2a 2a 20 *" >&2.echo "**
0ce0: 47 65 6e 65 72 61 74 69 6e 67 20 44 48 20 50 72 Generating DH Pr
0cf0: 69 6d 65 73 2e 20 20 20 2a 2a 22 20 3e 26 32 0a imes. **" >&2.
0d00: 65 63 68 6f 20 22 2a 2a 20 54 68 69 73 20 77 69 echo "** This wi
0d10: 6c 6c 20 74 61 6b 65 20 61 20 77 68 69 6c 65 2e ll take a while.
0d20: 20 2a 2a 22 20 3e 26 32 0a 65 63 68 6f 20 22 2a **" >&2.echo "*
0d30: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0d40: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 22 20 3e 26 ************" >&
0d50: 32 0a 67 65 6e 5f 64 68 5f 70 61 72 61 6d 73 5f 2.gen_dh_params_
0d60: 6f 70 65 6e 73 73 6c 20 26 26 20 65 78 69 74 20 openssl && exit
0d70: 30 0a 67 65 6e 5f 64 68 5f 70 61 72 61 6d 73 5f 0.gen_dh_params_
0d80: 72 65 6d 6f 74 65 20 26 26 20 65 78 69 74 20 30 remote && exit 0
0d90: 0a 67 65 6e 5f 64 68 5f 70 61 72 61 6d 73 5f 66 .gen_dh_params_f
0da0: 61 6c 6c 62 61 63 6b 20 26 26 20 65 78 69 74 20 allback && exit
0db0: 30 0a 0a 65 63 68 6f 20 22 55 6e 61 62 6c 65 20 0..echo "Unable
0dc0: 74 6f 20 67 65 6e 65 72 61 74 65 20 70 61 72 61 to generate para
0dd0: 6d 65 74 65 72 73 20 66 6f 72 20 44 48 20 6f 66 meters for DH of
0de0: 20 24 7b 62 69 74 73 7d 20 62 69 74 73 22 20 3e ${bits} bits" >
0df0: 26 32 0a 0a 65 78 69 74 20 31 0a &2..exit 1.