Skip to content

Commit 8e0a546

Browse files
authored
Merge pull request #86 from klardotsh/klardotsh/restore-disablemtaes
cipher: Restore DisableMTAES capability to resolve FIPS SIGSEGV.
2 parents 3fc03e9 + 032af05 commit 8e0a546

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

readconf.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ typedef enum {
172172
oLocalCommand, oPermitLocalCommand, oRemoteCommand,
173173
oTcpRcvBufPoll, oHPNDisabled,
174174
oNoneEnabled, oNoneMacEnabled, oNoneSwitch,
175+
oDisableMTAES,
175176
oMetrics, oMetricsPath, oMetricsInterval, oFallback, oFallbackPort,
176177
oVisualHostKey,
177178
oKexAlgorithms, oIPQoS, oRequestTTY, oSessionType, oStdinNull,
@@ -310,6 +311,7 @@ static struct {
310311
{ "noneenabled", oNoneEnabled },
311312
{ "nonemacenabled", oNoneMacEnabled },
312313
{ "noneswitch", oNoneSwitch },
314+
{ "disablemtaes", oDisableMTAES },
313315
{ "metrics", oMetrics },
314316
{ "metricspath", oMetricsPath },
315317
{ "metricsinterval", oMetricsInterval },
@@ -1269,6 +1271,10 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host,
12691271
intptr = &options->nonemac_enabled;
12701272
goto parse_flag;
12711273

1274+
case oDisableMTAES:
1275+
intptr = &options->disable_multithreaded;
1276+
goto parse_flag;
1277+
12721278
case oMetrics:
12731279
intptr = &options->metrics;
12741280
goto parse_flag;
@@ -2692,6 +2698,7 @@ initialize_options(Options * options)
26922698
options->none_switch = -1;
26932699
options->none_enabled = -1;
26942700
options->nonemac_enabled = -1;
2701+
options->disable_multithreaded = -1;
26952702
options->metrics = -1;
26962703
options->metrics_path = NULL;
26972704
options->metrics_interval = -1;
@@ -2891,6 +2898,8 @@ fill_default_options(Options * options)
28912898
fprintf(stderr, "None MAC can only be used with the None cipher. None MAC disabled.\n");
28922899
options->nonemac_enabled = 0;
28932900
}
2901+
if (options->disable_multithreaded == -1)
2902+
options->disable_multithreaded = 0;
28942903
if (options->metrics == -1)
28952904
options->metrics = 0;
28962905
if (options->metrics_interval == -1)

readconf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ typedef struct {
125125
int none_switch; /* Use none cipher */
126126
int none_enabled; /* Allow none to be used */
127127
int nonemac_enabled; /* Allow none to be used */
128+
int disable_multithreaded; /* Disable multithreaded aes-ctr */
128129
int metrics; /* enable metrics */
129130
int metrics_interval; /* time in seconds between polls */
130131
char *metrics_path; /* path for the metrics files */

servconf.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ initialize_server_options(ServerOptions *options)
207207
options->hpn_disabled = -1;
208208
options->none_enabled = -1;
209209
options->nonemac_enabled = -1;
210+
options->disable_multithreaded = -1;
210211
options->ip_qos_interactive = -1;
211212
options->ip_qos_bulk = -1;
212213
options->version_addendum = NULL;
@@ -478,6 +479,8 @@ fill_default_server_options(ServerOptions *options)
478479
debug ("Attempted to enabled None MAC without setting None Enabled to true. None MAC disabled.");
479480
options->nonemac_enabled = 0;
480481
}
482+
if (options->disable_multithreaded == -1)
483+
options->disable_multithreaded = 0;
481484
if (options->hpn_disabled == -1)
482485
options->hpn_disabled = 0;
483486
if (options->ip_qos_interactive == -1)
@@ -561,6 +564,7 @@ typedef enum {
561564
sKbdInteractiveAuthentication, sListenAddress, sAddressFamily,
562565
sPrintMotd, sPrintLastLog, sIgnoreRhosts,
563566
sNoneEnabled, sNoneMacEnabled, sTcpRcvBufPoll, sHPNDisabled,
567+
sDisableMTAES,
564568
sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost,
565569
sPermitTTY, sStrictModes, sEmptyPasswd, sTCPKeepAlive,
566570
sPermitUserEnvironment, sAllowTcpForwarding, sCompression,
@@ -737,6 +741,7 @@ static struct {
737741
{ "tcprcvbufpoll", sTcpRcvBufPoll, SSHCFG_ALL },
738742
{ "noneenabled", sNoneEnabled, SSHCFG_ALL },
739743
{ "nonemacenabled", sNoneMacEnabled, SSHCFG_ALL },
744+
{ "disableMTAES", sDisableMTAES, SSHCFG_ALL },
740745
{ "kexalgorithms", sKexAlgorithms, SSHCFG_GLOBAL },
741746
{ "include", sInclude, SSHCFG_ALL },
742747
{ "ipqos", sIPQoS, SSHCFG_ALL },
@@ -1538,6 +1543,10 @@ process_server_config_line_depth(ServerOptions *options, char *line,
15381543
intptr = &options->nonemac_enabled;
15391544
goto parse_flag;
15401545

1546+
case sDisableMTAES:
1547+
intptr = &options->disable_multithreaded;
1548+
goto parse_flag;
1549+
15411550
case sHostbasedAuthentication:
15421551
intptr = &options->hostbased_authentication;
15431552
goto parse_flag;

servconf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ typedef struct {
216216
int hpn_disabled; /* disable hpn functionality. false by default */
217217
int none_enabled; /* Enable NONE cipher switch */
218218
int nonemac_enabled; /* Enable NONE MAC switch */
219+
int disable_multithreaded; /* Disable multithreaded aes-ctr cipher */
219220

220221
int permit_tun;
221222

session.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ do_exec_no_pty(struct ssh *ssh, Session *s, const char *command)
558558
s->is_subsystem, 0);
559559
#endif
560560
/* switch to the parallel ciphers if necessary */
561-
cipher_switch(ssh);
561+
if (options.disable_multithreaded == 0)
562+
cipher_switch(ssh);
562563
return 0;
563564
}
564565

@@ -662,7 +663,8 @@ do_exec_pty(struct ssh *ssh, Session *s, const char *command)
662663
options.ip_qos_interactive, options.ip_qos_bulk);
663664
session_set_fds(ssh, s, ptyfd, fdout, -1, 1, 1);
664665
/* switch to the parallel cipher if appropriate */
665-
cipher_switch(ssh);
666+
if (options.disable_multithreaded == 0)
667+
cipher_switch(ssh);
666668
return 0;
667669
}
668670

ssh.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,8 @@ fork_postauth(struct ssh *ssh)
18871887
error_f("stdfd_devnull failed");
18881888
/* we do the cipher switch here in the event that the client
18891889
is forking or has a delayed fork */
1890-
cipher_switch(ssh);
1890+
if (options.disable_multithreaded == 0)
1891+
cipher_switch(ssh);
18911892
}
18921893

18931894
static void
@@ -2365,7 +2366,8 @@ ssh_session2(struct ssh *ssh, const struct ssh_conn_info *cinfo)
23652366
* one of our parallel versions. If the client is
23662367
* forking then we handle it in fork_postauth()
23672368
*/
2368-
cipher_switch(ssh);
2369+
if (options.disable_multithreaded == 0)
2370+
cipher_switch(ssh);
23692371
}
23702372
return client_loop(ssh, tty_flag, tty_flag ?
23712373
options.escape_char : SSH_ESCAPECHAR_NONE, id);

0 commit comments

Comments
 (0)