View | Details | Raw Unified | Return to bug 1197
Collapse All | Expand All

(-)openssh-5.3p1/auth2-pubkey.c (-1 / +11 lines)
Lines 54-59 Link Here
54
#endif
54
#endif
55
#include "monitor_wrap.h"
55
#include "monitor_wrap.h"
56
#include "misc.h"
56
#include "misc.h"
57
#ifdef OPENSSL_FIPS
58
	#include "fips.h"
59
#endif
57
60
58
/* import */
61
/* import */
59
extern ServerOptions options;
62
extern ServerOptions options;
Lines 184-189 Link Here
184
	Key *found;
187
	Key *found;
185
	char *fp;
188
	char *fp;
186
189
190
	enum fp_type dgst_type = SSH_FP_MD5;
191
	#ifdef OPENSSL_FIPS
192
		if (fips_mode) {
193
			dgst_type = SSH_FP_SHA1;
194
		}
195
	#endif
196
187
	/* Temporarily use the user's uid. */
197
	/* Temporarily use the user's uid. */
188
	temporarily_use_uid(pw);
198
	temporarily_use_uid(pw);
189
199
Lines 232-238 Link Here
232
			found_key = 1;
242
			found_key = 1;
233
			debug("matching key found: file %s, line %lu",
243
			debug("matching key found: file %s, line %lu",
234
			    file, linenum);
244
			    file, linenum);
235
			fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX);
245
			fp = key_fingerprint(found, dgst_type, SSH_FP_HEX);
236
			verbose("Found matching %s key: %s",
246
			verbose("Found matching %s key: %s",
237
			    key_type(found), fp);
247
			    key_type(found), fp);
238
			xfree(fp);
248
			xfree(fp);
(-)openssh-5.3p1/auth-rsa.c (-5 / +47 lines)
Lines 21-26 Link Here
21
21
22
#include <openssl/rsa.h>
22
#include <openssl/rsa.h>
23
#include <openssl/md5.h>
23
#include <openssl/md5.h>
24
#include <openssl/fips_sha.h>
24
25
25
#include <pwd.h>
26
#include <pwd.h>
26
#include <stdio.h>
27
#include <stdio.h>
Lines 47-52 Link Here
47
#include "monitor_wrap.h"
48
#include "monitor_wrap.h"
48
#include "ssh.h"
49
#include "ssh.h"
49
#include "misc.h"
50
#include "misc.h"
51
#ifdef OPENSSL_FIPS
52
	#include "fips.h"
53
#endif
50
54
51
/* import */
55
/* import */
52
extern ServerOptions options;
56
extern ServerOptions options;
Lines 88-97 Link Here
88
}
92
}
89
93
90
int
94
int
91
auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[16])
95
auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[20])
92
{
96
{
93
	u_char buf[32], mdbuf[16];
97
	u_char buf[40], mdbuf[16], shabuf[20];
94
	MD5_CTX md;
98
	MD5_CTX md;
99
	SHA_CTX sha;
95
	int len;
100
	int len;
96
101
97
	/* don't allow short keys */
102
	/* don't allow short keys */
Lines 101-110 Link Here
101
		return (0);
106
		return (0);
102
	}
107
	}
103
108
104
	/* The response is MD5 of decrypted challenge plus session id. */
105
	len = BN_num_bytes(challenge);
109
	len = BN_num_bytes(challenge);
110
111
	if (len <= 0 || len > 40)
112
		fatal("auth_rsa_verify_response: bad challenge length %d". len);
113
	
114
	/* The response is SHA1 of decrypted challenge plus session is */
115
		memset(buf, 0, 40);
116
		BN_bn2bin(challenge, buf+ 40 - len);
117
		SHA1_Init(&sha);
118
		SHA1_Update(&sha, buf, 40);
119
		SHA1_Update(&sha, session_id, 16);
120
		SHA1_Final(shabuf, &sha);
121
122
		/* Verify that the response is the original challenge */
123
		if (memcmp(response, shabuf, 20) != 0) {
124
		/* Wrong answer */
125
		#ifdef OPENSSL_FIPS
126
		if (fips_mode) {
127
			return(0);
128
		}
129
		#endif
130
		}
131
	#ifdef OPENSSL_FIPS
132
	if (fips_mode) {
133
		return(1);
134
	}
135
	#endif
136
106
	if (len <= 0 || len > 32)
137
	if (len <= 0 || len > 32)
107
		fatal("auth_rsa_verify_response: bad challenge length %d", len);
138
		fatal("auth_rsa_verify_response: bad challenge length %d", len);
139
	/* The response is MD5 of decrypted challenge pluss session is. */
108
	memset(buf, 0, 32);
140
	memset(buf, 0, 32);
109
	BN_bn2bin(challenge, buf + 32 - len);
141
	BN_bn2bin(challenge, buf + 32 - len);
110
	MD5_Init(&md);
142
	MD5_Init(&md);
Lines 131-137 Link Here
131
auth_rsa_challenge_dialog(Key *key)
163
auth_rsa_challenge_dialog(Key *key)
132
{
164
{
133
	BIGNUM *challenge, *encrypted_challenge;
165
	BIGNUM *challenge, *encrypted_challenge;
134
	u_char response[16];
166
	u_char response[20];
135
	int i, success;
167
	int i, success;
136
168
137
	if ((encrypted_challenge = BN_new()) == NULL)
169
	if ((encrypted_challenge = BN_new()) == NULL)
Lines 153-158 Link Here
153
	packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE);
185
	packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE);
154
	for (i = 0; i < 16; i++)
186
	for (i = 0; i < 16; i++)
155
		response[i] = (u_char)packet_get_char();
187
		response[i] = (u_char)packet_get_char();
188
		#ifdef OPENSSL_FIPS
189
		for (i = 16; i < 20; i++)
190
			response[i] = (u_char)packet_get_char();
191
		#endif
156
	packet_check_eom();
192
	packet_check_eom();
157
193
158
	success = PRIVSEP(auth_rsa_verify_response(key, challenge, response));
194
	success = PRIVSEP(auth_rsa_verify_response(key, challenge, response));
Lines 285-290 Link Here
285
	Key *key;
321
	Key *key;
286
	char *fp;
322
	char *fp;
287
	struct passwd *pw = authctxt->pw;
323
	struct passwd *pw = authctxt->pw;
324
	enum fp_type dgst_type = SSH_FP_MD5
325
	#ifdef OPENSSL_FIPS
326
	if (fips_mode) {
327
		dgst_type = SSH_FP_SHA1;
328
	}
329
	#endif
288
330
289
	/* no user given */
331
	/* no user given */
290
	if (!authctxt->valid)
332
	if (!authctxt->valid)
Lines 313-319 Link Here
313
	 * options; this will be reset if the options cause the
355
	 * options; this will be reset if the options cause the
314
	 * authentication to be rejected.
356
	 * authentication to be rejected.
315
	 */
357
	 */
316
	fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
358
	fp = key_fingerprint(key, dgst_type, SSH_FP_HEX);
317
	verbose("Found matching %s key: %s",
359
	verbose("Found matching %s key: %s",
318
	    key_type(key), fp);
360
	    key_type(key), fp);
319
	xfree(fp);
361
	xfree(fp);
(-)openssh-5.3p1/buffer.c (+1 lines)
Lines 175-180 Link Here
175
		    len, buffer->end - buffer->offset);
175
		    len, buffer->end - buffer->offset);
176
		return (-1);
176
		return (-1);
177
	}
177
	}
178
	if (len > 0)
178
	memcpy(buf, buffer->buf + buffer->offset, len);
179
	memcpy(buf, buffer->buf + buffer->offset, len);
179
	buffer->offset += len;
180
	buffer->offset += len;
180
	return (0);
181
	return (0);
(-)openssh-5.3p1/buildpkg.sh.in (-1 / +1 lines)
Lines 126-132 Link Here
126
FAKE_ROOT=$START/pkg
126
FAKE_ROOT=$START/pkg
127
127
128
## Fill in some details, like prefix and sysconfdir
128
## Fill in some details, like prefix and sysconfdir
129
for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir
129
for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir ssldir
130
do
130
do
131
	eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2`
131
	eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2`
132
done
132
done
(-)openssh-5.3p1/cipher.c (-21 / +47 lines)
Lines 47-52 Link Here
47
#include "xmalloc.h"
47
#include "xmalloc.h"
48
#include "log.h"
48
#include "log.h"
49
#include "cipher.h"
49
#include "cipher.h"
50
#include "fips.h"
51
#include <openssl/sha.h>
50
52
51
/* compatibility with old or broken OpenSSL versions */
53
/* compatibility with old or broken OpenSSL versions */
52
#include "openbsd-compat/openssl-compat.h"
54
#include "openbsd-compat/openssl-compat.h"
Lines 65-94 Link Here
65
	u_int	discard_len;
67
	u_int	discard_len;
66
	u_int	cbc_mode;
68
	u_int	cbc_mode;
67
	const EVP_CIPHER	*(*evptype)(void);
69
	const EVP_CIPHER	*(*evptype)(void);
70
	u_int	fips_allowed;
68
} ciphers[] = {
71
} ciphers[] = {
69
	{ "none",		SSH_CIPHER_NONE, 8, 0, 0, 0, EVP_enc_null },
72
	{ "none",		SSH_CIPHER_NONE, 8, 0, 0, 0, EVP_enc_null, 0 },
70
	{ "des",		SSH_CIPHER_DES, 8, 8, 0, 1, EVP_des_cbc },
73
	{ "des",		SSH_CIPHER_DES, 8, 8, 0, 1, EVP_des_cbc, 0 },
71
	{ "3des",		SSH_CIPHER_3DES, 8, 16, 0, 1, evp_ssh1_3des },
74
	{ "3des",		SSH_CIPHER_3DES, 8, 16, 0, 1, evp_ssh1_3des, 0 },
72
	{ "blowfish",		SSH_CIPHER_BLOWFISH, 8, 32, 0, 1, evp_ssh1_bf },
75
	{ "blowfish",		SSH_CIPHER_BLOWFISH, 8, 32, 0, 1, evp_ssh1_bf, 0 },
73
76
74
	{ "3des-cbc",		SSH_CIPHER_SSH2, 8, 24, 0, 1, EVP_des_ede3_cbc },
77
	{ "3des-cbc",		SSH_CIPHER_SSH2, 8, 24, 0, 1, EVP_des_ede3_cbc, 1 },
75
	{ "blowfish-cbc",	SSH_CIPHER_SSH2, 8, 16, 0, 1, EVP_bf_cbc },
78
	{ "blowfish-cbc",	SSH_CIPHER_SSH2, 8, 16, 0, 1, EVP_bf_cbc, 0 },
76
	{ "cast128-cbc",	SSH_CIPHER_SSH2, 8, 16, 0, 1, EVP_cast5_cbc },
79
	{ "cast128-cbc",	SSH_CIPHER_SSH2, 8, 16, 0, 1, EVP_cast5_cbc, 0 },
77
	{ "arcfour",		SSH_CIPHER_SSH2, 8, 16, 0, 0, EVP_rc4 },
80
	{ "arcfour",		SSH_CIPHER_SSH2, 8, 16, 0, 0, EVP_rc4, 0 },
78
	{ "arcfour128",		SSH_CIPHER_SSH2, 8, 16, 1536, 0, EVP_rc4 },
81
	{ "arcfour128",		SSH_CIPHER_SSH2, 8, 16, 1536, 0, EVP_rc4, 0 },
79
	{ "arcfour256",		SSH_CIPHER_SSH2, 8, 32, 1536, 0, EVP_rc4 },
82
	{ "arcfour256",		SSH_CIPHER_SSH2, 8, 32, 1536, 0, EVP_rc4, 0 },
80
	{ "aes128-cbc",		SSH_CIPHER_SSH2, 16, 16, 0, 1, EVP_aes_128_cbc },
83
	{ "aes128-cbc",		SSH_CIPHER_SSH2, 16, 16, 0, 1, EVP_aes_128_cbc, 1 },
81
	{ "aes192-cbc",		SSH_CIPHER_SSH2, 16, 24, 0, 1, EVP_aes_192_cbc },
84
	{ "aes192-cbc",		SSH_CIPHER_SSH2, 16, 24, 0, 1, EVP_aes_192_cbc, 1 },
82
	{ "aes256-cbc",		SSH_CIPHER_SSH2, 16, 32, 0, 1, EVP_aes_256_cbc },
85
	{ "aes256-cbc",		SSH_CIPHER_SSH2, 16, 32, 0, 1, EVP_aes_256_cbc, 1 },
83
	{ "rijndael-cbc@lysator.liu.se",
86
	{ "rijndael-cbc@lysator.liu.se",
84
				SSH_CIPHER_SSH2, 16, 32, 0, 1, EVP_aes_256_cbc },
87
				SSH_CIPHER_SSH2, 16, 32, 0, 1, EVP_aes_256_cbc, 0 },
85
	{ "aes128-ctr",		SSH_CIPHER_SSH2, 16, 16, 0, 0, evp_aes_128_ctr },
88
	{ "aes128-ctr",		SSH_CIPHER_SSH2, 16, 16, 0, 0, evp_aes_128_ctr, 1 },
86
	{ "aes192-ctr",		SSH_CIPHER_SSH2, 16, 24, 0, 0, evp_aes_128_ctr },
89
	{ "aes192-ctr",		SSH_CIPHER_SSH2, 16, 24, 0, 0, evp_aes_128_ctr, 1 },
87
	{ "aes256-ctr",		SSH_CIPHER_SSH2, 16, 32, 0, 0, evp_aes_128_ctr },
90
	{ "aes256-ctr",		SSH_CIPHER_SSH2, 16, 32, 0, 0, evp_aes_128_ctr, 1 },
88
#ifdef USE_CIPHER_ACSS
91
#ifdef USE_CIPHER_ACSS
89
	{ "acss@openssh.org",	SSH_CIPHER_SSH2, 16, 5, 0, 0, EVP_acss },
92
	{ "acss@openssh.org",	SSH_CIPHER_SSH2, 16, 5, 0, 0, EVP_acss, 0 },
90
#endif
93
#endif
91
	{ NULL,			SSH_CIPHER_INVALID, 0, 0, 0, 0, NULL }
94
	{ NULL,			SSH_CIPHER_INVALID, 0, 0, 0, 0, NULL, 0 }
92
};
95
};
93
96
94
/*--*/
97
/*--*/
Lines 163-168 Link Here
163
	for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
166
	for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
164
	    (p = strsep(&cp, CIPHER_SEP))) {
167
	    (p = strsep(&cp, CIPHER_SEP))) {
165
		c = cipher_by_name(p);
168
		c = cipher_by_name(p);
169
		#ifdef OPENSSL_FIPS
170
			if (fips_mode && !(c->fips_allowed)) {
171
				debug("cipher %s disallowed in FIPS mode [%s]", p, names);
172
				xfree(cipher_list);
173
				return 0;
174
			}
175
		#endif
166
		if (c == NULL || c->number != SSH_CIPHER_SSH2) {
176
		if (c == NULL || c->number != SSH_CIPHER_SSH2) {
167
			debug("bad cipher %s [%s]", p, names);
177
			debug("bad cipher %s [%s]", p, names);
168
			xfree(cipher_list);
178
			xfree(cipher_list);
Lines 298-306 Link Here
298
cipher_set_key_string(CipherContext *cc, Cipher *cipher,
308
cipher_set_key_string(CipherContext *cc, Cipher *cipher,
299
    const char *passphrase, int do_encrypt)
309
    const char *passphrase, int do_encrypt)
300
{
310
{
311
	#ifdef OPENSSL_FIPS
312
		SHA_CTX sha;
313
	#endif
301
	MD5_CTX md;
314
	MD5_CTX md;
302
	u_char digest[16];
315
	u_char digest[20];
303
316
317
	#ifdef OPENSSL_FIPS
318
		if (fips_mode) {
319
			SHA1_Init(&sha);
320
			SHA1_Update(&sha, (const u_char *)passphrase, strlen(passphrase));
321
			SHA1_Final(digest, &sha);
322
323
			cipher_init(cc, cipher, digest, 20, NULL, 0, do_encrypt);
324
325
			memset(digest, 0, sizeof(digest));
326
			memset(&sha, 0, sizeof(sha));
327
			return;
328
		}
329
	#endif
304
	MD5_Init(&md);
330
	MD5_Init(&md);
305
	MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
331
	MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
306
	MD5_Final(digest, &md);
332
	MD5_Final(digest, &md);
(-)openssh-5.3p1/configure.ac (+32 lines)
Lines 510-515 Link Here
510
		if test -z "$GCC"; then
510
		if test -z "$GCC"; then
511
			CFLAGS="$CFLAGS -Ae"
511
			CFLAGS="$CFLAGS -Ae"
512
		fi
512
		fi
513
		HPUX=1
513
		;;
514
		;;
514
	*-*-hpux11*)
515
	*-*-hpux11*)
515
		AC_DEFINE(PAM_SUN_CODEBASE, 1,
516
		AC_DEFINE(PAM_SUN_CODEBASE, 1,
Lines 521-526 Link Here
521
		AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
522
		AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
522
		check_for_hpux_broken_getaddrinfo=1
523
		check_for_hpux_broken_getaddrinfo=1
523
		check_for_conflicting_getspnam=1
524
		check_for_conflicting_getspnam=1
525
		HPUX=1
524
		;;
526
		;;
525
	esac
527
	esac
526
528
Lines 532-537 Link Here
532
			protected password database])
534
			protected password database])
533
		disable_ptmx_check=yes
535
		disable_ptmx_check=yes
534
		LIBS="$LIBS -lsecpw"
536
		LIBS="$LIBS -lsecpw"
537
		HPU
535
		;;
538
		;;
536
	esac
539
	esac
537
	;;
540
	;;
Lines 1864-1869 Link Here
1864
				# Relative paths
1867
				# Relative paths
1865
				./*|../*)	withval="`pwd`/$withval"
1868
				./*|../*)	withval="`pwd`/$withval"
1866
			esac
1869
			esac
1870
			ssldir=$withval
1871
			AC_SUBST(ssldir)
1867
			if test -d "$withval/lib"; then
1872
			if test -d "$withval/lib"; then
1868
				if test -n "${need_dash_r}"; then
1873
				if test -n "${need_dash_r}"; then
1869
					LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1874
					LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Lines 2216-2221 Link Here
2216
	)
2221
	)
2217
fi
2222
fi
2218
2223
2224
#Check for OpenSSL FIPS mode
2225
AC_ARG_WITH(fips,
2226
	[ --with-fips		Enable OpenSSL FIPS mode ],
2227
	[
2228
		if test "x$withval" != "xno" ; then
2229
			AC_CACHE_CHECK([for FIPS mode], ac_cv_fips, [
2230
				AC_TRY_COMPILE(
2231
					[ #include <openssl/fips.h> ],
2232
					[ FIPS_mode_set(1); ],
2233
					[ ac_cv_fips="yes" ],
2234
					[ ac_cv_fips"no" ]
2235
				)
2236
			])
2237
		fi
2238
	]
2239
)
2240
if test "x$ac_cv_fips" =  "xyes" ; then
2241
	CPPFLAGS="$CPPFLAGS -DOPENSLL_FIPS"
2242
	if test "x$HPUX" = "x" ; then
2243
		LIBS=`echo $LIBS | sed 's/-lcrypto /-wl,-Bstatic -lcrypto -wl,-Bdynamic /'`
2244
	else
2245
		LIBS=`echo $LIBS | sed 's/-lcrypto /-wl,-aarchive -lcrypto -wl,-adefault /'`
2246
	fi
2247
	FIPS_MODE=yes
2248
	AC_SUBST(FIPS_MODE)
2249
fi
2250
2219
# Do we want to force the use of the rand helper?
2251
# Do we want to force the use of the rand helper?
2220
AC_ARG_WITH(rand-helper,
2252
AC_ARG_WITH(rand-helper,
2221
	[  --with-rand-helper      Use subprocess to gather strong randomness ],
2253
	[  --with-rand-helper      Use subprocess to gather strong randomness ],
(-)openssh-5.3p1/contrib/redhat/sshd.init (-4 / +8 lines)
Lines 24-30 Link Here
24
# Some functions to make the below more readable
24
# Some functions to make the below more readable
25
KEYGEN=/usr/bin/ssh-keygen
25
KEYGEN=/usr/bin/ssh-keygen
26
SSHD=/usr/sbin/sshd
26
SSHD=/usr/sbin/sshd
27
RSA1_KEY=/etc/ssh/ssh_host_key
27
if [ "$OPENSSH_FIPS" ] ; then
28
	EXTRA_SSH_KEYGEN_RSA_FLAGS="-b 2048"
29
else
30
	RSA1_KEY=/etc/ssh/ssh_host_key
31
fi
28
RSA_KEY=/etc/ssh/ssh_host_rsa_key
32
RSA_KEY=/etc/ssh/ssh_host_rsa_key
29
DSA_KEY=/etc/ssh/ssh_host_dsa_key
33
DSA_KEY=/etc/ssh/ssh_host_dsa_key
30
PID_FILE=/var/run/sshd.pid
34
PID_FILE=/var/run/sshd.pid
Lines 32-38 Link Here
32
do_rsa1_keygen() {
36
do_rsa1_keygen() {
33
	if [ ! -s $RSA1_KEY ]; then
37
	if [ ! -s $RSA1_KEY ]; then
34
		echo -n $"Generating SSH1 RSA host key: "
38
		echo -n $"Generating SSH1 RSA host key: "
35
		if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then
39
		if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_RSA_FLAGS >&/dev/null; then
36
			chmod 600 $RSA1_KEY
40
			chmod 600 $RSA1_KEY
37
			chmod 644 $RSA1_KEY.pub
41
			chmod 644 $RSA1_KEY.pub
38
			if [ -x /sbin/restorecon ]; then
42
			if [ -x /sbin/restorecon ]; then
Lines 51-57 Link Here
51
do_rsa_keygen() {
55
do_rsa_keygen() {
52
	if [ ! -s $RSA_KEY ]; then
56
	if [ ! -s $RSA_KEY ]; then
53
		echo -n $"Generating SSH2 RSA host key: "
57
		echo -n $"Generating SSH2 RSA host key: "
54
		if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then
58
	if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N "" $EXTRA_SSH_KEYGEN_RSA_FLAGS >&/dev/null; then
55
			chmod 600 $RSA_KEY
59
			chmod 600 $RSA_KEY
56
			chmod 644 $RSA_KEY.pub
60
			chmod 644 $RSA_KEY.pub
57
			if [ -x /sbin/restorecon ]; then
61
			if [ -x /sbin/restorecon ]; then
Lines 70-76 Link Here
70
do_dsa_keygen() {
74
do_dsa_keygen() {
71
	if [ ! -s $DSA_KEY ]; then
75
	if [ ! -s $DSA_KEY ]; then
72
		echo -n $"Generating SSH2 DSA host key: "
76
		echo -n $"Generating SSH2 DSA host key: "
73
		if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then
77
		if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_DSA_FLAGS >&/dev/null; then
74
			chmod 600 $DSA_KEY
78
			chmod 600 $DSA_KEY
75
			chmod 644 $DSA_KEY.pub
79
			chmod 644 $DSA_KEY.pub
76
			if [ -x /sbin/restorecon ]; then
80
			if [ -x /sbin/restorecon ]; then
(-)openssh-5.3p1/fips.h (+1 lines)
Line 0 Link Here
1
extern int fips_mode;
(-)openssh-5.3p1/mac.c (-8 / +16 lines)
Lines 41-46 Link Here
41
#include "kex.h"
41
#include "kex.h"
42
#include "mac.h"
42
#include "mac.h"
43
#include "misc.h"
43
#include "misc.h"
44
#include "fips.h"
44
45
45
#include "umac.h"
46
#include "umac.h"
46
47
Lines 54-68 Link Here
54
	int		truncatebits;	/* truncate digest if != 0 */
55
	int		truncatebits;	/* truncate digest if != 0 */
55
	int		key_len;	/* just for UMAC */
56
	int		key_len;	/* just for UMAC */
56
	int		len;		/* just for UMAC */
57
	int		len;		/* just for UMAC */
58
	int		fips_allowed;
57
} macs[] = {
59
} macs[] = {
58
	{ "hmac-sha1",			SSH_EVP, EVP_sha1, 0, -1, -1 },
60
	{ "hmac-sha1",			SSH_EVP, EVP_sha1, 0, -1, -1, 1 },
59
	{ "hmac-sha1-96",		SSH_EVP, EVP_sha1, 96, -1, -1 },
61
	{ "hmac-sha1-96",		SSH_EVP, EVP_sha1, 96, -1, -1, 1 },
60
	{ "hmac-md5",			SSH_EVP, EVP_md5, 0, -1, -1 },
62
	{ "hmac-md5",			SSH_EVP, EVP_md5, 0, -1, -1, 0 },
61
	{ "hmac-md5-96",		SSH_EVP, EVP_md5, 96, -1, -1 },
63
	{ "hmac-md5-96",		SSH_EVP, EVP_md5, 96, -1, -1, 0 },
62
	{ "hmac-ripemd160",		SSH_EVP, EVP_ripemd160, 0, -1, -1 },
64
	{ "hmac-ripemd160",		SSH_EVP, EVP_ripemd160, 0, -1, -1, 0 },
63
	{ "hmac-ripemd160@openssh.com",	SSH_EVP, EVP_ripemd160, 0, -1, -1 },
65
	{ "hmac-ripemd160@openssh.com",	SSH_EVP, EVP_ripemd160, 0, -1, -1, 0 },
64
	{ "umac-64@openssh.com",	SSH_UMAC, NULL, 0, 128, 64 },
66
	{ "umac-64@openssh.com",	SSH_UMAC, NULL, 0, 128, 64, 0 },
65
	{ NULL,				0, NULL, 0, -1, -1 }
67
	{ NULL,				0, NULL, 0, -1, -1, 0 }
66
};
68
};
67
69
68
static void
70
static void
Lines 91-96 Link Here
91
93
92
	for (i = 0; macs[i].name; i++) {
94
	for (i = 0; macs[i].name; i++) {
93
		if (strcmp(name, macs[i].name) == 0) {
95
		if (strcmp(name, macs[i].name) == 0) {
96
			#ifdef OPENSSL_FIPS
97
			if (fips_mode && !macs[i].fips_allowed) {
98
				debug2("mac_init: %s disallowed in fips mode", name);
99
				return (-1);
100
			}
101
			#endif
94
			if (mac != NULL)
102
			if (mac != NULL)
95
				mac_setup_by_id(mac, i);
103
				mac_setup_by_id(mac, i);
96
			debug2("mac_setup: found %s", name);
104
			debug2("mac_setup: found %s", name);
(-)openssh-5.3p1/Makefile.in (+8 lines)
Lines 18-23 Link Here
18
piddir=@piddir@
18
piddir=@piddir@
19
srcdir=@srcdir@
19
srcdir=@srcdir@
20
top_srcdir=@top_srcdir@
20
top_srcdir=@top_srcdir@
21
ssldir=@ssldir@
21
22
22
DESTDIR=
23
DESTDIR=
23
VPATH=@srcdir@
24
VPATH=@srcdir@
Lines 29-34 Link Here
29
PRIVSEP_PATH=@PRIVSEP_PATH@
30
PRIVSEP_PATH=@PRIVSEP_PATH@
30
SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
31
SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
31
STRIP_OPT=@STRIP_OPT@
32
STRIP_OPT=@STRIP_OPT@
33
FIPS_MODE=@FIPS_MODE@
32
34
33
PATHS= -DSSHDIR=\"$(sysconfdir)\" \
35
PATHS= -DSSHDIR=\"$(sysconfdir)\" \
34
	-D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
36
	-D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
Lines 255-266 Link Here
255
	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
257
	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
256
	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
258
	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
257
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh
259
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh
260
	if [ ! -z "FIPS_MODE" ]; then \
261
		$(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh.sha1; \
262
	fi
258
	$(INSTALL) -m 0755 $(STRIP_OPT) scp $(DESTDIR)$(bindir)/scp
263
	$(INSTALL) -m 0755 $(STRIP_OPT) scp $(DESTDIR)$(bindir)/scp
259
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add $(DESTDIR)$(bindir)/ssh-add
264
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add $(DESTDIR)$(bindir)/ssh-add
260
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent $(DESTDIR)$(bindir)/ssh-agent
265
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent $(DESTDIR)$(bindir)/ssh-agent
261
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen
266
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen
262
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan
267
	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan
263
	$(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(sbindir)/sshd
268
	$(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(sbindir)/sshd
269
	if [ ! -z "FIPS_MODE" ]; then \
270
		$(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(bindir)/sshd.sha1;
271
	fi
264
	if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \
272
	if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \
265
		$(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \
273
		$(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \
266
	fi
274
	fi
(-)openssh-5.3p1/myproposal.h (+10 lines)
Lines 41-46 Link Here
41
#endif
41
#endif
42
42
43
#define	KEX_DEFAULT_PK_ALG	"ssh-rsa,ssh-dss"
43
#define	KEX_DEFAULT_PK_ALG	"ssh-rsa,ssh-dss"
44
#ifndef OPENSSL_FIPS
44
45
45
#define	KEX_DEFAULT_ENCRYPT \
46
#define	KEX_DEFAULT_ENCRYPT \
46
	"aes128-ctr,aes192-ctr,aes256-ctr," \
47
	"aes128-ctr,aes192-ctr,aes256-ctr," \
Lines 51-56 Link Here
51
	"hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160," \
52
	"hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160," \
52
	"hmac-ripemd160@openssh.com," \
53
	"hmac-ripemd160@openssh.com," \
53
	"hmac-sha1-96,hmac-md5-96"
54
	"hmac-sha1-96,hmac-md5-96"
55
#else
56
#define KEX_DEFAULT_ENCRYPT \
57
	"aes128-cbc,3des-cbc," \
58
	"aes128192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se," \
59
	"aes128-ctr,aes192-ctr,aes256-ctr"
60
#define KEX_DEFAULT_MAC \
61
	"hmac_sha1," \
62
	"hmac-sha1-96"
63
#endif
54
#define	KEX_DEFAULT_COMP	"none,zlib@openssh.com,zlib"
64
#define	KEX_DEFAULT_COMP	"none,zlib@openssh.com,zlib"
55
#define	KEX_DEFAULT_LANG	""
65
#define	KEX_DEFAULT_LANG	""
56
66
(-)openssh-5.3p1/openbsd-compat/bsd-arc4random.c (+26 lines)
Lines 30-35 Link Here
30
#include <openssl/rc4.h>
30
#include <openssl/rc4.h>
31
#include <openssl/err.h>
31
#include <openssl/err.h>
32
32
33
#ifdef OPENSSL_FIPS
34
#inclulde "fips.h"
35
#endif
36
33
/* Size of key to use */
37
/* Size of key to use */
34
#define SEED_SIZE 20
38
#define SEED_SIZE 20
35
39
Lines 46-57 Link Here
46
	static int first_time = 1;
50
	static int first_time = 1;
47
51
48
	if (rc4_ready <= 0) {
52
	if (rc4_ready <= 0) {
53
#ifndef OPENSSL_FIPS
49
		if (first_time)
54
		if (first_time)
50
			seed_rng();
55
			seed_rng();
56
#endif
51
		first_time = 0;
57
		first_time = 0;
52
		arc4random_stir();
58
		arc4random_stir();
53
	}
59
	}
54
60
61
#ifdef OPENSSL_FIPS
62
	if (fips_mode) {
63
		if (RAND_bytes(&r,sizeof(r)) <= 0) {
64
			ERR_load_crypto_strings();
65
			ERR_print_errors_fp(stderr);
66
			return 1/0;
67
		}
68
	rc4_ready -= sizeof(r);
69
70
	return(r);
71
	}
72
#endif
55
	RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r);
73
	RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r);
56
74
57
	rc4_ready -= sizeof(r);
75
	rc4_ready -= sizeof(r);
Lines 65-70 Link Here
65
	unsigned char rand_buf[SEED_SIZE];
83
	unsigned char rand_buf[SEED_SIZE];
66
	int i;
84
	int i;
67
85
86
#ifdef OPENSSL_FIPS
87
	if (fips_mode) {
88
		rc4_ready = REKEY_BYTES;
89
		return;
90
	}
91
#endif
92
93
68
	memset(&rc4, 0, sizeof(rc4));
94
	memset(&rc4, 0, sizeof(rc4));
69
	if (RAND_bytes(rand_buf, sizeof(rand_buf)) <= 0)
95
	if (RAND_bytes(rand_buf, sizeof(rand_buf)) <= 0)
70
		fatal("Couldn't obtain random bytes (error %ld)",
96
		fatal("Couldn't obtain random bytes (error %ld)",
(-)openssh-5.3p1/readconf.c (-3 / +14 lines)
Lines 131-136 Link Here
131
	oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
131
	oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
132
	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
132
	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
133
	oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication,
133
	oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication,
134
	oFipsMode,
134
	oDeprecated, oUnsupported
135
	oDeprecated, oUnsupported
135
} OpCodes;
136
} OpCodes;
136
137
Lines 227-232 Link Here
227
	{ "tunneldevice", oTunnelDevice },
228
	{ "tunneldevice", oTunnelDevice },
228
	{ "localcommand", oLocalCommand },
229
	{ "localcommand", oLocalCommand },
229
	{ "permitlocalcommand", oPermitLocalCommand },
230
	{ "permitlocalcommand", oPermitLocalCommand },
231
	{ "fipsmode", oFipsMode};
230
	{ "visualhostkey", oVisualHostKey },
232
	{ "visualhostkey", oVisualHostKey },
231
	{ "useroaming", oUseRoaming },
233
	{ "useroaming", oUseRoaming },
232
#ifdef JPAKE
234
#ifdef JPAKE
Lines 911-916 Link Here
911
		intptr = &options->permit_local_command;
913
		intptr = &options->permit_local_command;
912
		goto parse_flag;
914
		goto parse_flag;
913
915
916
	case oFipsMode;
917
		intptr = &options->fips_mode
918
		goto parse_flag;
919
914
	case oVisualHostKey:
920
	case oVisualHostKey:
915
		intptr = &options->visual_host_key;
921
		intptr = &options->visual_host_key;
916
		goto parse_flag;
922
		goto parse_flag;
Lines 1068-1073 Link Here
1068
	options->tun_remote = -1;
1074
	options->tun_remote = -1;
1069
	options->local_command = NULL;
1075
	options->local_command = NULL;
1070
	options->permit_local_command = -1;
1076
	options->permit_local_command = -1;
1077
	options->fips_mode = -1;
1071
	options->use_roaming = -1;
1078
	options->use_roaming = -1;
1072
	options->visual_host_key = -1;
1079
	options->visual_host_key = -1;
1073
	options->zero_knowledge_password_authentication = -1;
1080
	options->zero_knowledge_password_authentication = -1;
Lines 1138-1146 Link Here
1138
	/* Selected in ssh_login(). */
1145
	/* Selected in ssh_login(). */
1139
	if (options->cipher == -1)
1146
	if (options->cipher == -1)
1140
		options->cipher = SSH_CIPHER_NOT_SET;
1147
		options->cipher = SSH_CIPHER_NOT_SET;
1141
	/* options->ciphers, default set in myproposals.h */
1148
	/* options->ciphers, default set in myproposal.h */
1142
	/* options->macs, default set in myproposals.h */
1149
	/* options->macs, default set in myproposal.h */
1143
	/* options->hostkeyalgorithms, default set in myproposals.h */
1150
	/* options->hostkeyalgorithms, default set in myproposal.h */
1144
	if (options->protocol == SSH_PROTO_UNKNOWN)
1151
	if (options->protocol == SSH_PROTO_UNKNOWN)
1145
		options->protocol = SSH_PROTO_1|SSH_PROTO_2;
1152
		options->protocol = SSH_PROTO_1|SSH_PROTO_2;
1146
	if (options->num_identity_files == 0) {
1153
	if (options->num_identity_files == 0) {
Lines 1205-1210 Link Here
1205
		options->tun_remote = SSH_TUNID_ANY;
1212
		options->tun_remote = SSH_TUNID_ANY;
1206
	if (options->permit_local_command == -1)
1213
	if (options->permit_local_command == -1)
1207
		options->permit_local_command = 0;
1214
		options->permit_local_command = 0;
1215
	if (options->fips_mode == -1)
1216
		options->fips_mode = 0;
1217
	if (options->fips_mode && options->macs == NULL)
1218
		options->macs = "hmac-sha,hmac-sha1-96";
1208
	if (options->use_roaming == -1)
1219
	if (options->use_roaming == -1)
1209
		options->use_roaming = 1;
1220
		options->use_roaming = 1;
1210
	if (options->visual_host_key == -1)
1221
	if (options->visual_host_key == -1)
(-)openssh-5.3p1/readconf.h (+1 lines)
Lines 121-126 Link Here
121
121
122
	char	*local_command;
122
	char	*local_command;
123
	int	permit_local_command;
123
	int	permit_local_command;
124
	int	fips_mode;
124
	int	visual_host_key;
125
	int	visual_host_key;
125
126
126
	int	use_roaming;
127
	int	use_roaming;
(-)openssh-5.3p1/servconf.c (+14 lines)
Lines 107-112 Link Here
107
	options->num_allow_groups = 0;
107
	options->num_allow_groups = 0;
108
	options->num_deny_groups = 0;
108
	options->num_deny_groups = 0;
109
	options->ciphers = NULL;
109
	options->ciphers = NULL;
110
	#ifdef OPENSSL_FIPS
111
		options->macs = "hmac-sha1,hmac-sha1-96";
112
	#else
113
		options->macs = NULL;
114
	#endif
110
	options->macs = NULL;
115
	options->macs = NULL;
111
	options->protocol = SSH_PROTO_UNKNOWN;
116
	options->protocol = SSH_PROTO_UNKNOWN;
112
	options->gateway_ports = -1;
117
	options->gateway_ports = -1;
Lines 126-131 Link Here
126
	options->permit_tun = -1;
131
	options->permit_tun = -1;
127
	options->num_permitted_opens = -1;
132
	options->num_permitted_opens = -1;
128
	options->adm_forced_command = NULL;
133
	options->adm_forced_command = NULL;
134
	options->fips_mode = -1;
129
	options->chroot_directory = NULL;
135
	options->chroot_directory = NULL;
130
	options->zero_knowledge_password_authentication = -1;
136
	options->zero_knowledge_password_authentication = -1;
131
}
137
}
Lines 259-264 Link Here
259
		options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS;
265
		options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS;
260
	if (options->permit_tun == -1)
266
	if (options->permit_tun == -1)
261
		options->permit_tun = SSH_TUNMODE_NO;
267
		options->permit_tun = SSH_TUNMODE_NO;
268
	if (options->fips_mode == -1)
269
		options->fips_mode = 0;
262
	if (options->zero_knowledge_password_authentication == -1)
270
	if (options->zero_knowledge_password_authentication == -1)
263
		options->zero_knowledge_password_authentication = 0;
271
		options->zero_knowledge_password_authentication = 0;
264
272
Lines 305-310 Link Here
305
	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
313
	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
306
	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
314
	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
307
	sUsePrivilegeSeparation, sAllowAgentForwarding,
315
	sUsePrivilegeSeparation, sAllowAgentForwarding,
316
	sFipsMode,
308
	sZeroKnowledgePasswordAuthentication,
317
	sZeroKnowledgePasswordAuthentication,
309
	sDeprecated, sUnsupported
318
	sDeprecated, sUnsupported
310
} ServerOpCodes;
319
} ServerOpCodes;
Lines 423-428 Link Here
423
	{ "match", sMatch, SSHCFG_ALL },
432
	{ "match", sMatch, SSHCFG_ALL },
424
	{ "permitopen", sPermitOpen, SSHCFG_ALL },
433
	{ "permitopen", sPermitOpen, SSHCFG_ALL },
425
	{ "forcecommand", sForceCommand, SSHCFG_ALL },
434
	{ "forcecommand", sForceCommand, SSHCFG_ALL },
435
	{ "fipsmode", sFipsMode, SSHCFG_GLOBAL },
426
	{ "chrootdirectory", sChrootDirectory, SSHCFG_ALL },
436
	{ "chrootdirectory", sChrootDirectory, SSHCFG_ALL },
427
	{ NULL, sBadOption, 0 }
437
	{ NULL, sBadOption, 0 }
428
};
438
};
Lines 1294-1299 Link Here
1294
			*charptr = xstrdup(arg);
1304
			*charptr = xstrdup(arg);
1295
		break;
1305
		break;
1296
1306
1307
	case sFipsMode:
1308
		intptr = &options->fips_mode;
1309
		goto parse_flag;
1310
1297
	case sDeprecated:
1311
	case sDeprecated:
1298
		logit("%s line %d: Deprecated option %s",
1312
		logit("%s line %d: Deprecated option %s",
1299
		    filename, linenum, arg);
1313
		    filename, linenum, arg);
(-)openssh-5.3p1/servconf.h (+2 lines)
Lines 150-155 Link Here
150
150
151
	int	num_permitted_opens;
151
	int	num_permitted_opens;
152
152
153
	int	fips_mode;
154
153
	char   *chroot_directory;
155
	char   *chroot_directory;
154
}       ServerOptions;
156
}       ServerOptions;
155
157
(-)openssh-5.3p1/ssh-add.c (+11 lines)
Lines 62-71 Link Here
62
#include "authfile.h"
62
#include "authfile.h"
63
#include "pathnames.h"
63
#include "pathnames.h"
64
#include "misc.h"
64
#include "misc.h"
65
#include "fips.h"
65
66
66
/* argv0 */
67
/* argv0 */
67
extern char *__progname;
68
extern char *__progname;
68
69
70
/*
71
 * FIPS mode operation
72
*/
73
#ifdef OPENSSL_FIPS
74
	int fips_mode = 0;
75
#endif
69
/* Default files to add */
76
/* Default files to add */
70
static char *default_files[] = {
77
static char *default_files[] = {
71
	_PATH_SSH_CLIENT_ID_RSA,
78
	_PATH_SSH_CLIENT_ID_RSA,
Lines 338-343 Link Here
338
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
345
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
339
	sanitise_stdfd();
346
	sanitise_stdfd();
340
347
348
	#ifdef OPENSSL_FIPS
349
	if (getenv("OPENSSH_FIPS")) fips_mode=1;
350
	#endif
351
341
	__progname = ssh_get_progname(argv[0]);
352
	__progname = ssh_get_progname(argv[0]);
342
	init_rng();
353
	init_rng();
343
	seed_rng();
354
	seed_rng();
(-)openssh-5.3p1/ssh-agent.c (+12 lines)
Lines 75-80 Link Here
75
#include "compat.h"
75
#include "compat.h"
76
#include "log.h"
76
#include "log.h"
77
#include "misc.h"
77
#include "misc.h"
78
#include "fips.h"
79
80
/*
81
 * FIPS operational mode
82
*/
83
#ifdef OPENSSL_FIPS
84
	int fips_mode = 0;
85
#endif 
78
86
79
#ifdef SMARTCARD
87
#ifdef SMARTCARD
80
#include "scard.h"
88
#include "scard.h"
Lines 1063-1068 Link Here
1063
	struct timeval *tvp = NULL;
1071
	struct timeval *tvp = NULL;
1064
	size_t len;
1072
	size_t len;
1065
1073
1074
	#ifdef OPENSSL_FIPS
1075
	if (getenv("OPENSSH_FIPS")) fips_mode = 1;
1076
	#endif
1077
1066
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
1078
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
1067
	sanitise_stdfd();
1079
	sanitise_stdfd();
1068
1080
(-)openssh-5.3p1/ssh.c (-2 / +57 lines)
Lines 72-77 Link Here
72
72
73
#include <openssl/evp.h>
73
#include <openssl/evp.h>
74
#include <openssl/err.h>
74
#include <openssl/err.h>
75
#ifdef OPENSSL_FIPS
76
	#include <openssl/fips.h>
77
	#include <openssl/rand.h>
78
	#include <openssl/fips_rand.h>
79
#endif
75
#include "openbsd-compat/openssl-compat.h"
80
#include "openbsd-compat/openssl-compat.h"
76
#include "openbsd-compat/sys-queue.h"
81
#include "openbsd-compat/sys-queue.h"
77
82
Lines 101-106 Link Here
101
#include "msg.h"
106
#include "msg.h"
102
#include "uidswap.h"
107
#include "uidswap.h"
103
#include "version.h"
108
#include "version.h"
109
#include "fips.h"
110
111
/*
112
 * FIPS Mode operation
113
*/
114
#ifdef OPENSSL_FIPS
115
	int fips_mode = 1; //refined later
116
#else
117
	int fips_mode = 0;
118
#endif
104
119
105
#ifdef SMARTCARD
120
#ifdef SMARTCARD
106
#include "scard.h"
121
#include "scard.h"
Lines 175-186 Link Here
175
extern u_int muxclient_command;
190
extern u_int muxclient_command;
176
191
177
/* Prints a help message to the user.  This function never returns. */
192
/* Prints a help message to the user.  This function never returns. */
193
#ifdef OPENSSL_FIPS
194
	#define FIPS_OPTS "Z"
195
#else
196
	#define FIPS_OPTS
197
#endif
178
198
179
static void
199
static void
180
usage(void)
200
usage(void)
181
{
201
{
182
	fprintf(stderr,
202
	fprintf(stderr,
183
"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n"
203
"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy" FIPS_OPTS"] [-b bind_address] [-c cipher_spec]\n"
184
"           [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
204
"           [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
185
"           [-i identity_file] [-L [bind_address:]port:host:hostport]\n"
205
"           [-i identity_file] [-L [bind_address:]port:host:hostport]\n"
186
"           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
206
"           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
Lines 275-282 Link Here
275
295
276
 again:
296
 again:
277
	while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
297
	while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
278
	    "ACD:F:I:KL:MNO:PR:S:TVw:XYy")) != -1) {
298
	    "ACD:F:I:KL:MNO:PR:S:TVw:XYy" FIPS_OPTS "")) != -1) {
279
		switch (opt) {
299
		switch (opt) {
300
		#ifdef OPENSSL_FIPS
301
		case 'Z':
302
			fips_mode = 0;
303
			break;
304
		#endif
280
		case '1':
305
		case '1':
281
			options.protocol = SSH_PROTO_1;
306
			options.protocol = SSH_PROTO_1;
282
			break;
307
			break;
Lines 634-639 Link Here
634
	log_init(argv0, options.log_level, SYSLOG_FACILITY_USER, !use_syslog);
659
	log_init(argv0, options.log_level, SYSLOG_FACILITY_USER, !use_syslog);
635
660
636
	seed_rng();
661
	seed_rng();
662
	#ifdef OPENSSL_FIPS
663
	/*
664
		Priority Setting:
665
		!command line
666
		env OPENSSH_FIPS
667
		!env OPENSSH_NO_FIPS
668
		ssh_config options (default: false)
669
	*/
670
	if (fips_mode) { /* !command line */
671
		if (getenv("OPENSSH_FIPS")) { /* env OPENSSH_FIPS */
672
		}
673
		else if (getenv("OPENSSH_NO_FIPS")) { /*  !env OPENSSH_NO_FIPS */
674
			fips_mode = 0;
675
		}
676
		else if (options.fips_mode == 0) {[ /* ssh_config options */
677
			fips_mode = 0;
678
		}
679
	}
680
	if(fips_mode)
681
	{
682
		if(!FIPS_mode_set(1))
683
		{
684
			ERR_load_crypto_strings();
685
			ERR_print_errors_fp(stderr);
686
			exit(1);
687
		}
688
		else
689
			fprintf(stderr,:*** IN FIPS MODE ***\n:);
690
	}
691
	#endif
637
692
638
	if (options.user == NULL)
693
	if (options.user == NULL)
639
		options.user = xstrdup(pw->pw_name);
694
		options.user = xstrdup(pw->pw_name);
(-)openssh-5.3p1/sshconnect2.c (-1 / +9 lines)
Lines 70-75 Link Here
70
#include "uidswap.h"
70
#include "uidswap.h"
71
#include "schnorr.h"
71
#include "schnorr.h"
72
#include "jpake.h"
72
#include "jpake.h"
73
#include "fips.h"
73
74
74
#ifdef GSSAPI
75
#ifdef GSSAPI
75
#include "ssh-gss.h"
76
#include "ssh-gss.h"
Lines 475-480 Link Here
475
	char *pkalg, *fp;
476
	char *pkalg, *fp;
476
	u_char *pkblob;
477
	u_char *pkblob;
477
478
479
	enum fp_type dgst_type = SSH_FP_MD5;
480
	#ifdef OPENSSL_FIPS
481
		if (fips_mode) {
482
			dgst_type = SSH_FP_SHA1;
483
		}
484
	#endif
485
478
	if (authctxt == NULL)
486
	if (authctxt == NULL)
479
		fatal("input_userauth_pk_ok: no authentication context");
487
		fatal("input_userauth_pk_ok: no authentication context");
480
	if (datafellows & SSH_BUG_PKOK) {
488
	if (datafellows & SSH_BUG_PKOK) {
Lines 507-513 Link Here
507
		    key->type, pktype);
515
		    key->type, pktype);
508
		goto done;
516
		goto done;
509
	}
517
	}
510
	fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
518
	fp = key_fingerprint(key, dgst_type, SSH_FP_HEX);
511
	debug2("input_userauth_pk_ok: fp %s", fp);
519
	debug2("input_userauth_pk_ok: fp %s", fp);
512
	xfree(fp);
520
	xfree(fp);
513
521
(-)openssh-5.3p1/sshconnect.c (-5 / +26 lines)
Lines 58-63 Link Here
58
#include "dns.h"
58
#include "dns.h"
59
#include "roaming.h"
59
#include "roaming.h"
60
#include "version.h"
60
#include "version.h"
61
#include "fips.h"
61
62
62
char *client_version_string = NULL;
63
char *client_version_string = NULL;
63
char *server_version_string = NULL;
64
char *server_version_string = NULL;
Lines 596-601 Link Here
596
	char msg[1024];
597
	char msg[1024];
597
	int len, host_line, ip_line, cancelled_forwarding = 0;
598
	int len, host_line, ip_line, cancelled_forwarding = 0;
598
	const char *host_file = NULL, *ip_file = NULL;
599
	const char *host_file = NULL, *ip_file = NULL;
600
	enum fp_type dgst_type = SSH_FP_MD5;
601
	#ifdef OPENSSL_FIPS
602
		if (fips_mode) {
603
			dgst_type = SSH_FP_SHA1;
604
		}
605
	#endif
599
606
600
	/*
607
	/*
601
	 * Force accepting of the host key for loopback/localhost. The
608
	 * Force accepting of the host key for loopback/localhost. The
Lines 767-774 Link Here
767
			else
774
			else
768
				snprintf(msg1, sizeof(msg1), ".");
775
				snprintf(msg1, sizeof(msg1), ".");
769
			/* The default */
776
			/* The default */
770
			fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX);
777
			fp = key_fingerprint(host_key, dgst_type, SSH_FP_HEX);
771
			ra = key_fingerprint(host_key, SSH_FP_MD5,
778
			ra = key_fingerprint(host_key, dgst_type,
772
			    SSH_FP_RANDOMART);
779
			    SSH_FP_RANDOMART);
773
			msg2[0] = '\0';
780
			msg2[0] = '\0';
774
			if (options.verify_host_key_dns) {
781
			if (options.verify_host_key_dns) {
Lines 1076-1086 Link Here
1076
	char *fp, *ra;
1083
	char *fp, *ra;
1077
	int line, ret;
1084
	int line, ret;
1078
1085
1086
	enum_fp_type dgst_type = SSH_FP_MD5;
1087
	#ifdef OPENSSL_FIPS
1088
	if (fips_mode) {
1089
		dgst_type = SSH_FP_SHA1;
1090
	}
1091
	#endif
1092
1079
	found = key_new(keytype);
1093
	found = key_new(keytype);
1080
	if ((ret = lookup_key_in_hostfile_by_type(file, host,
1094
	if ((ret = lookup_key_in_hostfile_by_type(file, host,
1081
	    keytype, found, &line))) {
1095
	    keytype, found, &line))) {
1082
		fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX);
1096
		fp = key_fingerprint(found, dgst_type, SSH_FP_HEX);
1083
		ra = key_fingerprint(found, SSH_FP_MD5, SSH_FP_RANDOMART);
1097
		ra = key_fingerprint(found, dgst_type, SSH_FP_RANDOMART);
1084
		logit("WARNING: %s key found for host %s\n"
1098
		logit("WARNING: %s key found for host %s\n"
1085
		    "in %s:%d\n"
1099
		    "in %s:%d\n"
1086
		    "%s key fingerprint %s.\n%s\n",
1100
		    "%s key fingerprint %s.\n%s\n",
Lines 1132-1138 Link Here
1132
	char *fp;
1146
	char *fp;
1133
	const char *type = key_type(host_key);
1147
	const char *type = key_type(host_key);
1134
1148
1135
	fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX);
1149
	enum fp_type dgst_type = SSH_FP_MD5;
1150
	#ifdef OPENSSL_FIPS
1151
		if (fips_mode) {
1152
			dgst_type = SSH_FP_SHA1;
1153
		}
1154
	#endif
1155
1156
	fp = key_fingerprint(host_key, dgst_type, SSH_FP_HEX);
1136
1157
1137
	error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
1158
	error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
1138
	error("@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @");
1159
	error("@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @");
(-)openssh-5.3p1/sshd.c (+122 lines)
Lines 76-81 Link Here
76
#include <openssl/bn.h>
76
#include <openssl/bn.h>
77
#include <openssl/md5.h>
77
#include <openssl/md5.h>
78
#include <openssl/rand.h>
78
#include <openssl/rand.h>
79
#ifdef OPENSSL_FIPS
80
	#include <fips.h>
81
	#include <openssl/fips.h>
82
	#include <openssl/fips_rand.h>
83
#endif
79
#include "openbsd-compat/openssl-compat.h"
84
#include "openbsd-compat/openssl-compat.h"
80
85
81
#ifdef HAVE_SECUREWARE
86
#ifdef HAVE_SECUREWARE
Lines 139-144 Link Here
139
144
140
extern char *__progname;
145
extern char *__progname;
141
146
147
/* FIPS mode operation indicator */
148
#ifdef OPENSSL_FIPS
149
	int fips_MODE = 1; //refined later
150
#else
151
	int fips_mode = 0;
152
#endif
153
142
/* Server configuration options. */
154
/* Server configuration options. */
143
ServerOptions options;
155
ServerOptions options;
144
156
Lines 415-422 Link Here
415
		major = PROTOCOL_MAJOR_1;
427
		major = PROTOCOL_MAJOR_1;
416
		minor = PROTOCOL_MINOR_1;
428
		minor = PROTOCOL_MINOR_1;
417
	}
429
	}
430
	#ifndef OPENSSL_FIPS
418
	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor,
431
	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor,
419
	    SSH_VERSION, newline);
432
	    SSH_VERSION, newline);
433
	#else
434
	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s FIPS", major, minor, SSH_VERSION, newline);
435
	#endif
420
	server_version_string = xstrdup(buf);
436
	server_version_string = xstrdup(buf);
421
437
422
	/* Send our protocol version identification. */
438
	/* Send our protocol version identification. */
Lines 579-592 Link Here
579
privsep_preauth_child(void)
595
privsep_preauth_child(void)
580
{
596
{
581
	u_int32_t rnd[256];
597
	u_int32_t rnd[256];
598
	u_char* buf=(u_char*)rnd;
582
	gid_t gidset[1];
599
	gid_t gidset[1];
583
600
584
	/* Enable challenge-response authentication for privilege separation */
601
	/* Enable challenge-response authentication for privilege separation */
585
	privsep_challenge_enable();
602
	privsep_challenge_enable();
586
603
604
	#ifndef OPENSSL_FIPS
587
	arc4random_stir();
605
	arc4random_stir();
588
	arc4random_buf(rnd, sizeof(rnd));
606
	arc4random_buf(rnd, sizeof(rnd));
589
	RAND_seed(rnd, sizeof(rnd));
607
	RAND_seed(rnd, sizeof(rnd));
608
	#else
609
	arc4random_stir();
610
	FIPS_rand_set_key(buf,buf+8);
611
	FIPS_rand_seed(buf+16,8);
612
	debug2("FIPS rand reseeded");
613
	#endif
590
614
591
	/* Demote the private keys to public keys. */
615
	/* Demote the private keys to public keys. */
592
	demote_sensitive_data();
616
	demote_sensitive_data();
Lines 617-628 Link Here
617
{
641
{
618
	int status;
642
	int status;
619
	pid_t pid;
643
	pid_t pid;
644
	#ifdef OPENSSL_FIPS
645
	u_char buf[24];
646
	#endif
620
647
621
	/* Set up unprivileged child process to deal with network data */
648
	/* Set up unprivileged child process to deal with network data */
622
	pmonitor = monitor_init();
649
	pmonitor = monitor_init();
623
	/* Store a pointer to the kex for later rekeying */
650
	/* Store a pointer to the kex for later rekeying */
624
	pmonitor->m_pkex = &xxx_kex;
651
	pmonitor->m_pkex = &xxx_kex;
625
652
653
	#ifdef OPENSSL_FIPS
654
	if(RAND_bytes(buf,sizeof buf) <= 0) {
655
		ERR_load_crypto_strings();
656
		ERR_print_errors_fp(stderr);
657
		fatal("privsep_preauth: RAND_bytes failed");
658
	}
659
	#endif
660
626
	pid = fork();
661
	pid = fork();
627
	if (pid == -1) {
662
	if (pid == -1) {
628
		fatal("fork of unprivileged child failed");
663
		fatal("fork of unprivileged child failed");
Lines 644-649 Link Here
644
		return (1);
679
		return (1);
645
	} else {
680
	} else {
646
		/* child */
681
		/* child */
682
		#ifdef OPENSSL_FIPS
683
		FIPS_rand_method()->cleanup();
684
		/* Always automagically seed PRNG */
685
		FIPS_rand_set_key(buf,buf+8);
686
		FIPS_rand_seed(buf+16,8);
687
		debug2("FIPS rand reseeded");
688
		#endif
647
689
648
		close(pmonitor->m_sendfd);
690
		close(pmonitor->m_sendfd);
649
691
Lines 658-663 Link Here
658
static void
700
static void
659
privsep_postauth(Authctxt *authctxt)
701
privsep_postauth(Authctxt *authctxt)
660
{
702
{
703
	#ifdef OPENSSL_FIPS
704
	u_char buf[24];
705
	#endif
661
	u_int32_t rnd[256];
706
	u_int32_t rnd[256];
662
707
663
#ifdef DISABLE_FD_PASSING
708
#ifdef DISABLE_FD_PASSING
Lines 673-678 Link Here
673
	/* New socket pair */
718
	/* New socket pair */
674
	monitor_reinit(pmonitor);
719
	monitor_reinit(pmonitor);
675
720
721
	#ifdef OPENSSL_FIPS
722
	if(RAND_bytes(buf,sizeof buf) <= 0) {
723
			ERR_load_crypto_strings();
724
			ERR_print_errors_fp(stderr);
725
		fatal("privsep_postauth: RAND_bytes failed");
726
	}
727
	#endif
728
676
	pmonitor->m_pid = fork();
729
	pmonitor->m_pid = fork();
677
	if (pmonitor->m_pid == -1)
730
	if (pmonitor->m_pid == -1)
678
		fatal("fork of unprivileged child failed");
731
		fatal("fork of unprivileged child failed");
Lines 686-691 Link Here
686
		exit(0);
739
		exit(0);
687
	}
740
	}
688
741
742
	#ifdef OPENSSL_FIPS
743
		FIPS_rand_method()->cleanup();
744
		/* Always automagivally seed PRNG */
745
		FIPS_rand_set_key(buf,buf+8);
746
		FIPS_rand_seed(buf+16,8);
747
		debug2("FIPS rand reseeded");
748
	#endif
749
689
	close(pmonitor->m_sendfd);
750
	close(pmonitor->m_sendfd);
690
751
691
	/* Demote the private keys to public keys. */
752
	/* Demote the private keys to public keys. */
Lines 1028-1033 Link Here
1028
	socklen_t fromlen;
1089
	socklen_t fromlen;
1029
	pid_t pid;
1090
	pid_t pid;
1030
1091
1092
	#ifdef OPENSSL_FIPS
1093
		u_char buf[24];
1094
	#endif
1095
1031
	/* setup fd set for accept */
1096
	/* setup fd set for accept */
1032
	fdset = NULL;
1097
	fdset = NULL;
1033
	maxfd = 0;
1098
	maxfd = 0;
Lines 1160-1165 Link Here
1160
				break;
1225
				break;
1161
			}
1226
			}
1162
1227
1228
			#ifdef OPENSSL_FIPS
1229
				if(RAND_bytes(buf,sizeof buf) <=0) {
1230
					ERR_load_crypto_strings();
1231
					ERR_print_errors_fp(stderr);
1232
				fatal("server_accept_loop: RAND_bytes failed");
1233
				}
1234
			#endif
1235
1163
			/*
1236
			/*
1164
			 * Normal production daemon.  Fork, and have
1237
			 * Normal production daemon.  Fork, and have
1165
			 * the child process the connection. The
1238
			 * the child process the connection. The
Lines 1176-1181 Link Here
1176
				 * the connection.
1249
				 * the connection.
1177
				 */
1250
				 */
1178
				platform_post_fork_child();
1251
				platform_post_fork_child();
1252
				#ifdef OPENSSL_FIPS
1253
					FIPS_rand_methods()->cleanup();
1254
					/*Always automaticlly seed PRNG */
1255
					FIPS_rand_set_key(buf,buf+8);
1256
					FIPS_rand_seed(buf+16,8);
1257
					debug2("FIPS rand reseeded");
1258
				#endif
1179
				startup_pipe = startup_p[1];
1259
				startup_pipe = startup_p[1];
1180
				close_startup_pipes();
1260
				close_startup_pipes();
1181
				close_listen_socks();
1261
				close_listen_socks();
Lines 1471-1476 Link Here
1471
	/* Fill in default values for those options not explicitly set. */
1551
	/* Fill in default values for those options not explicitly set. */
1472
	fill_default_server_options(&options);
1552
	fill_default_server_options(&options);
1473
1553
1554
	#ifdef OPENSSL_FIPS
1555
	/*
1556
		Priority Setting:
1557
			env OPENSSH_FIPS
1558
			!env OPENSSH_NO_FIPS
1559
			sshd_config options (default: false)
1560
	*/
1561
		if (fips_mode) {
1562
			if (getenv("OPENSSH_FIPS")) { /* env OPENSSH_FIPS */
1563
			}
1564
			else if (getenv("OPENSSH_NO_FIPS")) { /* !env OPENSSH_NO_FIPS */
1565
				fips_mode = 0;
1566
			}
1567
		}
1568
		if(fips_mode)
1569
		{
1570
			if(!FIPS_mode_set(1))
1571
			{
1572
				ERR_load_crypto_strings();
1573
				ERR_print_errors_fp(stderr);
1574
				exit(1);
1575
			}
1576
			else
1577
				fprint(stderr,"***IN FIPS MODE***\n");
1578
		}
1579
	#endif
1580
1474
	/* challenge-response is implemented via keyboard interactive */
1581
	/* challenge-response is implemented via keyboard interactive */
1475
	if (options.challenge_response_authentication)
1582
	if (options.challenge_response_authentication)
1476
		options.kbd_interactive_authentication = 1;
1583
		options.kbd_interactive_authentication = 1;
Lines 1633-1640 Link Here
1633
#ifdef TIOCNOTTY
1740
#ifdef TIOCNOTTY
1634
		int fd;
1741
		int fd;
1635
#endif /* TIOCNOTTY */
1742
#endif /* TIOCNOTTY */
1743
#ifdef OPENSSL_FIPS
1744
		u_char buf[24];
1745
		if(RAND_bytes(buf,sizeof buf) <= 0) {
1746
			ERR_load_crypto_strings();
1747
			ERR_print_errors_fp(srderr);
1748
		fatal("privsep_preauth: RAND_bytes failed");
1749
		}
1750
#endif
1636
		if (daemon(0, 0) < 0)
1751
		if (daemon(0, 0) < 0)
1637
			fatal("daemon() failed: %.200s", strerror(errno));
1752
			fatal("daemon() failed: %.200s", strerror(errno));
1753
#ifdef OPENSSL_FIPS
1754
		FIPS_rand_method()->cleanup();
1755
		/* Always automagically seed PRNG */
1756
		FIPS_rand_set_key(buf,buf+8);
1757
		FIPS_rand_seed(buf+16,8);
1758
		debug2("FIPS rand reseeded");
1759
#endif
1638
1760
1639
		/* Disconnect from the controlling tty. */
1761
		/* Disconnect from the controlling tty. */
1640
#ifdef TIOCNOTTY
1762
#ifdef TIOCNOTTY
(-)openssh-5.3p1/ssh-keygen.c (-2 / +17 lines)
Lines 48-53 Link Here
48
#include "match.h"
48
#include "match.h"
49
#include "hostfile.h"
49
#include "hostfile.h"
50
#include "dns.h"
50
#include "dns.h"
51
#include "fips.h"
52
53
/*
54
 * FIPS mode operation
55
*/
56
#ifdef OPENSSL_FIPS
57
	int fips_mode = 0;
58
#endif
51
59
52
#ifdef SMARTCARD
60
#ifdef SMARTCARD
53
#include "scard.h"
61
#include "scard.h"
Lines 1093-1098 Link Here
1093
	extern int optind;
1101
	extern int optind;
1094
	extern char *optarg;
1102
	extern char *optarg;
1095
1103
1104
	enum fp_type dgst_type = SSH_FP_MD5;
1105
	#ifdef OPENSSL_FIPS
1106
		if (getenv("OPENSSH_FIPS")) fips_mode = 1;
1107
		if (fips_mode) {
1108
			dgst_type = SSH_FP_SHA1;
1109
		}
1110
	#endif
1096
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
1111
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
1097
	sanitise_stdfd();
1112
	sanitise_stdfd();
1098
1113
Lines 1465-1472 Link Here
1465
	fclose(f);
1480
	fclose(f);
1466
1481
1467
	if (!quiet) {
1482
	if (!quiet) {
1468
		char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX);
1483
		char *fp = key_fingerprint(public, dgst_type, SSH_FP_HEX);
1469
		char *ra = key_fingerprint(public, SSH_FP_MD5,
1484
		char *ra = key_fingerprint(public, dsgt_type,
1470
		    SSH_FP_RANDOMART);
1485
		    SSH_FP_RANDOMART);
1471
		printf("Your public key has been saved in %s.\n",
1486
		printf("Your public key has been saved in %s.\n",
1472
		    identity_file);
1487
		    identity_file);
(-)openssh-5.3p1/ssh-keyscan.c (+12 lines)
Lines 46-51 Link Here
46
#include "misc.h"
46
#include "misc.h"
47
#include "hostfile.h"
47
#include "hostfile.h"
48
48
49
#include "fips.h"
50
/*
51
 * FIPS mode operation
52
*/
53
#ifdef OPENSSL_FIPS
54
	int fips_mode = 0;
55
#endif
56
49
/* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
57
/* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
50
   Default value is AF_UNSPEC means both IPv4 and IPv6. */
58
   Default value is AF_UNSPEC means both IPv4 and IPv6. */
51
int IPv4or6 = AF_UNSPEC;
59
int IPv4or6 = AF_UNSPEC;
Lines 730-735 Link Here
730
	extern int optind;
738
	extern int optind;
731
	extern char *optarg;
739
	extern char *optarg;
732
740
741
	#ifdef OPENSSL_FIPS
742
		if (getenv("OPENSSH_FIPS")) fips_mode = 1;
743
	#endif
744
733
	__progname = ssh_get_progname(argv[0]);
745
	__progname = ssh_get_progname(argv[0]);
734
	init_rng();
746
	init_rng();
735
	seed_rng();
747
	seed_rng();
(-)openssh-5.3p1/ssh-keysign.c (+12 lines)
Lines 52-57 Link Here
52
#include "pathnames.h"
52
#include "pathnames.h"
53
#include "readconf.h"
53
#include "readconf.h"
54
#include "uidswap.h"
54
#include "uidswap.h"
55
#include "fips.h"
56
57
/*
58
 * FIPS operational mode
59
*/
60
#ifdef OPENSSL_FIPS
61
	int fips_mode=0;
62
#endif
55
63
56
/* XXX readconf.c needs these */
64
/* XXX readconf.c needs these */
57
uid_t original_real_uid;
65
uid_t original_real_uid;
Lines 158-163 Link Here
158
	u_int slen, dlen;
166
	u_int slen, dlen;
159
	u_int32_t rnd[256];
167
	u_int32_t rnd[256];
160
168
169
	#ifdef OPENSSL_FIPS
170
		if (getenv("OPENSSH_FIPS")) fips_mode = 1;
171
	#endif
172
161
	/* Ensure that stdin and stdout are connected */
173
	/* Ensure that stdin and stdout are connected */
162
	if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2)
174
	if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2)
163
		exit(1);
175
		exit(1);
(-)openssh-5.3p1/ssh-rand-helper.c (+12 lines)
Lines 62-67 Link Here
62
#include "atomicio.h"
62
#include "atomicio.h"
63
#include "pathnames.h"
63
#include "pathnames.h"
64
#include "log.h"
64
#include "log.h"
65
#include "fips.h"
66
67
/*
68
 * FIPS operational mode
69
*/
70
#ifdef OPENSSL_FIPS
71
	int fips_mode = 0;
72
#endif
65
73
66
/* Number of bytes we write out */
74
/* Number of bytes we write out */
67
#define OUTPUT_SEED_SIZE	48
75
#define OUTPUT_SEED_SIZE	48
Lines 820-825 Link Here
820
	extern char *optarg;
828
	extern char *optarg;
821
	LogLevel ll;
829
	LogLevel ll;
822
830
831
#ifdef OPENSSL_FIPS
832
	if (getenv("OPENSSH_FIPS"))) fips_mode = 1;
833
#endif
834
823
	__progname = ssh_get_progname(argv[0]);
835
	__progname = ssh_get_progname(argv[0]);
824
	log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1);
836
	log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1);
825
837

Return to bug 1197