comparison session.h @ 546:568638be7203 agent-client

propagate from branch 'au.asn.ucc.matt.dropbear' (head 899a8851a5edf840b2f7925bcc26ffe99dcac54d) to branch 'au.asn.ucc.matt.dropbear.cli-agent' (head 6bbab8364de17bd9ecb1dee5ffb796e48c0380d2)
author Matt Johnston <matt@ucc.asn.au>
date Wed, 01 Jul 2009 04:16:32 +0000
parents 0431915df79f
children cf376c696dfc 8711f20b89ab
comparison
equal deleted inserted replaced
500:d588e3ea557a 546:568638be7203
58 /* Client */ 58 /* Client */
59 void cli_session(int sock_in, int sock_out, char *remotehost); 59 void cli_session(int sock_in, int sock_out, char *remotehost);
60 void cli_session_cleanup(); 60 void cli_session_cleanup();
61 void cleantext(unsigned char* dirtytext); 61 void cleantext(unsigned char* dirtytext);
62 62
63 /* crypto parameters that are stored individually for transmit and receive */
64 struct key_context_directional {
65 const struct dropbear_cipher *algo_crypt; /* NULL for none */
66 const struct dropbear_cipher_mode *crypt_mode;
67 const struct dropbear_hash *algo_mac; /* NULL for none */
68 int hash_index; /* lookup for libtomcrypt */
69 char algo_comp; /* compression */
70 #ifndef DISABLE_ZLIB
71 z_streamp zstream;
72 #endif
73 /* actual keys */
74 union {
75 symmetric_CBC cbc;
76 #ifdef DROPBEAR_ENABLE_CTR_MODE
77 symmetric_CTR ctr;
78 #endif
79 } cipher_state;
80 unsigned char mackey[MAX_MAC_KEY];
81 };
82
63 struct key_context { 83 struct key_context {
64 84
65 const struct dropbear_cipher *recv_algo_crypt; /* NULL for none */ 85 struct key_context_directional recv;
66 const struct dropbear_cipher *trans_algo_crypt; /* NULL for none */ 86 struct key_context_directional trans;
67 const struct dropbear_hash *recv_algo_mac; /* NULL for none */ 87
68 const struct dropbear_hash *trans_algo_mac; /* NULL for none */
69 char algo_kex; 88 char algo_kex;
70 char algo_hostkey; 89 char algo_hostkey;
71 90
72 char recv_algo_comp; /* compression */ 91 int allow_compress; /* whether compression has started (useful in
73 char trans_algo_comp; 92 [email protected] delayed compression case) */
74 #ifndef DISABLE_ZLIB
75 z_streamp recv_zstream;
76 z_streamp trans_zstream;
77 #endif
78
79 /* actual keys */
80 symmetric_CBC recv_symmetric_struct;
81 symmetric_CBC trans_symmetric_struct;
82 unsigned char recvmackey[MAX_MAC_KEY];
83 unsigned char transmackey[MAX_MAC_KEY];
84
85 }; 93 };
86 94
87 struct packetlist; 95 struct packetlist;
88 struct packetlist { 96 struct packetlist {
89 struct packetlist *next; 97 struct packetlist *next;
112 /* Packet buffers/values etc */ 120 /* Packet buffers/values etc */
113 buffer *writepayload; /* Unencrypted payload to write - this is used 121 buffer *writepayload; /* Unencrypted payload to write - this is used
114 throughout the code, as handlers fill out this 122 throughout the code, as handlers fill out this
115 buffer with the packet to send. */ 123 buffer with the packet to send. */
116 struct Queue writequeue; /* A queue of encrypted packets to send */ 124 struct Queue writequeue; /* A queue of encrypted packets to send */
117 buffer *readbuf; /* Encrypted */ 125 buffer *readbuf; /* From the wire, decrypted in-place */
118 buffer *decryptreadbuf; /* Post-decryption */
119 buffer *payload; /* Post-decompression, the actual SSH packet */ 126 buffer *payload; /* Post-decompression, the actual SSH packet */
120 unsigned int transseq, recvseq; /* Sequence IDs */ 127 unsigned int transseq, recvseq; /* Sequence IDs */
121 128
122 /* Packet-handling flags */ 129 /* Packet-handling flags */
123 const packettype * packettypes; /* Packet handler mappings for this 130 const packettype * packettypes; /* Packet handler mappings for this
132 unsigned char ignorenext; /* whether to ignore the next packet, 139 unsigned char ignorenext; /* whether to ignore the next packet,
133 used for kex_follows stuff */ 140 used for kex_follows stuff */
134 141
135 unsigned char lastpacket; /* What the last received packet type was */ 142 unsigned char lastpacket; /* What the last received packet type was */
136 143
137 int signal_pipe[2]; /* stores endpoints of a self-pipe used for 144 int signal_pipe[2]; /* stores endpoints of a self-pipe used for
138 race-free signal handling */ 145 race-free signal handling */
139 146
140 time_t last_packet_time; /* time of the last packet transmission, for 147 time_t last_trx_packet_time; /* time of the last packet transmission, for
141 keepalive purposes */ 148 keepalive purposes */
149
150 time_t last_packet_time; /* time of the last packet transmission or receive, for
151 idle timeout purposes */
152
142 153
143 /* KEX/encryption related */ 154 /* KEX/encryption related */
144 struct KEXState kexstate; 155 struct KEXState kexstate;
145 struct key_context *keys; 156 struct key_context *keys;
146 struct key_context *newkeys; 157 struct key_context *newkeys;