Do not allow negotiation of unknown primes with DG GEX in FIPS mode

This commit is contained in:
Jakub Jelen 2019-03-11 17:17:13 +01:00
parent c53a1d4e90
commit 81a703d751

View File

@ -1,6 +1,6 @@
diff -up openssh-7.7p1/cipher.c.fips openssh-7.7p1/cipher.c diff -up openssh-7.9p1/cipher.c.fips openssh-7.9p1/cipher.c
--- openssh-7.7p1/cipher.c.fips 2018-08-08 10:08:40.814719906 +0200 --- openssh-7.9p1/cipher.c.fips 2019-03-11 17:06:37.614877975 +0100
+++ openssh-7.7p1/cipher.c 2018-08-08 10:08:40.821719965 +0200 +++ openssh-7.9p1/cipher.c 2019-03-11 17:06:37.620878031 +0100
@@ -39,6 +39,8 @@ @@ -39,6 +39,8 @@
#include <sys/types.h> #include <sys/types.h>
@ -10,7 +10,7 @@ diff -up openssh-7.7p1/cipher.c.fips openssh-7.7p1/cipher.c
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@@ -90,6 +92,33 @@ static const struct sshcipher ciphers[] @@ -92,6 +94,33 @@ static const struct sshcipher ciphers[]
{ NULL, 0, 0, 0, 0, 0, NULL } { NULL, 0, 0, 0, 0, 0, NULL }
}; };
@ -44,7 +44,7 @@ diff -up openssh-7.7p1/cipher.c.fips openssh-7.7p1/cipher.c
/*--*/ /*--*/
/* Returns a comma-separated list of supported ciphers. */ /* Returns a comma-separated list of supported ciphers. */
@@ -100,7 +129,7 @@ cipher_alg_list(char sep, int auth_only) @@ -102,7 +131,7 @@ cipher_alg_list(char sep, int auth_only)
size_t nlen, rlen = 0; size_t nlen, rlen = 0;
const struct sshcipher *c; const struct sshcipher *c;
@ -53,7 +53,7 @@ diff -up openssh-7.7p1/cipher.c.fips openssh-7.7p1/cipher.c
if ((c->flags & CFLAG_INTERNAL) != 0) if ((c->flags & CFLAG_INTERNAL) != 0)
continue; continue;
if (auth_only && c->auth_len == 0) if (auth_only && c->auth_len == 0)
@@ -172,7 +201,7 @@ const struct sshcipher * @@ -174,7 +203,7 @@ const struct sshcipher *
cipher_by_name(const char *name) cipher_by_name(const char *name)
{ {
const struct sshcipher *c; const struct sshcipher *c;
@ -62,9 +62,9 @@ diff -up openssh-7.7p1/cipher.c.fips openssh-7.7p1/cipher.c
if (strcmp(c->name, name) == 0) if (strcmp(c->name, name) == 0)
return c; return c;
return NULL; return NULL;
diff -up openssh-7.7p1/cipher-ctr.c.fips openssh-7.7p1/cipher-ctr.c diff -up openssh-7.9p1/cipher-ctr.c.fips openssh-7.9p1/cipher-ctr.c
--- openssh-7.7p1/cipher-ctr.c.fips 2018-08-08 10:08:40.709719021 +0200 --- openssh-7.9p1/cipher-ctr.c.fips 2019-03-11 17:06:37.519877082 +0100
+++ openssh-7.7p1/cipher-ctr.c 2018-08-08 10:08:40.821719965 +0200 +++ openssh-7.9p1/cipher-ctr.c 2019-03-11 17:06:37.620878031 +0100
@@ -179,7 +179,8 @@ evp_aes_128_ctr(void) @@ -179,7 +179,8 @@ evp_aes_128_ctr(void)
aes_ctr.do_cipher = ssh_aes_ctr; aes_ctr.do_cipher = ssh_aes_ctr;
#ifndef SSH_OLD_EVP #ifndef SSH_OLD_EVP
@ -75,10 +75,10 @@ diff -up openssh-7.7p1/cipher-ctr.c.fips openssh-7.7p1/cipher-ctr.c
#endif #endif
return (&aes_ctr); return (&aes_ctr);
} }
diff -up openssh-7.7p1/clientloop.c.fips openssh-7.7p1/clientloop.c diff -up openssh-7.9p1/clientloop.c.fips openssh-7.9p1/clientloop.c
--- openssh-7.7p1/clientloop.c.fips 2018-08-08 10:08:40.769719527 +0200 --- openssh-7.9p1/clientloop.c.fips 2019-03-11 17:06:37.523877120 +0100
+++ openssh-7.7p1/clientloop.c 2018-08-08 10:08:40.822719973 +0200 +++ openssh-7.9p1/clientloop.c 2019-03-11 17:06:37.620878031 +0100
@@ -1978,7 +1978,8 @@ key_accepted_by_hostkeyalgs(const struct @@ -2014,7 +2014,8 @@ key_accepted_by_hostkeyalgs(const struct
{ {
const char *ktype = sshkey_ssh_name(key); const char *ktype = sshkey_ssh_name(key);
const char *hostkeyalgs = options.hostkeyalgorithms != NULL ? const char *hostkeyalgs = options.hostkeyalgorithms != NULL ?
@ -88,10 +88,73 @@ diff -up openssh-7.7p1/clientloop.c.fips openssh-7.7p1/clientloop.c
if (key == NULL || key->type == KEY_UNSPEC) if (key == NULL || key->type == KEY_UNSPEC)
return 0; return 0;
diff -up openssh-7.7p1/dh.h.fips openssh-7.7p1/dh.h diff -up openssh-7.9p1/dh.c.fips openssh-7.9p1/dh.c
--- openssh-7.7p1/dh.h.fips 2018-04-02 07:38:28.000000000 +0200 --- openssh-7.9p1/dh.c.fips 2018-10-17 02:01:20.000000000 +0200
+++ openssh-7.7p1/dh.h 2018-08-08 10:08:40.822719973 +0200 +++ openssh-7.9p1/dh.c 2019-03-11 17:08:11.769763057 +0100
@@ -51,6 +51,7 @@ u_int dh_estimate(int); @@ -152,6 +152,12 @@ choose_dh(int min, int wantbits, int max
int best, bestcount, which, linenum;
struct dhgroup dhg;
+ if (FIPS_mode()) {
+ logit("Using arbitrary primes is not allowed in FIPS mode."
+ " Falling back to known groups.");
+ return (dh_new_group_fallback(max));
+ }
+
if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL) {
logit("WARNING: could not open %s (%s), using fixed modulus",
_PATH_DH_MODULI, strerror(errno));
@@ -489,4 +495,38 @@ dh_estimate(int bits)
return 8192;
}
+/*
+ * Compares the received DH parameters with known-good groups,
+ * which might be either from group14, group16 or group18.
+ */
+int
+dh_is_known_group(const DH *dh)
+{
+ const BIGNUM *p, *g;
+ const BIGNUM *known_p, *known_g;
+ DH *known = NULL;
+ int bits = 0, rv = 0;
+
+ DH_get0_pqg(dh, &p, NULL, &g);
+ bits = BN_num_bits(p);
+
+ if (bits <= 3072) {
+ known = dh_new_group14();
+ } else if (bits <= 6144) {
+ known = dh_new_group16();
+ } else {
+ known = dh_new_group18();
+ }
+
+ DH_get0_pqg(known, &known_p, NULL, &known_g);
+
+ if (BN_cmp(g, known_g) == 0 &&
+ BN_cmp(p, known_p) == 0) {
+ rv = 1;
+ }
+
+ DH_free(known);
+ return rv;
+}
+
#endif /* WITH_OPENSSL */
diff -up openssh-7.9p1/dh.h.fips openssh-7.9p1/dh.h
--- openssh-7.9p1/dh.h.fips 2018-10-17 02:01:20.000000000 +0200
+++ openssh-7.9p1/dh.h 2019-03-11 17:08:18.718828381 +0100
@@ -43,6 +43,7 @@ DH *dh_new_group_fallback(int);
int dh_gen_key(DH *, int);
int dh_pub_is_valid(const DH *, const BIGNUM *);
+int dh_is_known_group(const DH *);
u_int dh_estimate(int);
@@ -51,6 +52,7 @@ u_int dh_estimate(int);
* Miniumum increased in light of DH precomputation attacks. * Miniumum increased in light of DH precomputation attacks.
*/ */
#define DH_GRP_MIN 2048 #define DH_GRP_MIN 2048
@ -99,10 +162,10 @@ diff -up openssh-7.7p1/dh.h.fips openssh-7.7p1/dh.h
#define DH_GRP_MAX 8192 #define DH_GRP_MAX 8192
/* /*
diff -up openssh-7.7p1/entropy.c.fips openssh-7.7p1/entropy.c diff -up openssh-7.9p1/entropy.c.fips openssh-7.9p1/entropy.c
--- openssh-7.7p1/entropy.c.fips 2018-08-08 10:08:40.698718928 +0200 --- openssh-7.9p1/entropy.c.fips 2018-10-17 02:01:20.000000000 +0200
+++ openssh-7.7p1/entropy.c 2018-08-08 10:08:40.822719973 +0200 +++ openssh-7.9p1/entropy.c 2019-03-11 17:06:37.621878041 +0100
@@ -217,6 +217,11 @@ seed_rng(void) @@ -223,6 +223,11 @@ seed_rng(void)
fatal("OpenSSL version mismatch. Built against %lx, you " fatal("OpenSSL version mismatch. Built against %lx, you "
"have %lx", (u_long)OPENSSL_VERSION_NUMBER, SSLeay()); "have %lx", (u_long)OPENSSL_VERSION_NUMBER, SSLeay());
@ -114,9 +177,9 @@ diff -up openssh-7.7p1/entropy.c.fips openssh-7.7p1/entropy.c
#ifndef OPENSSL_PRNG_ONLY #ifndef OPENSSL_PRNG_ONLY
if (RAND_status() == 1) { if (RAND_status() == 1) {
debug3("RNG is ready, skipping seeding"); debug3("RNG is ready, skipping seeding");
diff -up openssh-7.7p1/kex.c.fips openssh-7.7p1/kex.c diff -up openssh-7.9p1/kex.c.fips openssh-7.9p1/kex.c
--- openssh-7.7p1/kex.c.fips 2018-08-08 10:08:40.815719915 +0200 --- openssh-7.9p1/kex.c.fips 2019-03-11 17:06:37.614877975 +0100
+++ openssh-7.7p1/kex.c 2018-08-08 10:11:24.109081924 +0200 +++ openssh-7.9p1/kex.c 2019-03-11 17:06:37.621878041 +0100
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
#include <openssl/crypto.h> #include <openssl/crypto.h>
@ -182,9 +245,9 @@ diff -up openssh-7.7p1/kex.c.fips openssh-7.7p1/kex.c
free(s); free(s);
return 0; return 0;
} }
diff -up openssh-7.7p1/kexgexc.c.fips openssh-7.7p1/kexgexc.c diff -up openssh-7.9p1/kexgexc.c.fips openssh-7.9p1/kexgexc.c
--- openssh-7.7p1/kexgexc.c.fips 2018-04-02 07:38:28.000000000 +0200 --- openssh-7.9p1/kexgexc.c.fips 2018-10-17 02:01:20.000000000 +0200
+++ openssh-7.7p1/kexgexc.c 2018-08-08 10:08:40.822719973 +0200 +++ openssh-7.9p1/kexgexc.c 2019-03-11 17:06:37.621878041 +0100
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
@ -193,7 +256,7 @@ diff -up openssh-7.7p1/kexgexc.c.fips openssh-7.7p1/kexgexc.c
#include <sys/types.h> #include <sys/types.h>
#include <openssl/dh.h> #include <openssl/dh.h>
@@ -63,7 +64,7 @@ kexgex_client(struct ssh *ssh) @@ -65,7 +66,7 @@ kexgex_client(struct ssh *ssh)
nbits = dh_estimate(kex->dh_need * 8); nbits = dh_estimate(kex->dh_need * 8);
@ -202,10 +265,21 @@ diff -up openssh-7.7p1/kexgexc.c.fips openssh-7.7p1/kexgexc.c
kex->max = DH_GRP_MAX; kex->max = DH_GRP_MAX;
kex->nbits = nbits; kex->nbits = nbits;
if (datafellows & SSH_BUG_DHGEX_LARGE) if (datafellows & SSH_BUG_DHGEX_LARGE)
diff -up openssh-7.7p1/kexgexs.c.fips openssh-7.7p1/kexgexs.c @@ -118,6 +119,10 @@ input_kex_dh_gex_group(int type, u_int32
--- openssh-7.7p1/kexgexs.c.fips 2018-04-02 07:38:28.000000000 +0200 r = SSH_ERR_ALLOC_FAIL;
+++ openssh-7.7p1/kexgexs.c 2018-08-08 10:08:40.823719982 +0200 goto out;
@@ -82,9 +82,9 @@ input_kex_dh_gex_request(int type, u_int }
+ if (FIPS_mode() && dh_is_known_group(kex->dh) == 0) {
+ r = SSH_ERR_INVALID_ARGUMENT;
+ goto out;
+ }
p = g = NULL; /* belong to kex->dh now */
/* generate and send 'e', client DH public key */
diff -up openssh-7.9p1/kexgexs.c.fips openssh-7.9p1/kexgexs.c
--- openssh-7.9p1/kexgexs.c.fips 2018-10-17 02:01:20.000000000 +0200
+++ openssh-7.9p1/kexgexs.c 2019-03-11 17:06:37.621878041 +0100
@@ -85,9 +85,9 @@ input_kex_dh_gex_request(int type, u_int
kex->nbits = nbits; kex->nbits = nbits;
kex->min = min; kex->min = min;
kex->max = max; kex->max = max;
@ -217,9 +291,9 @@ diff -up openssh-7.7p1/kexgexs.c.fips openssh-7.7p1/kexgexs.c
nbits = MINIMUM(DH_GRP_MAX, nbits); nbits = MINIMUM(DH_GRP_MAX, nbits);
if (kex->max < kex->min || kex->nbits < kex->min || if (kex->max < kex->min || kex->nbits < kex->min ||
diff -up openssh-7.7p1/mac.c.fips openssh-7.7p1/mac.c diff -up openssh-7.9p1/mac.c.fips openssh-7.9p1/mac.c
--- openssh-7.7p1/mac.c.fips 2018-08-08 10:08:40.815719915 +0200 --- openssh-7.9p1/mac.c.fips 2019-03-11 17:06:37.614877975 +0100
+++ openssh-7.7p1/mac.c 2018-08-08 10:11:56.915352642 +0200 +++ openssh-7.9p1/mac.c 2019-03-11 17:06:37.621878041 +0100
@@ -27,6 +27,8 @@ @@ -27,6 +27,8 @@
#include <sys/types.h> #include <sys/types.h>
@ -281,9 +355,9 @@ diff -up openssh-7.7p1/mac.c.fips openssh-7.7p1/mac.c
if (strcmp(name, m->name) != 0) if (strcmp(name, m->name) != 0)
continue; continue;
if (mac != NULL) if (mac != NULL)
diff -up openssh-7.7p1/Makefile.in.fips openssh-7.7p1/Makefile.in diff -up openssh-7.9p1/Makefile.in.fips openssh-7.9p1/Makefile.in
--- openssh-7.7p1/Makefile.in.fips 2018-08-08 10:08:40.815719915 +0200 --- openssh-7.9p1/Makefile.in.fips 2019-03-11 17:06:37.615877984 +0100
+++ openssh-7.7p1/Makefile.in 2018-08-08 10:08:40.823719982 +0200 +++ openssh-7.9p1/Makefile.in 2019-03-11 17:06:37.621878041 +0100
@@ -179,25 +179,25 @@ libssh.a: $(LIBSSH_OBJS) @@ -179,25 +179,25 @@ libssh.a: $(LIBSSH_OBJS)
$(RANLIB) $@ $(RANLIB) $@
@ -325,10 +399,10 @@ diff -up openssh-7.7p1/Makefile.in.fips openssh-7.7p1/Makefile.in
sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o
$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
diff -up openssh-7.7p1/myproposal.h.fips openssh-7.7p1/myproposal.h diff -up openssh-7.9p1/myproposal.h.fips openssh-7.9p1/myproposal.h
--- openssh-7.7p1/myproposal.h.fips 2018-04-02 07:38:28.000000000 +0200 --- openssh-7.9p1/myproposal.h.fips 2018-10-17 02:01:20.000000000 +0200
+++ openssh-7.7p1/myproposal.h 2018-08-08 10:08:40.823719982 +0200 +++ openssh-7.9p1/myproposal.h 2019-03-11 17:06:37.621878041 +0100
@@ -114,6 +114,14 @@ @@ -116,6 +116,14 @@
"rsa-sha2-256," \ "rsa-sha2-256," \
"ssh-rsa" "ssh-rsa"
@ -343,7 +417,7 @@ diff -up openssh-7.7p1/myproposal.h.fips openssh-7.7p1/myproposal.h
/* the actual algorithms */ /* the actual algorithms */
#define KEX_SERVER_ENCRYPT \ #define KEX_SERVER_ENCRYPT \
@@ -137,6 +145,38 @@ @@ -139,6 +147,38 @@
#define KEX_CLIENT_MAC KEX_SERVER_MAC #define KEX_CLIENT_MAC KEX_SERVER_MAC
@ -382,10 +456,10 @@ diff -up openssh-7.7p1/myproposal.h.fips openssh-7.7p1/myproposal.h
/* Not a KEX value, but here so all the algorithm defaults are together */ /* Not a KEX value, but here so all the algorithm defaults are together */
#define SSH_ALLOWED_CA_SIGALGS \ #define SSH_ALLOWED_CA_SIGALGS \
"ecdsa-sha2-nistp256," \ "ecdsa-sha2-nistp256," \
diff -up openssh-7.7p1/readconf.c.fips openssh-7.7p1/readconf.c diff -up openssh-7.9p1/readconf.c.fips openssh-7.9p1/readconf.c
--- openssh-7.7p1/readconf.c.fips 2018-08-08 10:08:40.769719527 +0200 --- openssh-7.9p1/readconf.c.fips 2019-03-11 17:06:37.601877853 +0100
+++ openssh-7.7p1/readconf.c 2018-08-08 10:08:40.824719990 +0200 +++ openssh-7.9p1/readconf.c 2019-03-11 17:06:37.622878050 +0100
@@ -2081,18 +2081,19 @@ fill_default_options(Options * options) @@ -2178,18 +2178,19 @@ fill_default_options(Options * options)
all_kex = kex_alg_list(','); all_kex = kex_alg_list(',');
all_key = sshkey_alg_list(0, 0, 1, ','); all_key = sshkey_alg_list(0, 0, 1, ',');
all_sig = sshkey_alg_list(0, 1, 1, ','); all_sig = sshkey_alg_list(0, 1, 1, ',');
@ -413,9 +487,9 @@ diff -up openssh-7.7p1/readconf.c.fips openssh-7.7p1/readconf.c
#undef ASSEMBLE #undef ASSEMBLE
free(all_cipher); free(all_cipher);
free(all_mac); free(all_mac);
diff -up openssh-7.7p1/sandbox-seccomp-filter.c.fips openssh-7.7p1/sandbox-seccomp-filter.c diff -up openssh-7.9p1/sandbox-seccomp-filter.c.fips openssh-7.9p1/sandbox-seccomp-filter.c
--- openssh-7.7p1/sandbox-seccomp-filter.c.fips 2018-08-08 10:08:40.794719737 +0200 --- openssh-7.9p1/sandbox-seccomp-filter.c.fips 2019-03-11 17:06:37.586877712 +0100
+++ openssh-7.7p1/sandbox-seccomp-filter.c 2018-08-08 10:08:40.824719990 +0200 +++ openssh-7.9p1/sandbox-seccomp-filter.c 2019-03-11 17:06:37.622878050 +0100
@@ -137,6 +137,9 @@ static const struct sock_filter preauth_ @@ -137,6 +137,9 @@ static const struct sock_filter preauth_
#ifdef __NR_open #ifdef __NR_open
SC_DENY(__NR_open, EACCES), SC_DENY(__NR_open, EACCES),
@ -426,10 +500,10 @@ diff -up openssh-7.7p1/sandbox-seccomp-filter.c.fips openssh-7.7p1/sandbox-secco
#ifdef __NR_openat #ifdef __NR_openat
SC_DENY(__NR_openat, EACCES), SC_DENY(__NR_openat, EACCES),
#endif #endif
diff -up openssh-7.7p1/servconf.c.fips openssh-7.7p1/servconf.c diff -up openssh-7.9p1/servconf.c.fips openssh-7.9p1/servconf.c
--- openssh-7.7p1/servconf.c.fips 2018-08-08 10:08:40.778719603 +0200 --- openssh-7.9p1/servconf.c.fips 2019-03-11 17:06:37.568877543 +0100
+++ openssh-7.7p1/servconf.c 2018-08-08 10:08:40.824719990 +0200 +++ openssh-7.9p1/servconf.c 2019-03-11 17:06:37.622878050 +0100
@@ -196,18 +196,19 @@ option_clear_or_none(const char *o) @@ -209,18 +209,19 @@ assemble_algorithms(ServerOptions *o)
all_kex = kex_alg_list(','); all_kex = kex_alg_list(',');
all_key = sshkey_alg_list(0, 0, 1, ','); all_key = sshkey_alg_list(0, 0, 1, ',');
all_sig = sshkey_alg_list(0, 1, 1, ','); all_sig = sshkey_alg_list(0, 1, 1, ',');
@ -458,9 +532,9 @@ diff -up openssh-7.7p1/servconf.c.fips openssh-7.7p1/servconf.c
#undef ASSEMBLE #undef ASSEMBLE
free(all_cipher); free(all_cipher);
free(all_mac); free(all_mac);
diff -up openssh-7.7p1/ssh.c.fips openssh-7.7p1/ssh.c diff -up openssh-7.9p1/ssh.c.fips openssh-7.9p1/ssh.c
--- openssh-7.7p1/ssh.c.fips 2018-08-08 10:08:40.811719881 +0200 --- openssh-7.9p1/ssh.c.fips 2019-03-11 17:06:37.602877862 +0100
+++ openssh-7.7p1/ssh.c 2018-08-08 10:08:40.825719999 +0200 +++ openssh-7.9p1/ssh.c 2019-03-11 17:06:37.623878060 +0100
@@ -76,6 +76,8 @@ @@ -76,6 +76,8 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/err.h> #include <openssl/err.h>
@ -470,7 +544,7 @@ diff -up openssh-7.7p1/ssh.c.fips openssh-7.7p1/ssh.c
#include "openbsd-compat/openssl-compat.h" #include "openbsd-compat/openssl-compat.h"
#include "openbsd-compat/sys-queue.h" #include "openbsd-compat/sys-queue.h"
@@ -579,6 +581,16 @@ main(int ac, char **av) @@ -600,6 +602,16 @@ main(int ac, char **av)
sanitise_stdfd(); sanitise_stdfd();
__progname = ssh_get_progname(av[0]); __progname = ssh_get_progname(av[0]);
@ -487,7 +561,7 @@ diff -up openssh-7.7p1/ssh.c.fips openssh-7.7p1/ssh.c
#ifndef HAVE_SETPROCTITLE #ifndef HAVE_SETPROCTITLE
/* Prepare for later setproctitle emulation */ /* Prepare for later setproctitle emulation */
@@ -1045,7 +1055,6 @@ main(int ac, char **av) @@ -1047,7 +1059,6 @@ main(int ac, char **av)
host_arg = xstrdup(host); host_arg = xstrdup(host);
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
@ -495,7 +569,7 @@ diff -up openssh-7.7p1/ssh.c.fips openssh-7.7p1/ssh.c
ERR_load_crypto_strings(); ERR_load_crypto_strings();
#endif #endif
@@ -1268,6 +1277,10 @@ main(int ac, char **av) @@ -1283,6 +1294,10 @@ main(int ac, char **av)
seed_rng(); seed_rng();
@ -506,9 +580,9 @@ diff -up openssh-7.7p1/ssh.c.fips openssh-7.7p1/ssh.c
if (options.user == NULL) if (options.user == NULL)
options.user = xstrdup(pw->pw_name); options.user = xstrdup(pw->pw_name);
diff -up openssh-7.7p1/sshconnect2.c.fips openssh-7.7p1/sshconnect2.c diff -up openssh-7.9p1/sshconnect2.c.fips openssh-7.9p1/sshconnect2.c
--- openssh-7.7p1/sshconnect2.c.fips 2018-08-08 10:08:40.786719670 +0200 --- openssh-7.9p1/sshconnect2.c.fips 2019-03-11 17:06:37.580877655 +0100
+++ openssh-7.7p1/sshconnect2.c 2018-08-08 10:08:40.825719999 +0200 +++ openssh-7.9p1/sshconnect2.c 2019-03-11 17:06:37.623878060 +0100
@@ -44,6 +44,8 @@ @@ -44,6 +44,8 @@
#include <vis.h> #include <vis.h>
#endif #endif
@ -574,7 +648,7 @@ diff -up openssh-7.7p1/sshconnect2.c.fips openssh-7.7p1/sshconnect2.c
} }
} }
#endif #endif
@@ -322,14 +330,16 @@ ssh_kex2(char *host, struct sockaddr *ho @@ -326,14 +334,16 @@ ssh_kex2(char *host, struct sockaddr *ho
if (options.hostkeyalgorithms != NULL) { if (options.hostkeyalgorithms != NULL) {
all_key = sshkey_alg_list(0, 0, 1, ','); all_key = sshkey_alg_list(0, 0, 1, ',');
if (kex_assemble_names(&options.hostkeyalgorithms, if (kex_assemble_names(&options.hostkeyalgorithms,
@ -593,9 +667,9 @@ diff -up openssh-7.7p1/sshconnect2.c.fips openssh-7.7p1/sshconnect2.c
/* Prefer algorithms that we already have keys for */ /* Prefer algorithms that we already have keys for */
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] =
compat_pkalg_proposal( compat_pkalg_proposal(
diff -up openssh-7.7p1/sshd.c.fips openssh-7.7p1/sshd.c diff -up openssh-7.9p1/sshd.c.fips openssh-7.9p1/sshd.c
--- openssh-7.7p1/sshd.c.fips 2018-08-08 10:08:40.818719940 +0200 --- openssh-7.9p1/sshd.c.fips 2019-03-11 17:06:37.617878003 +0100
+++ openssh-7.7p1/sshd.c 2018-08-08 10:08:40.826720007 +0200 +++ openssh-7.9p1/sshd.c 2019-03-11 17:06:37.624878069 +0100
@@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
#include <grp.h> #include <grp.h>
#include <pwd.h> #include <pwd.h>
@ -613,7 +687,7 @@ diff -up openssh-7.7p1/sshd.c.fips openssh-7.7p1/sshd.c
#include "openbsd-compat/openssl-compat.h" #include "openbsd-compat/openssl-compat.h"
#endif #endif
@@ -1534,6 +1537,18 @@ main(int ac, char **av) @@ -1581,6 +1584,18 @@ main(int ac, char **av)
#endif #endif
__progname = ssh_get_progname(av[0]); __progname = ssh_get_progname(av[0]);
@ -632,7 +706,7 @@ diff -up openssh-7.7p1/sshd.c.fips openssh-7.7p1/sshd.c
/* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */
saved_argc = ac; saved_argc = ac;
rexec_argc = ac; rexec_argc = ac;
@@ -1675,7 +1690,7 @@ main(int ac, char **av) @@ -1722,7 +1737,7 @@ main(int ac, char **av)
else else
closefrom(REEXEC_DEVCRYPTO_RESERVED_FD); closefrom(REEXEC_DEVCRYPTO_RESERVED_FD);
@ -641,7 +715,7 @@ diff -up openssh-7.7p1/sshd.c.fips openssh-7.7p1/sshd.c
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
#endif #endif
@@ -1979,6 +1994,10 @@ main(int ac, char **av) @@ -2036,6 +2051,10 @@ main(int ac, char **av)
/* Reinitialize the log (because of the fork above). */ /* Reinitialize the log (because of the fork above). */
log_init(__progname, options.log_level, options.log_facility, log_stderr); log_init(__progname, options.log_level, options.log_facility, log_stderr);
@ -652,7 +726,7 @@ diff -up openssh-7.7p1/sshd.c.fips openssh-7.7p1/sshd.c
/* Chdir to the root directory so that the current disk can be /* Chdir to the root directory so that the current disk can be
unmounted if desired. */ unmounted if desired. */
if (chdir("/") == -1) if (chdir("/") == -1)
@@ -2359,10 +2378,14 @@ do_ssh2_kex(void) @@ -2412,10 +2431,14 @@ do_ssh2_kex(void)
if (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]) == 0) if (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]) == 0)
orig = NULL; orig = NULL;
@ -671,9 +745,9 @@ diff -up openssh-7.7p1/sshd.c.fips openssh-7.7p1/sshd.c
if (gss && orig) if (gss && orig)
xasprintf(&newstr, "%s,%s", gss, orig); xasprintf(&newstr, "%s,%s", gss, orig);
diff -up openssh-7.7p1/sshkey.c.fips openssh-7.7p1/sshkey.c diff -up openssh-7.9p1/sshkey.c.fips openssh-7.9p1/sshkey.c
--- openssh-7.7p1/sshkey.c.fips 2018-08-08 10:08:40.818719940 +0200 --- openssh-7.9p1/sshkey.c.fips 2019-03-11 17:06:37.617878003 +0100
+++ openssh-7.7p1/sshkey.c 2018-08-08 10:08:40.826720007 +0200 +++ openssh-7.9p1/sshkey.c 2019-03-11 17:06:37.624878069 +0100
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/err.h> #include <openssl/err.h>
@ -690,7 +764,7 @@ diff -up openssh-7.7p1/sshkey.c.fips openssh-7.7p1/sshkey.c
#include "xmss_fast.h" #include "xmss_fast.h"
@@ -1526,6 +1528,8 @@ rsa_generate_private_key(u_int bits, RSA @@ -1514,6 +1516,8 @@ rsa_generate_private_key(u_int bits, RSA
} }
if (!BN_set_word(f4, RSA_F4) || if (!BN_set_word(f4, RSA_F4) ||
!RSA_generate_key_ex(private, bits, f4, NULL)) { !RSA_generate_key_ex(private, bits, f4, NULL)) {
@ -699,10 +773,10 @@ diff -up openssh-7.7p1/sshkey.c.fips openssh-7.7p1/sshkey.c
ret = SSH_ERR_LIBCRYPTO_ERROR; ret = SSH_ERR_LIBCRYPTO_ERROR;
goto out; goto out;
} }
diff -up openssh-7.7p1/ssh-keygen.c.fips openssh-7.7p1/ssh-keygen.c diff -up openssh-7.9p1/ssh-keygen.c.fips openssh-7.9p1/ssh-keygen.c
--- openssh-7.7p1/ssh-keygen.c.fips 2018-08-08 10:08:40.801719797 +0200 --- openssh-7.9p1/ssh-keygen.c.fips 2019-03-11 17:06:37.590877750 +0100
+++ openssh-7.7p1/ssh-keygen.c 2018-08-08 10:08:40.827720016 +0200 +++ openssh-7.9p1/ssh-keygen.c 2019-03-11 17:06:37.625878079 +0100
@@ -229,6 +229,12 @@ type_bits_valid(int type, const char *na @@ -230,6 +230,12 @@ type_bits_valid(int type, const char *na
OPENSSL_DSA_MAX_MODULUS_BITS : OPENSSL_RSA_MAX_MODULUS_BITS; OPENSSL_DSA_MAX_MODULUS_BITS : OPENSSL_RSA_MAX_MODULUS_BITS;
if (*bitsp > maxbits) if (*bitsp > maxbits)
fatal("key bits exceeds maximum %d", maxbits); fatal("key bits exceeds maximum %d", maxbits);