summaryrefslogtreecommitdiffhomepage
path: root/session.h
diff options
context:
space:
mode:
Diffstat (limited to 'session.h')
-rw-r--r--session.h51
1 files changed, 22 insertions, 29 deletions
diff --git a/session.h b/session.h
index 1106db4..5a4569e 100644
--- a/session.h
+++ b/session.h
@@ -60,42 +60,36 @@ void cli_session(int sock_in, int sock_out, char *remotehost);
void cli_session_cleanup();
void cleantext(unsigned char* dirtytext);
-struct key_context {
-
- const struct dropbear_cipher *recv_algo_crypt; /* NULL for none */
- const struct dropbear_cipher *trans_algo_crypt; /* NULL for none */
- const struct dropbear_cipher_mode *recv_crypt_mode;
- const struct dropbear_cipher_mode *trans_crypt_mode;
- const struct dropbear_hash *recv_algo_mac; /* NULL for none */
- const struct dropbear_hash *trans_algo_mac; /* NULL for none */
- char algo_kex;
- char algo_hostkey;
-
- char recv_algo_comp; /* compression */
- char trans_algo_comp;
- int allow_compress; /* whether compression has started (useful in
- zlib@openssh.com delayed compression case) */
+/* crypto parameters that are stored individually for transmit and receive */
+struct key_context_directional {
+ const struct dropbear_cipher *algo_crypt; /* NULL for none */
+ const struct dropbear_cipher_mode *crypt_mode;
+ const struct dropbear_hash *algo_mac; /* NULL for none */
+ int hash_index; /* lookup for libtomcrypt */
+ char algo_comp; /* compression */
#ifndef DISABLE_ZLIB
- z_streamp recv_zstream;
- z_streamp trans_zstream;
+ z_streamp zstream;
#endif
-
/* actual keys */
union {
symmetric_CBC cbc;
#ifdef DROPBEAR_ENABLE_CTR_MODE
symmetric_CTR ctr;
#endif
- } recv_cipher_state;
- union {
- symmetric_CBC cbc;
-#ifdef DROPBEAR_ENABLE_CTR_MODE
- symmetric_CTR ctr;
-#endif
- } trans_cipher_state;
- unsigned char recvmackey[MAX_MAC_KEY];
- unsigned char transmackey[MAX_MAC_KEY];
+ } cipher_state;
+ unsigned char mackey[MAX_MAC_KEY];
+};
+
+struct key_context {
+
+ struct key_context_directional recv;
+ struct key_context_directional trans;
+ char algo_kex;
+ char algo_hostkey;
+
+ int allow_compress; /* whether compression has started (useful in
+ zlib@openssh.com delayed compression case) */
};
struct packetlist;
@@ -128,8 +122,7 @@ struct sshsession {
throughout the code, as handlers fill out this
buffer with the packet to send. */
struct Queue writequeue; /* A queue of encrypted packets to send */
- buffer *readbuf; /* Encrypted */
- buffer *decryptreadbuf; /* Post-decryption */
+ buffer *readbuf; /* From the wire, decrypted in-place */
buffer *payload; /* Post-decompression, the actual SSH packet */
unsigned int transseq, recvseq; /* Sequence IDs */