upstream commit

Remove fallback from moduli to "primes" file that was
 deprecated in 2001 and fix log messages referring to primes file.  Based on
 patch from xnox at ubuntu.com via bz#2559.  "kill it" deraadt@

Upstream-ID: 0d4f8c70e2fa7431a83b95f8ca81033147ba8713
This commit is contained in:
dtucker@openbsd.org 2016-03-31 05:24:06 +00:00 committed by Damien Miller
parent 0235a5fa67
commit fdfbf4580d
2 changed files with 8 additions and 10 deletions

14
dh.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: dh.c,v 1.58 2016/02/28 22:27:00 djm Exp $ */ /* $OpenBSD: dh.c,v 1.59 2016/03/31 05:24:06 dtucker Exp $ */
/* /*
* Copyright (c) 2000 Niels Provos. All rights reserved. * Copyright (c) 2000 Niels Provos. All rights reserved.
* *
@ -30,6 +30,7 @@
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/dh.h> #include <openssl/dh.h>
#include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -151,10 +152,9 @@ choose_dh(int min, int wantbits, int max)
int linenum; int linenum;
struct dhgroup dhg; struct dhgroup dhg;
if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL && if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL) {
(f = fopen(_PATH_DH_PRIMES, "r")) == NULL) { logit("WARNING: could open open %s (%s), using fixed modulus",
logit("WARNING: %s does not exist, using fixed modulus", _PATH_DH_MODULI, strerror(errno));
_PATH_DH_MODULI);
return (dh_new_group_fallback(max)); return (dh_new_group_fallback(max));
} }
@ -182,7 +182,7 @@ choose_dh(int min, int wantbits, int max)
if (bestcount == 0) { if (bestcount == 0) {
fclose(f); fclose(f);
logit("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); logit("WARNING: no suitable primes in %s", _PATH_DH_MODULI);
return (dh_new_group_fallback(max)); return (dh_new_group_fallback(max));
} }
@ -203,7 +203,7 @@ choose_dh(int min, int wantbits, int max)
fclose(f); fclose(f);
if (linenum != which+1) { if (linenum != which+1) {
logit("WARNING: line %d disappeared in %s, giving up", logit("WARNING: line %d disappeared in %s, giving up",
which, _PATH_DH_PRIMES); which, _PATH_DH_MODULI);
return (dh_new_group_fallback(max)); return (dh_new_group_fallback(max));
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pathnames.h,v 1.24 2013/12/06 13:39:49 markus Exp $ */ /* $OpenBSD: pathnames.h,v 1.25 2016/03/31 05:24:06 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -42,8 +42,6 @@
#define _PATH_HOST_ED25519_KEY_FILE SSHDIR "/ssh_host_ed25519_key" #define _PATH_HOST_ED25519_KEY_FILE SSHDIR "/ssh_host_ed25519_key"
#define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key" #define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key"
#define _PATH_DH_MODULI SSHDIR "/moduli" #define _PATH_DH_MODULI SSHDIR "/moduli"
/* Backwards compatibility */
#define _PATH_DH_PRIMES SSHDIR "/primes"
#ifndef _PATH_SSH_PROGRAM #ifndef _PATH_SSH_PROGRAM
#define _PATH_SSH_PROGRAM "/usr/bin/ssh" #define _PATH_SSH_PROGRAM "/usr/bin/ssh"