1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 17:47:33 -05:00

Give BPPs a Frontend, so they can do their own logging.

The sshverstring quasi-frontend is passed a Frontend pointer at setup
time, so that it can generate Event Log entries containing the local
and remote version strings and the results of remote bug detection.

I'm promoting that field of sshverstring to a field of the public BPP
structure, so now all BPPs have the right to talk directly to the
frontend if they want to. This means I can move all the log messages
of the form 'Initialised so-and-so cipher/MAC/compression' down into
the BPPs themselves, where they can live exactly alongside the actual
initialisation of those primitives.

It also means BPPs will be able to log interesting things they detect
at any point in the packet stream, which is about to come in useful
for another purpose.
This commit is contained in:
Simon Tatham
2018-10-07 08:16:44 +01:00
parent 36caf03a5b
commit 2e7ced6480
9 changed files with 79 additions and 64 deletions

View File

@ -23,6 +23,7 @@ struct BinaryPacketProtocol {
PacketLogSettings *pls;
LogContext *logctx;
Ssh *ssh;
Frontend *frontend;
/* ic_in_raw is filled in by the BPP (probably by calling
* ssh_bpp_common_setup). The BPP's owner triggers it when data is
@ -52,7 +53,7 @@ struct BinaryPacketProtocol {
* does centralised parts of the freeing too. */
void ssh_bpp_free(BinaryPacketProtocol *bpp);
BinaryPacketProtocol *ssh1_bpp_new(void);
BinaryPacketProtocol *ssh1_bpp_new(Frontend *frontend);
void ssh1_bpp_new_cipher(BinaryPacketProtocol *bpp,
const struct ssh1_cipheralg *cipher,
const void *session_key);
@ -96,7 +97,8 @@ struct DataTransferStats {
((stats)->direction.running = FALSE, TRUE) : \
((stats)->direction.remaining -= (size), FALSE))
BinaryPacketProtocol *ssh2_bpp_new(struct DataTransferStats *stats);
BinaryPacketProtocol *ssh2_bpp_new(
Frontend *frontend, struct DataTransferStats *stats);
void ssh2_bpp_new_outgoing_crypto(
BinaryPacketProtocol *bpp,
const struct ssh2_cipheralg *cipher, const void *ckey, const void *iv,
@ -108,7 +110,7 @@ void ssh2_bpp_new_incoming_crypto(
const struct ssh2_macalg *mac, int etm_mode, const void *mac_key,
const struct ssh_compression_alg *compression);
BinaryPacketProtocol *ssh2_bare_bpp_new(void);
BinaryPacketProtocol *ssh2_bare_bpp_new(Frontend *frontend);
/*
* The initial code to handle the SSH version exchange is also