summaryrefslogtreecommitdiff
path: root/dh.c
diff options
context:
space:
mode:
Diffstat (limited to 'dh.c')
-rw-r--r--dh.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/dh.c b/dh.c
index afd1e05d0..044d869fb 100644
--- a/dh.c
+++ b/dh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: dh.c,v 1.29 2004/02/27 22:49:27 dtucker Exp $"); 26RCSID("$OpenBSD: dh.c,v 1.31 2004/08/04 10:37:52 djm Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29 29
@@ -115,8 +115,9 @@ choose_dh(int min, int wantbits, int max)
115 115
116 if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL && 116 if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL &&
117 (f = fopen(_PATH_DH_PRIMES, "r")) == NULL) { 117 (f = fopen(_PATH_DH_PRIMES, "r")) == NULL) {
118 logit("WARNING: %s does not exist, using old modulus", _PATH_DH_MODULI); 118 logit("WARNING: %s does not exist, using fixed modulus",
119 return (dh_new_group1()); 119 _PATH_DH_MODULI);
120 return (dh_new_group14());
120 } 121 }
121 122
122 linenum = 0; 123 linenum = 0;
@@ -144,7 +145,7 @@ choose_dh(int min, int wantbits, int max)
144 if (bestcount == 0) { 145 if (bestcount == 0) {
145 fclose(f); 146 fclose(f);
146 logit("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); 147 logit("WARNING: no suitable primes in %s", _PATH_DH_PRIMES);
147 return (NULL); 148 return (dh_new_group14());
148 } 149 }
149 150
150 linenum = 0; 151 linenum = 0;
@@ -169,7 +170,7 @@ choose_dh(int min, int wantbits, int max)
169 return (dh_new_group(dhg.g, dhg.p)); 170 return (dh_new_group(dhg.g, dhg.p));
170} 171}
171 172
172/* diffie-hellman-group1-sha1 */ 173/* diffie-hellman-groupN-sha1 */
173 174
174int 175int
175dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) 176dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
@@ -272,6 +273,25 @@ dh_new_group1(void)
272 return (dh_new_group_asc(gen, group1)); 273 return (dh_new_group_asc(gen, group1));
273} 274}
274 275
276DH *
277dh_new_group14(void)
278{
279 static char *gen = "2", *group14 =
280 "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1"
281 "29024E08" "8A67CC74" "020BBEA6" "3B139B22" "514A0879" "8E3404DD"
282 "EF9519B3" "CD3A431B" "302B0A6D" "F25F1437" "4FE1356D" "6D51C245"
283 "E485B576" "625E7EC6" "F44C42E9" "A637ED6B" "0BFF5CB6" "F406B7ED"
284 "EE386BFB" "5A899FA5" "AE9F2411" "7C4B1FE6" "49286651" "ECE45B3D"
285 "C2007CB8" "A163BF05" "98DA4836" "1C55D39A" "69163FA8" "FD24CF5F"
286 "83655D23" "DCA3AD96" "1C62F356" "208552BB" "9ED52907" "7096966D"
287 "670C354E" "4ABC9804" "F1746C08" "CA18217C" "32905E46" "2E36CE3B"
288 "E39E772C" "180E8603" "9B2783A2" "EC07A28F" "B5C55DF0" "6F4C52C9"
289 "DE2BCBF6" "95581718" "3995497C" "EA956AE5" "15D22618" "98FA0510"
290 "15728E5A" "8AACAA68" "FFFFFFFF" "FFFFFFFF";
291
292 return (dh_new_group_asc(gen, group14));
293}
294
275/* 295/*
276 * Estimates the group order for a Diffie-Hellman group that has an 296 * Estimates the group order for a Diffie-Hellman group that has an
277 * attack complexity approximately the same as O(2**bits). Estimate 297 * attack complexity approximately the same as O(2**bits). Estimate