move cipher warning flag to session_state

This commit is contained in:
Damien Miller
2012-01-14 08:56:13 +11:00
committed by Markus Friedl
parent 85054aaf18
commit 3ed152cd93
2 changed files with 7 additions and 7 deletions

View File

@@ -186,6 +186,9 @@ struct session_state {
/* Used in packet_set_maxsize */
int set_maxsize_called;
/* One-off warning about weak ciphers */
int cipher_warning_done;
TAILQ_HEAD(, packet) outgoing;
};
@@ -604,11 +607,11 @@ ssh_packet_set_encryption_key(struct ssh *ssh, const u_char *key, u_int keylen,
(r = cipher_init(&state->receive_context, cipher, key, keylen,
NULL, 0, CIPHER_DECRYPT) != 0))
fatal("%s: cipher_init failed: %s", __func__, ssh_err(r));
if (!ssh->cipher_warning_done &&
if (!state->cipher_warning_done &&
((wmsg = cipher_warning_message(&state->send_context)) != NULL ||
(wmsg = cipher_warning_message(&state->send_context)) != NULL)) {
error("Warning: %s", wmsg);
ssh->cipher_warning_done = 1;
state->cipher_warning_done = 1;
}
}
@@ -863,10 +866,10 @@ ssh_set_newkeys(struct ssh *ssh, int mode)
if ((r = cipher_init(cc, enc->cipher, enc->key, enc->key_len,
enc->iv, enc->block_size, crypt_type)) != 0)
fatal("%s: cipher_init failed: %s", __func__, ssh_err(r));
if (!ssh->cipher_warning_done &&
if (!state->cipher_warning_done &&
(wmsg = cipher_warning_message(cc)) != NULL) {
error("Warning: %s", wmsg);
ssh->cipher_warning_done = 1;
state->cipher_warning_done = 1;
}
/* Deleting the keys does not gain extra security */
/* memset(enc->iv, 0, enc->block_size);

View File

@@ -62,9 +62,6 @@ struct ssh {
/* Lists for private and public keys */
TAILQ_HEAD(, key_entry) private_keys;
TAILQ_HEAD(, key_entry) public_keys;
/* One-off warning about weak ciphers */
int cipher_warning_done;
};
struct ssh *ssh_alloc_session_state(void);