|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/auth2-pubkey.c.fips openssh-5.6p1/auth2-pubkey.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/auth2-pubkey.c.fips 2010-08-23 12:43:40.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/auth2-pubkey.c 2010-08-23 12:43:41.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
@@ -36,6 +36,7 @@
|
|
Jan F. Chadima |
974c89 |
#include <string.h>
|
|
Jan F. Chadima |
974c89 |
#include <time.h>
|
|
Tomáš Mráz |
d93958 |
#include <unistd.h>
|
|
Tomáš Mráz |
d93958 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
#include "xmalloc.h"
|
|
Tomáš Mráz |
d93958 |
#include "ssh.h"
|
|
Jan F. Chadima |
1b8a26 |
@@ -359,7 +360,7 @@ user_search_key_in_file(FILE *f, char *f
|
|
Tomáš Mráz |
d93958 |
found_key = 1;
|
|
Tomáš Mráz |
d93958 |
debug("matching key found: file %s, line %lu",
|
|
Tomáš Mráz |
d93958 |
file, linenum);
|
|
Tomáš Mráz |
d93958 |
- fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
+ fp = key_fingerprint(found, FIPS_mode() ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
verbose("Found matching %s key: %s",
|
|
Tomáš Mráz |
d93958 |
key_type(found), fp);
|
|
Tomáš Mráz |
d93958 |
xfree(fp);
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/authfile.c.fips openssh-5.6p1/authfile.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/authfile.c.fips 2010-08-05 05:05:16.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/authfile.c 2010-08-23 12:43:41.000000000 +0200
|
|
Jan F. Chadima |
974c89 |
@@ -146,8 +146,14 @@ key_save_private_rsa1(Key *key, const ch
|
|
Tomáš Mráz |
76f329 |
/* Allocate space for the private part of the key in the buffer. */
|
|
Tomáš Mráz |
76f329 |
cp = buffer_append_space(&encrypted, buffer_len(&buffer));
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
- cipher_set_key_string(&ciphercontext, cipher, passphrase,
|
|
Tomáš Mráz |
76f329 |
- CIPHER_ENCRYPT);
|
|
Tomáš Mráz |
76f329 |
+ if (cipher_set_key_string(&ciphercontext, cipher, passphrase,
|
|
Tomáš Mráz |
76f329 |
+ CIPHER_ENCRYPT) < 0) {
|
|
Tomáš Mráz |
76f329 |
+ error("cipher_set_key_string failed.");
|
|
Tomáš Mráz |
76f329 |
+ buffer_free(&encrypted);
|
|
Tomáš Mráz |
76f329 |
+ buffer_free(&buffer);
|
|
Tomáš Mráz |
76f329 |
+ return 0;
|
|
Tomáš Mráz |
76f329 |
+ }
|
|
Tomáš Mráz |
76f329 |
+
|
|
Tomáš Mráz |
76f329 |
cipher_crypt(&ciphercontext, cp,
|
|
Tomáš Mráz |
76f329 |
buffer_ptr(&buffer), buffer_len(&buffer));
|
|
Tomáš Mráz |
76f329 |
cipher_cleanup(&ciphercontext);
|
|
Jan F. Chadima |
974c89 |
@@ -421,8 +427,14 @@ key_load_private_rsa1(int fd, const char
|
|
Tomáš Mráz |
76f329 |
cp = buffer_append_space(&decrypted, buffer_len(&buffer));
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
/* Rest of the buffer is encrypted. Decrypt it using the passphrase. */
|
|
Tomáš Mráz |
76f329 |
- cipher_set_key_string(&ciphercontext, cipher, passphrase,
|
|
Tomáš Mráz |
76f329 |
- CIPHER_DECRYPT);
|
|
Tomáš Mráz |
76f329 |
+ if (cipher_set_key_string(&ciphercontext, cipher, passphrase,
|
|
Tomáš Mráz |
76f329 |
+ CIPHER_DECRYPT) < 0) {
|
|
Tomáš Mráz |
76f329 |
+ error("cipher_set_key_string failed.");
|
|
Tomáš Mráz |
76f329 |
+ buffer_free(&decrypted);
|
|
Tomáš Mráz |
76f329 |
+ buffer_free(&buffer);
|
|
Tomáš Mráz |
76f329 |
+ goto fail;
|
|
Tomáš Mráz |
76f329 |
+ }
|
|
Tomáš Mráz |
76f329 |
+
|
|
Tomáš Mráz |
76f329 |
cipher_crypt(&ciphercontext, cp,
|
|
Tomáš Mráz |
76f329 |
buffer_ptr(&buffer), buffer_len(&buffer));
|
|
Tomáš Mráz |
76f329 |
cipher_cleanup(&ciphercontext);
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/cipher.c.fips openssh-5.6p1/cipher.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/cipher.c.fips 2010-08-23 09:49:50.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/cipher.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
0a4fa5 |
@@ -40,6 +40,7 @@
|
|
Tomáš Mráz |
0a4fa5 |
#include <sys/types.h>
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/md5.h>
|
|
Tomáš Mráz |
d93958 |
+#include <openssl/fips.h>
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
0a4fa5 |
#include <string.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include <stdarg.h>
|
|
Tomáš Mráz |
0a4fa5 |
@@ -93,6 +94,22 @@ struct Cipher {
|
|
Tomáš Mráz |
0a4fa5 |
{ NULL, SSH_CIPHER_INVALID, 0, 0, 0, 0, NULL }
|
|
Tomáš Mráz |
0a4fa5 |
};
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
0a4fa5 |
+struct Cipher fips_ciphers[] = {
|
|
Tomáš Mráz |
0a4fa5 |
+ { "none", SSH_CIPHER_NONE, 8, 0, 0, 0, EVP_enc_null },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "3des", SSH_CIPHER_3DES, 8, 16, 0, 1, evp_ssh1_3des },
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
0a4fa5 |
+ { "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, 1, EVP_des_ede3_cbc },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, 0, 1, EVP_aes_128_cbc },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, 0, 1, EVP_aes_192_cbc },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, 0, 1, EVP_aes_256_cbc },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "rijndael-cbc@lysator.liu.se",
|
|
Tomáš Mráz |
0a4fa5 |
+ SSH_CIPHER_SSH2, 16, 32, 0, 1, EVP_aes_256_cbc },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, 0, evp_aes_128_ctr },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, 0, evp_aes_128_ctr },
|
|
Tomáš Mráz |
0a4fa5 |
+ { "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, 0, evp_aes_128_ctr },
|
|
Tomáš Mráz |
0a4fa5 |
+ { NULL, SSH_CIPHER_INVALID, 0, 0, 0, 0, NULL }
|
|
Tomáš Mráz |
0a4fa5 |
+};
|
|
Jan F. Chadima |
adad2a |
+
|
|
Tomáš Mráz |
0a4fa5 |
/*--*/
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
0a4fa5 |
u_int
|
|
Tomáš Mráz |
0a4fa5 |
@@ -135,7 +152,7 @@ Cipher *
|
|
Tomáš Mráz |
0a4fa5 |
cipher_by_name(const char *name)
|
|
Tomáš Mráz |
0a4fa5 |
{
|
|
Tomáš Mráz |
0a4fa5 |
Cipher *c;
|
|
Tomáš Mráz |
0a4fa5 |
- for (c = ciphers; c->name != NULL; c++)
|
|
Tomáš Mráz |
0a4fa5 |
+ for (c = FIPS_mode() ? fips_ciphers : ciphers; c->name != NULL; c++)
|
|
Tomáš Mráz |
0a4fa5 |
if (strcmp(c->name, name) == 0)
|
|
Tomáš Mráz |
0a4fa5 |
return c;
|
|
Tomáš Mráz |
0a4fa5 |
return NULL;
|
|
Tomáš Mráz |
0a4fa5 |
@@ -145,7 +162,7 @@ Cipher *
|
|
Tomáš Mráz |
0a4fa5 |
cipher_by_number(int id)
|
|
Tomáš Mráz |
0a4fa5 |
{
|
|
Tomáš Mráz |
0a4fa5 |
Cipher *c;
|
|
Tomáš Mráz |
0a4fa5 |
- for (c = ciphers; c->name != NULL; c++)
|
|
Tomáš Mráz |
0a4fa5 |
+ for (c = FIPS_mode() ? fips_ciphers : ciphers; c->name != NULL; c++)
|
|
Tomáš Mráz |
0a4fa5 |
if (c->number == id)
|
|
Tomáš Mráz |
0a4fa5 |
return c;
|
|
Tomáš Mráz |
0a4fa5 |
return NULL;
|
|
Tomáš Mráz |
0a4fa5 |
@@ -189,7 +206,7 @@ cipher_number(const char *name)
|
|
Tomáš Mráz |
0a4fa5 |
Cipher *c;
|
|
Tomáš Mráz |
0a4fa5 |
if (name == NULL)
|
|
Tomáš Mráz |
0a4fa5 |
return -1;
|
|
Tomáš Mráz |
0a4fa5 |
- for (c = ciphers; c->name != NULL; c++)
|
|
Tomáš Mráz |
0a4fa5 |
+ for (c = FIPS_mode() ? fips_ciphers : ciphers; c->name != NULL; c++)
|
|
Tomáš Mráz |
0a4fa5 |
if (strcasecmp(c->name, name) == 0)
|
|
Tomáš Mráz |
0a4fa5 |
return c->number;
|
|
Tomáš Mráz |
0a4fa5 |
return -1;
|
|
Tomáš Mráz |
76f329 |
@@ -296,14 +313,15 @@ cipher_cleanup(CipherContext *cc)
|
|
Tomáš Mráz |
76f329 |
* passphrase and using the resulting 16 bytes as the key.
|
|
Tomáš Mráz |
76f329 |
*/
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
-void
|
|
Tomáš Mráz |
76f329 |
+int
|
|
Tomáš Mráz |
76f329 |
cipher_set_key_string(CipherContext *cc, Cipher *cipher,
|
|
Tomáš Mráz |
76f329 |
const char *passphrase, int do_encrypt)
|
|
Tomáš Mráz |
76f329 |
{
|
|
Tomáš Mráz |
76f329 |
MD5_CTX md;
|
|
Tomáš Mráz |
76f329 |
u_char digest[16];
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
- MD5_Init(&md);
|
|
Tomáš Mráz |
76f329 |
+ if (MD5_Init(&md) <= 0)
|
|
Tomáš Mráz |
76f329 |
+ return -1;
|
|
Tomáš Mráz |
76f329 |
MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
|
|
Tomáš Mráz |
76f329 |
MD5_Final(digest, &md);
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
@@ -311,6 +329,7 @@ cipher_set_key_string(CipherContext *cc,
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
memset(digest, 0, sizeof(digest));
|
|
Tomáš Mráz |
76f329 |
memset(&md, 0, sizeof(md));
|
|
Tomáš Mráz |
76f329 |
+ return 0;
|
|
Tomáš Mráz |
76f329 |
}
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
/*
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/cipher-ctr.c.fips openssh-5.6p1/cipher-ctr.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/cipher-ctr.c.fips 2007-06-14 15:21:33.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/cipher-ctr.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
0a4fa5 |
@@ -140,7 +140,8 @@ evp_aes_128_ctr(void)
|
|
Tomáš Mráz |
0a4fa5 |
aes_ctr.do_cipher = ssh_aes_ctr;
|
|
Tomáš Mráz |
0a4fa5 |
#ifndef SSH_OLD_EVP
|
|
Tomáš Mráz |
0a4fa5 |
aes_ctr.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH |
|
|
Tomáš Mráz |
0a4fa5 |
- EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV;
|
|
Tomáš Mráz |
0a4fa5 |
+ EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV |
|
|
Tomáš Mráz |
0a4fa5 |
+ EVP_CIPH_FLAG_FIPS;
|
|
Jan F. Chadima |
adad2a |
#endif
|
|
Tomáš Mráz |
0a4fa5 |
return (&aes_ctr);
|
|
Tomáš Mráz |
0a4fa5 |
}
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/cipher.h.fips openssh-5.6p1/cipher.h
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/cipher.h.fips 2009-01-28 06:38:41.000000000 +0100
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/cipher.h 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
76f329 |
@@ -78,7 +78,7 @@ void cipher_init(CipherContext *, Ciphe
|
|
Tomáš Mráz |
76f329 |
const u_char *, u_int, int);
|
|
Tomáš Mráz |
76f329 |
void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int);
|
|
Tomáš Mráz |
76f329 |
void cipher_cleanup(CipherContext *);
|
|
Tomáš Mráz |
76f329 |
-void cipher_set_key_string(CipherContext *, Cipher *, const char *, int);
|
|
Tomáš Mráz |
76f329 |
+int cipher_set_key_string(CipherContext *, Cipher *, const char *, int);
|
|
Tomáš Mráz |
76f329 |
u_int cipher_blocksize(const Cipher *);
|
|
Tomáš Mráz |
76f329 |
u_int cipher_keylen(const Cipher *);
|
|
Tomáš Mráz |
76f329 |
u_int cipher_is_cbc(const Cipher *);
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/mac.c.fips openssh-5.6p1/mac.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/mac.c.fips 2008-06-13 02:58:50.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/mac.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
d93958 |
@@ -28,6 +28,7 @@
|
|
Tomáš Mráz |
d93958 |
#include <sys/types.h>
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
#include <openssl/hmac.h>
|
|
Tomáš Mráz |
d93958 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
#include <stdarg.h>
|
|
Tomáš Mráz |
d93958 |
#include <string.h>
|
|
Tomáš Mráz |
d93958 |
@@ -47,14 +48,14 @@
|
|
Tomáš Mráz |
d93958 |
#define SSH_EVP 1 /* OpenSSL EVP-based MAC */
|
|
Tomáš Mráz |
d93958 |
#define SSH_UMAC 2 /* UMAC (not integrated with OpenSSL) */
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
-struct {
|
|
Tomáš Mráz |
d93958 |
+struct Macs {
|
|
Tomáš Mráz |
d93958 |
char *name;
|
|
Tomáš Mráz |
d93958 |
int type;
|
|
Tomáš Mráz |
d93958 |
const EVP_MD * (*mdfunc)(void);
|
|
Tomáš Mráz |
d93958 |
int truncatebits; /* truncate digest if != 0 */
|
|
Tomáš Mráz |
d93958 |
int key_len; /* just for UMAC */
|
|
Tomáš Mráz |
d93958 |
int len; /* just for UMAC */
|
|
Tomáš Mráz |
d93958 |
-} macs[] = {
|
|
Tomáš Mráz |
d93958 |
+} all_macs[] = {
|
|
Tomáš Mráz |
d93958 |
{ "hmac-sha1", SSH_EVP, EVP_sha1, 0, -1, -1 },
|
|
Tomáš Mráz |
d93958 |
{ "hmac-sha1-96", SSH_EVP, EVP_sha1, 96, -1, -1 },
|
|
Tomáš Mráz |
d93958 |
{ "hmac-md5", SSH_EVP, EVP_md5, 0, -1, -1 },
|
|
Tomáš Mráz |
d93958 |
@@ -65,9 +66,15 @@ struct {
|
|
Tomáš Mráz |
d93958 |
{ NULL, 0, NULL, 0, -1, -1 }
|
|
Tomáš Mráz |
d93958 |
};
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
+struct Macs fips_macs[] = {
|
|
Tomáš Mráz |
d93958 |
+ { "hmac-sha1", SSH_EVP, EVP_sha1, 0, -1, -1 },
|
|
Tomáš Mráz |
d93958 |
+ { NULL, 0, NULL, 0, -1, -1 }
|
|
Tomáš Mráz |
d93958 |
+};
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
d93958 |
static void
|
|
Tomáš Mráz |
d93958 |
mac_setup_by_id(Mac *mac, int which)
|
|
Tomáš Mráz |
d93958 |
{
|
|
Tomáš Mráz |
d93958 |
+ struct Macs *macs = FIPS_mode() ? fips_macs : all_macs;
|
|
Tomáš Mráz |
d93958 |
int evp_len;
|
|
Tomáš Mráz |
d93958 |
mac->type = macs[which].type;
|
|
Tomáš Mráz |
d93958 |
if (mac->type == SSH_EVP) {
|
|
Tomáš Mráz |
d93958 |
@@ -88,6 +95,7 @@ int
|
|
Tomáš Mráz |
d93958 |
mac_setup(Mac *mac, char *name)
|
|
Tomáš Mráz |
d93958 |
{
|
|
Tomáš Mráz |
d93958 |
int i;
|
|
Tomáš Mráz |
d93958 |
+ struct Macs *macs = FIPS_mode() ? fips_macs : all_macs;
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
for (i = 0; macs[i].name; i++) {
|
|
Tomáš Mráz |
d93958 |
if (strcmp(name, macs[i].name) == 0) {
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/Makefile.in.fips openssh-5.6p1/Makefile.in
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/Makefile.in.fips 2010-08-23 12:43:40.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/Makefile.in 2010-08-23 12:46:24.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
@@ -141,25 +141,25 @@ libssh.a: $(LIBSSH_OBJS)
|
|
Tomáš Mráz |
0a4fa5 |
$(RANLIB) $@
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
0a4fa5 |
ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
|
|
Tomáš Mráz |
0a4fa5 |
- $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Tomáš Mráz |
0a4fa5 |
+ $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
0a4fa5 |
sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
|
|
Tomáš Mráz |
0a4fa5 |
- $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS)
|
|
Jan F. Chadima |
c54a8b |
+ $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(SSHDLIBS) $(LIBS)
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
0a4fa5 |
scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
|
|
Tomáš Mráz |
0a4fa5 |
$(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
0a4fa5 |
ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
|
|
Tomáš Mráz |
0a4fa5 |
- $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Tomáš Mráz |
0a4fa5 |
+ $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
974c89 |
ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o
|
|
Jan F. Chadima |
974c89 |
- $(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Jan F. Chadima |
82bc82 |
+ $(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
|
|
Jan F. Chadima |
a3ba41 |
|
|
Tomáš Mráz |
0a4fa5 |
ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
|
|
Tomáš Mráz |
0a4fa5 |
- $(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Tomáš Mráz |
0a4fa5 |
+ $(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
974c89 |
ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o roaming_dummy.o readconf.o
|
|
Jan F. Chadima |
c54a8b |
- $(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Jan F. Chadima |
c54a8b |
+ $(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Jan F. Chadima |
974c89 |
ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o
|
|
Jan F. Chadima |
1b8a26 |
$(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
|
|
Jan F. Chadima |
1b8a26 |
@@ -168,7 +168,7 @@ ssh-ldap-helper$(EXEEXT): $(LIBCOMPAT) l
|
|
Jan F. Chadima |
3fdf10 |
$(LD) -o $@ ldapconf.o ldapbody.o ldapmisc.o ldap-helper.o $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
|
|
Jan F. Chadima |
974c89 |
|
|
Jan F. Chadima |
c54a8b |
ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o
|
|
Jan F. Chadima |
c54a8b |
- $(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
|
|
Jan F. Chadima |
c54a8b |
+ $(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lfipscheck $(LIBS)
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o
|
|
Tomáš Mráz |
0a4fa5 |
$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/myproposal.h.fips openssh-5.6p1/myproposal.h
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/myproposal.h.fips 2010-04-16 07:56:22.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/myproposal.h 2010-08-23 12:43:41.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
@@ -58,7 +58,12 @@
|
|
Tomáš Mráz |
0a4fa5 |
"hmac-sha1-96,hmac-md5-96"
|
|
Tomáš Mráz |
0a4fa5 |
#define KEX_DEFAULT_COMP "none,zlib@openssh.com,zlib"
|
|
Tomáš Mráz |
0a4fa5 |
#define KEX_DEFAULT_LANG ""
|
|
Tomáš Mráz |
0a4fa5 |
-
|
|
Tomáš Mráz |
0a4fa5 |
+#define KEX_FIPS_ENCRYPT \
|
|
Tomáš Mráz |
0a4fa5 |
+ "aes128-ctr,aes192-ctr,aes256-ctr," \
|
|
Tomáš Mráz |
0a4fa5 |
+ "aes128-cbc,3des-cbc," \
|
|
Tomáš Mráz |
0a4fa5 |
+ "aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se"
|
|
Tomáš Mráz |
0a4fa5 |
+#define KEX_FIPS_MAC \
|
|
Tomáš Mráz |
0a4fa5 |
+ "hmac-sha1"
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
static char *myproposal[PROPOSAL_MAX] = {
|
|
Tomáš Mráz |
0a4fa5 |
KEX_DEFAULT_KEX,
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/openbsd-compat/bsd-arc4random.c.fips openssh-5.6p1/openbsd-compat/bsd-arc4random.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/openbsd-compat/bsd-arc4random.c.fips 2010-03-25 22:52:02.000000000 +0100
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/openbsd-compat/bsd-arc4random.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
d93958 |
@@ -39,6 +39,7 @@
|
|
Tomáš Mráz |
d93958 |
static int rc4_ready = 0;
|
|
Tomáš Mráz |
d93958 |
static RC4_KEY rc4;
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
+#if 0
|
|
Tomáš Mráz |
d93958 |
unsigned int
|
|
Tomáš Mráz |
d93958 |
arc4random(void)
|
|
Tomáš Mráz |
d93958 |
{
|
|
Tomáš Mráz |
d93958 |
@@ -82,6 +83,32 @@ arc4random_stir(void)
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
rc4_ready = REKEY_BYTES;
|
|
Tomáš Mráz |
d93958 |
}
|
|
Tomáš Mráz |
d93958 |
+#else
|
|
Tomáš Mráz |
d93958 |
+unsigned int
|
|
Tomáš Mráz |
d93958 |
+arc4random(void)
|
|
Tomáš Mráz |
d93958 |
+{
|
|
Tomáš Mráz |
d93958 |
+ unsigned int r = 0;
|
|
Tomáš Mráz |
d93958 |
+ void *rp = &r;
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
d93958 |
+ if (!rc4_ready) {
|
|
Tomáš Mráz |
d93958 |
+ arc4random_stir();
|
|
Tomáš Mráz |
d93958 |
+ }
|
|
Tomáš Mráz |
d93958 |
+ RAND_bytes(rp, sizeof(r));
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
d93958 |
+ return(r);
|
|
Tomáš Mráz |
d93958 |
+}
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
d93958 |
+void
|
|
Tomáš Mráz |
d93958 |
+arc4random_stir(void)
|
|
Tomáš Mráz |
d93958 |
+{
|
|
Tomáš Mráz |
d93958 |
+ unsigned char rand_buf[SEED_SIZE];
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
d93958 |
+ if (RAND_bytes(rand_buf, sizeof(rand_buf)) <= 0)
|
|
Tomáš Mráz |
d93958 |
+ fatal("Couldn't obtain random bytes (error %ld)",
|
|
Tomáš Mráz |
d93958 |
+ ERR_get_error());
|
|
Tomáš Mráz |
d93958 |
+ rc4_ready = 1;
|
|
Tomáš Mráz |
d93958 |
+}
|
|
Tomáš Mráz |
d93958 |
+#endif
|
|
Tomáš Mráz |
d93958 |
#endif /* !HAVE_ARC4RANDOM */
|
|
Tomáš Mráz |
d93958 |
|
|
Jan F. Chadima |
82bc82 |
#ifndef HAVE_ARC4RANDOM_BUF
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/ssh-add.c.fips openssh-5.6p1/ssh-add.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/ssh-add.c.fips 2010-05-21 06:56:47.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/ssh-add.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
685b62 |
@@ -42,6 +42,7 @@
|
|
Tomáš Mráz |
0a4fa5 |
#include <sys/param.h>
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
#include <openssl/evp.h>
|
|
Tomáš Mráz |
d93958 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/openssl-compat.h"
|
|
Tomáš Mráz |
d93958 |
|
|
Jan F. Chadima |
974c89 |
#include <fcntl.h>
|
|
Jan F. Chadima |
1b8a26 |
@@ -277,7 +278,7 @@ list_identities(AuthenticationConnection
|
|
Tomáš Mráz |
0a4fa5 |
key = ssh_get_next_identity(ac, &comment, version)) {
|
|
Tomáš Mráz |
0a4fa5 |
had_identities = 1;
|
|
Tomáš Mráz |
0a4fa5 |
if (do_fp) {
|
|
Tomáš Mráz |
0a4fa5 |
- fp = key_fingerprint(key, SSH_FP_MD5,
|
|
Tomáš Mráz |
0a4fa5 |
+ fp = key_fingerprint(key, FIPS_mode() ? SSH_FP_SHA1 : SSH_FP_MD5,
|
|
Tomáš Mráz |
0a4fa5 |
SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
printf("%d %s %s (%s)\n",
|
|
Tomáš Mráz |
0a4fa5 |
key_size(key), fp, comment, key_type(key));
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/ssh-agent.c.fips openssh-5.6p1/ssh-agent.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/ssh-agent.c.fips 2010-04-16 07:56:22.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/ssh-agent.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
685b62 |
@@ -51,6 +51,7 @@
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/evp.h>
|
|
Jan F. Chadima |
adad2a |
#include <openssl/md5.h>
|
|
Jan F. Chadima |
adad2a |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/openssl-compat.h"
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
0a4fa5 |
#include <errno.h>
|
|
Jan F. Chadima |
974c89 |
@@ -199,9 +200,9 @@ confirm_key(Identity *id)
|
|
Tomáš Mráz |
0a4fa5 |
char *p;
|
|
Tomáš Mráz |
0a4fa5 |
int ret = -1;
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
0a4fa5 |
- p = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
- if (ask_permission("Allow use of key %s?\nKey fingerprint %s.",
|
|
Tomáš Mráz |
0a4fa5 |
- id->comment, p))
|
|
Tomáš Mráz |
0a4fa5 |
+ p = key_fingerprint(id->key, FIPS_mode() ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
+ if (ask_permission("Allow use of key %s?\nKey %sfingerprint %s.",
|
|
Tomáš Mráz |
0a4fa5 |
+ id->comment, FIPS_mode() ? "SHA1 " : "", p))
|
|
Tomáš Mráz |
0a4fa5 |
ret = 0;
|
|
Tomáš Mráz |
0a4fa5 |
xfree(p);
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/ssh.c.fips openssh-5.6p1/ssh.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/ssh.c.fips 2010-08-16 17:59:31.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/ssh.c 2010-08-23 12:43:41.000000000 +0200
|
|
Jan F. Chadima |
c54a8b |
@@ -72,6 +72,8 @@
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/evp.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/err.h>
|
|
Tomáš Mráz |
d93958 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
d93958 |
+#include <fipscheck.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/openssl-compat.h"
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/sys-queue.h"
|
|
Tomáš Mráz |
d93958 |
|
|
Jan F. Chadima |
1b8a26 |
@@ -235,6 +237,10 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
0a4fa5 |
sanitise_stdfd();
|
|
Jan F. Chadima |
a3ba41 |
|
|
Tomáš Mráz |
0a4fa5 |
__progname = ssh_get_progname(av[0]);
|
|
Jan F. Chadima |
adad2a |
+ SSLeay_add_all_algorithms();
|
|
Tomáš Mráz |
d93958 |
+ if (FIPS_mode() && !FIPSCHECK_verify(NULL, NULL)) {
|
|
Tomáš Mráz |
0a4fa5 |
+ fatal("FIPS integrity verification test failed.");
|
|
Tomáš Mráz |
d93958 |
+ }
|
|
Jan F. Chadima |
adad2a |
init_rng();
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
/*
|
|
Jan F. Chadima |
1b8a26 |
@@ -301,6 +307,9 @@ main(int ac, char **av)
|
|
Jan F. Chadima |
974c89 |
"ACD:F:I:KL:MNO:PR:S:TVw:W:XYy")) != -1) {
|
|
Tomáš Mráz |
76f329 |
switch (opt) {
|
|
Tomáš Mráz |
76f329 |
case '1':
|
|
Tomáš Mráz |
76f329 |
+ if (FIPS_mode()) {
|
|
Tomáš Mráz |
76f329 |
+ fatal("Protocol 1 not allowed in the FIPS mode.");
|
|
Tomáš Mráz |
76f329 |
+ }
|
|
Tomáš Mráz |
76f329 |
options.protocol = SSH_PROTO_1;
|
|
Tomáš Mráz |
76f329 |
break;
|
|
Tomáš Mráz |
76f329 |
case '2':
|
|
Jan F. Chadima |
1b8a26 |
@@ -599,7 +608,6 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
0a4fa5 |
if (!host)
|
|
Tomáš Mráz |
0a4fa5 |
usage();
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
- SSLeay_add_all_algorithms();
|
|
Tomáš Mráz |
0a4fa5 |
ERR_load_crypto_strings();
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
/* Initialize the command to execute on remote host. */
|
|
Jan F. Chadima |
1b8a26 |
@@ -685,6 +693,10 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Jan F. Chadima |
adad2a |
seed_rng();
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
+ if (FIPS_mode()) {
|
|
Tomáš Mráz |
0a4fa5 |
+ logit("FIPS mode initialized");
|
|
Tomáš Mráz |
0a4fa5 |
+ }
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
if (options.user == NULL)
|
|
Tomáš Mráz |
0a4fa5 |
options.user = xstrdup(pw->pw_name);
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Jan F. Chadima |
1b8a26 |
@@ -752,6 +764,12 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
timeout_ms = options.connection_timeout * 1000;
|
|
Tomáš Mráz |
76f329 |
|
|
Tomáš Mráz |
76f329 |
+ if (FIPS_mode()) {
|
|
Tomáš Mráz |
76f329 |
+ options.protocol &= SSH_PROTO_2;
|
|
Tomáš Mráz |
76f329 |
+ if (options.protocol == 0)
|
|
Tomáš Mráz |
76f329 |
+ fatal("Protocol 2 disabled by configuration but required in the FIPS mode.");
|
|
Tomáš Mráz |
76f329 |
+ }
|
|
Tomáš Mráz |
76f329 |
+
|
|
Tomáš Mráz |
76f329 |
/* Open a connection to the remote host. */
|
|
Tomáš Mráz |
76f329 |
if (ssh_connect(host, &hostaddr, options.port,
|
|
Tomáš Mráz |
76f329 |
options.address_family, options.connection_attempts, &timeout_ms,
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/sshconnect2.c.fips openssh-5.6p1/sshconnect2.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/sshconnect2.c.fips 2010-08-23 12:43:41.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/sshconnect2.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
0a4fa5 |
@@ -44,6 +44,8 @@
|
|
Tomáš Mráz |
0a4fa5 |
#include <vis.h>
|
|
Tomáš Mráz |
0a4fa5 |
#endif
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/sys-queue.h"
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
#include "xmalloc.h"
|
|
Jan F. Chadima |
c54a8b |
@@ -116,6 +118,10 @@ ssh_kex2(char *host, struct sockaddr *ho
|
|
Tomáš Mráz |
0a4fa5 |
if (options.ciphers != NULL) {
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;
|
|
Tomáš Mráz |
0a4fa5 |
+ } else if (FIPS_mode()) {
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_ENC_ALGS_STOC] = KEX_FIPS_ENCRYPT;
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
}
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]);
|
|
Jan F. Chadima |
c54a8b |
@@ -131,7 +137,11 @@ ssh_kex2(char *host, struct sockaddr *ho
|
|
Tomáš Mráz |
0a4fa5 |
if (options.macs != NULL) {
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
|
|
Tomáš Mráz |
0a4fa5 |
+ } else if (FIPS_mode()) {
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_MAC_ALGS_STOC] = KEX_FIPS_MAC;
|
|
Tomáš Mráz |
0a4fa5 |
}
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
if (options.hostkeyalgorithms != NULL)
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] =
|
|
Tomáš Mráz |
0a4fa5 |
options.hostkeyalgorithms;
|
|
Jan F. Chadima |
974c89 |
@@ -529,8 +539,8 @@ input_userauth_pk_ok(int type, u_int32_t
|
|
Tomáš Mráz |
0a4fa5 |
key->type, pktype);
|
|
Tomáš Mráz |
0a4fa5 |
goto done;
|
|
Tomáš Mráz |
0a4fa5 |
}
|
|
Tomáš Mráz |
0a4fa5 |
- fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
- debug2("input_userauth_pk_ok: fp %s", fp);
|
|
Tomáš Mráz |
0a4fa5 |
+ fp = key_fingerprint(key, SSH_FP_SHA1, SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
+ debug2("input_userauth_pk_ok: SHA1 fp %s", fp);
|
|
Tomáš Mráz |
0a4fa5 |
xfree(fp);
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
/*
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/sshconnect.c.fips openssh-5.6p1/sshconnect.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/sshconnect.c.fips 2010-04-18 00:08:21.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/sshconnect.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
d93958 |
@@ -40,6 +40,8 @@
|
|
Jan F. Chadima |
974c89 |
#include <string.h>
|
|
Tomáš Mráz |
d93958 |
#include <unistd.h>
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
d93958 |
+
|
|
Tomáš Mráz |
d93958 |
#include "xmalloc.h"
|
|
Tomáš Mráz |
d93958 |
#include "key.h"
|
|
Tomáš Mráz |
d93958 |
#include "hostfile.h"
|
|
Jan F. Chadima |
974c89 |
@@ -789,6 +791,7 @@ check_host_key(char *hostname, struct so
|
|
Tomáš Mráz |
d93958 |
goto fail;
|
|
Tomáš Mráz |
d93958 |
} else if (options.strict_host_key_checking == 2) {
|
|
Tomáš Mráz |
d93958 |
char msg1[1024], msg2[1024];
|
|
Tomáš Mráz |
d93958 |
+ int fips_on = FIPS_mode();
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
if (show_other_keys(host, host_key))
|
|
Tomáš Mráz |
d93958 |
snprintf(msg1, sizeof(msg1),
|
|
Jan F. Chadima |
974c89 |
@@ -797,8 +800,8 @@ check_host_key(char *hostname, struct so
|
|
Tomáš Mráz |
d93958 |
else
|
|
Tomáš Mráz |
d93958 |
snprintf(msg1, sizeof(msg1), ".");
|
|
Tomáš Mráz |
d93958 |
/* The default */
|
|
Tomáš Mráz |
d93958 |
- fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
- ra = key_fingerprint(host_key, SSH_FP_MD5,
|
|
Tomáš Mráz |
d93958 |
+ fp = key_fingerprint(host_key, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
+ ra = key_fingerprint(host_key, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5,
|
|
Tomáš Mráz |
d93958 |
SSH_FP_RANDOMART);
|
|
Tomáš Mráz |
d93958 |
msg2[0] = '\0';
|
|
Tomáš Mráz |
d93958 |
if (options.verify_host_key_dns) {
|
|
Jan F. Chadima |
974c89 |
@@ -814,10 +817,10 @@ check_host_key(char *hostname, struct so
|
|
Tomáš Mráz |
d93958 |
snprintf(msg, sizeof(msg),
|
|
Tomáš Mráz |
d93958 |
"The authenticity of host '%.200s (%s)' can't be "
|
|
Tomáš Mráz |
d93958 |
"established%s\n"
|
|
Tomáš Mráz |
d93958 |
- "%s key fingerprint is %s.%s%s\n%s"
|
|
Tomáš Mráz |
d93958 |
+ "%s key %sfingerprint is %s.%s%s\n%s"
|
|
Tomáš Mráz |
d93958 |
"Are you sure you want to continue connecting "
|
|
Tomáš Mráz |
d93958 |
"(yes/no)? ",
|
|
Tomáš Mráz |
d93958 |
- host, ip, msg1, type, fp,
|
|
Tomáš Mráz |
d93958 |
+ host, ip, msg1, type, fips_on ? "SHA1 " : "", fp,
|
|
Tomáš Mráz |
d93958 |
options.visual_host_key ? "\n" : "",
|
|
Tomáš Mráz |
d93958 |
options.visual_host_key ? ra : "",
|
|
Tomáš Mráz |
d93958 |
msg2);
|
|
Jan F. Chadima |
82bc82 |
@@ -1151,17 +1154,18 @@ show_key_from_file(const char *file, con
|
|
Tomáš Mráz |
d93958 |
Key *found;
|
|
Tomáš Mráz |
d93958 |
char *fp, *ra;
|
|
Tomáš Mráz |
d93958 |
int line, ret;
|
|
Tomáš Mráz |
d93958 |
+ int fips_on = FIPS_mode();
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
found = key_new(keytype);
|
|
Tomáš Mráz |
d93958 |
if ((ret = lookup_key_in_hostfile_by_type(file, host,
|
|
Tomáš Mráz |
d93958 |
keytype, found, &line))) {
|
|
Tomáš Mráz |
d93958 |
- fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
- ra = key_fingerprint(found, SSH_FP_MD5, SSH_FP_RANDOMART);
|
|
Tomáš Mráz |
d93958 |
+ fp = key_fingerprint(found, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
+ ra = key_fingerprint(found, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_RANDOMART);
|
|
Tomáš Mráz |
d93958 |
logit("WARNING: %s key found for host %s\n"
|
|
Tomáš Mráz |
d93958 |
"in %s:%d\n"
|
|
Tomáš Mráz |
d93958 |
- "%s key fingerprint %s.\n%s\n",
|
|
Tomáš Mráz |
d93958 |
+ "%s key %sfingerprint %s.\n%s\n",
|
|
Tomáš Mráz |
d93958 |
key_type(found), host, file, line,
|
|
Tomáš Mráz |
d93958 |
- key_type(found), fp, ra);
|
|
Tomáš Mráz |
d93958 |
+ key_type(found), fips_on ? "SHA1 ":"", fp, ra);
|
|
Tomáš Mráz |
d93958 |
xfree(ra);
|
|
Tomáš Mráz |
d93958 |
xfree(fp);
|
|
Tomáš Mráz |
d93958 |
}
|
|
Jan F. Chadima |
82bc82 |
@@ -1207,8 +1211,9 @@ warn_changed_key(Key *host_key)
|
|
Tomáš Mráz |
d93958 |
{
|
|
Tomáš Mráz |
d93958 |
char *fp;
|
|
Tomáš Mráz |
d93958 |
const char *type = key_type(host_key);
|
|
Tomáš Mráz |
d93958 |
+ int fips_on = FIPS_mode();
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
- fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
+ fp = key_fingerprint(host_key, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
|
Tomáš Mráz |
d93958 |
error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @");
|
|
Jan F. Chadima |
82bc82 |
@@ -1216,8 +1221,8 @@ warn_changed_key(Key *host_key)
|
|
Tomáš Mráz |
d93958 |
error("IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!");
|
|
Tomáš Mráz |
d93958 |
error("Someone could be eavesdropping on you right now (man-in-the-middle attack)!");
|
|
Tomáš Mráz |
d93958 |
error("It is also possible that the %s host key has just been changed.", type);
|
|
Tomáš Mráz |
d93958 |
- error("The fingerprint for the %s key sent by the remote host is\n%s.",
|
|
Tomáš Mráz |
d93958 |
- type, fp);
|
|
Tomáš Mráz |
d93958 |
+ error("The %sfingerprint for the %s key sent by the remote host is\n%s.",
|
|
Tomáš Mráz |
d93958 |
+ fips_on ? "SHA1 ":"", type, fp);
|
|
Tomáš Mráz |
d93958 |
error("Please contact your system administrator.");
|
|
Tomáš Mráz |
d93958 |
|
|
Tomáš Mráz |
d93958 |
xfree(fp);
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/sshd.c.fips openssh-5.6p1/sshd.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/sshd.c.fips 2010-08-23 12:43:40.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/sshd.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
0a4fa5 |
@@ -76,6 +76,8 @@
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/bn.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/md5.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/rand.h>
|
|
Tomáš Mráz |
0a4fa5 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
0a4fa5 |
+#include <fipscheck.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/openssl-compat.h"
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
#ifdef HAVE_SECUREWARE
|
|
Jan F. Chadima |
1b8a26 |
@@ -1307,6 +1309,12 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
0a4fa5 |
(void)set_auth_parameters(ac, av);
|
|
Tomáš Mráz |
0a4fa5 |
#endif
|
|
Tomáš Mráz |
0a4fa5 |
__progname = ssh_get_progname(av[0]);
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
+ SSLeay_add_all_algorithms();
|
|
Tomáš Mráz |
0a4fa5 |
+ if (FIPS_mode() && !FIPSCHECK_verify(NULL, NULL)) {
|
|
Tomáš Mráz |
0a4fa5 |
+ fatal("FIPS integrity verification test failed.");
|
|
Tomáš Mráz |
0a4fa5 |
+ }
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
init_rng();
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
/* Save argv. Duplicate so setproctitle emulation doesn't clobber it */
|
|
Jan F. Chadima |
1b8a26 |
@@ -1468,8 +1476,6 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
0a4fa5 |
else
|
|
Tomáš Mráz |
0a4fa5 |
closefrom(REEXEC_DEVCRYPTO_RESERVED_FD);
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
- SSLeay_add_all_algorithms();
|
|
Tomáš Mráz |
0a4fa5 |
-
|
|
Tomáš Mráz |
0a4fa5 |
/*
|
|
Tomáš Mráz |
0a4fa5 |
* Force logging to stderr until we have loaded the private host
|
|
Tomáš Mráz |
0a4fa5 |
* key (unless started from inetd)
|
|
Jan F. Chadima |
1b8a26 |
@@ -1587,6 +1593,10 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
76f329 |
debug("private host key: #%d type %d %s", i, key->type,
|
|
Tomáš Mráz |
76f329 |
key_type(key));
|
|
Tomáš Mráz |
76f329 |
}
|
|
Tomáš Mráz |
76f329 |
+ if ((options.protocol & SSH_PROTO_1) && FIPS_mode()) {
|
|
Tomáš Mráz |
76f329 |
+ logit("Disabling protocol version 1. Not allowed in the FIPS mode.");
|
|
Tomáš Mráz |
76f329 |
+ options.protocol &= ~SSH_PROTO_1;
|
|
Tomáš Mráz |
76f329 |
+ }
|
|
Tomáš Mráz |
76f329 |
if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) {
|
|
Tomáš Mráz |
76f329 |
logit("Disabling protocol version 1. Could not load host key");
|
|
Tomáš Mráz |
76f329 |
options.protocol &= ~SSH_PROTO_1;
|
|
Jan F. Chadima |
1b8a26 |
@@ -1751,6 +1761,10 @@ main(int ac, char **av)
|
|
Tomáš Mráz |
0a4fa5 |
/* Initialize the random number generator. */
|
|
Tomáš Mráz |
0a4fa5 |
arc4random_stir();
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
+ if (FIPS_mode()) {
|
|
Tomáš Mráz |
0a4fa5 |
+ logit("FIPS mode initialized");
|
|
Tomáš Mráz |
0a4fa5 |
+ }
|
|
Tomáš Mráz |
0a4fa5 |
+
|
|
Tomáš Mráz |
0a4fa5 |
/* Chdir to the root directory so that the current disk can be
|
|
Tomáš Mráz |
0a4fa5 |
unmounted if desired. */
|
|
Tomáš Mráz |
0a4fa5 |
chdir("/");
|
|
Jan F. Chadima |
1b8a26 |
@@ -2284,6 +2298,9 @@ do_ssh2_kex(void)
|
|
Tomáš Mráz |
0a4fa5 |
if (options.ciphers != NULL) {
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;
|
|
Tomáš Mráz |
0a4fa5 |
+ } else if (FIPS_mode()) {
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_ENC_ALGS_STOC] = KEX_FIPS_ENCRYPT;
|
|
Tomáš Mráz |
0a4fa5 |
}
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]);
|
|
Jan F. Chadima |
1b8a26 |
@@ -2293,6 +2310,9 @@ do_ssh2_kex(void)
|
|
Tomáš Mráz |
0a4fa5 |
if (options.macs != NULL) {
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
|
|
Tomáš Mráz |
0a4fa5 |
+ } else if (FIPS_mode()) {
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
|
Tomáš Mráz |
0a4fa5 |
+ myproposal[PROPOSAL_MAC_ALGS_STOC] = KEX_FIPS_MAC;
|
|
Tomáš Mráz |
0a4fa5 |
}
|
|
Tomáš Mráz |
0a4fa5 |
if (options.compression == COMP_NONE) {
|
|
Tomáš Mráz |
0a4fa5 |
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
|
Jan F. Chadima |
1b8a26 |
diff -up openssh-5.6p1/ssh-keygen.c.fips openssh-5.6p1/ssh-keygen.c
|
|
Jan F. Chadima |
1b8a26 |
--- openssh-5.6p1/ssh-keygen.c.fips 2010-08-23 12:43:40.000000000 +0200
|
|
Jan F. Chadima |
1b8a26 |
+++ openssh-5.6p1/ssh-keygen.c 2010-08-23 12:43:41.000000000 +0200
|
|
Tomáš Mráz |
685b62 |
@@ -21,6 +21,7 @@
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/evp.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include <openssl/pem.h>
|
|
Tomáš Mráz |
0a4fa5 |
+#include <openssl/fips.h>
|
|
Tomáš Mráz |
0a4fa5 |
#include "openbsd-compat/openssl-compat.h"
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
#include <errno.h>
|
|
Jan F. Chadima |
1b8a26 |
@@ -692,7 +693,7 @@ do_fingerprint(struct passwd *pw)
|
|
Tomáš Mráz |
0a4fa5 |
enum fp_type fptype;
|
|
Tomáš Mráz |
0a4fa5 |
struct stat st;
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
- fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
|
|
Tomáš Mráz |
0a4fa5 |
+ fptype = print_bubblebabble ? SSH_FP_SHA1 : FIPS_mode() ? SSH_FP_SHA1 : SSH_FP_MD5;
|
|
Tomáš Mráz |
0a4fa5 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
if (!have_identity)
|
|
Jan F. Chadima |
1b8a26 |
@@ -2209,14 +2210,15 @@ passphrase_again:
|
|
Tomáš Mráz |
0a4fa5 |
fclose(f);
|
|
Tomáš Mráz |
0a4fa5 |
|
|
Tomáš Mráz |
0a4fa5 |
if (!quiet) {
|
|
Tomáš Mráz |
0a4fa5 |
- char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
- char *ra = key_fingerprint(public, SSH_FP_MD5,
|
|
Tomáš Mráz |
0a4fa5 |
+ int fips_on = FIPS_mode();
|
|
Tomáš Mráz |
0a4fa5 |
+ char *fp = key_fingerprint(public, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5, SSH_FP_HEX);
|
|
Tomáš Mráz |
0a4fa5 |
+ char *ra = key_fingerprint(public, fips_on ? SSH_FP_SHA1 : SSH_FP_MD5,
|
|
Tomáš Mráz |
0a4fa5 |
SSH_FP_RANDOMART);
|
|
Tomáš Mráz |
0a4fa5 |
printf("Your public key has been saved in %s.\n",
|
|
Tomáš Mráz |
0a4fa5 |
identity_file);
|
|
Tomáš Mráz |
0a4fa5 |
- printf("The key fingerprint is:\n");
|
|
Tomáš Mráz |
0a4fa5 |
+ printf("The key %sfingerprint is:\n", fips_on ? "SHA1 " : "");
|
|
Tomáš Mráz |
0a4fa5 |
printf("%s %s\n", fp, comment);
|
|
Tomáš Mráz |
0a4fa5 |
- printf("The key's randomart image is:\n");
|
|
Tomáš Mráz |
0a4fa5 |
+ printf("The key's %srandomart image is:\n", fips_on ? "SHA1 " :"");
|
|
Tomáš Mráz |
0a4fa5 |
printf("%s\n", ra);
|
|
Tomáš Mráz |
0a4fa5 |
xfree(ra);
|
|
Tomáš Mráz |
0a4fa5 |
xfree(fp);
|