mirror of
https://github.com/openssh/libopenssh
synced 2026-04-17 02:06:45 +00:00
move cipher warning flag to session_state
This commit is contained in:
committed by
Markus Friedl
parent
85054aaf18
commit
3ed152cd93
11
ssh/packet.c
11
ssh/packet.c
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user