summaryrefslogtreecommitdiffhomepage
path: root/session.h
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2009-03-01 16:15:57 +0000
committerMatt Johnston <matt@ucc.asn.au>2009-03-01 16:15:57 +0000
commitff763e40057e5a51e142d0c4a6ffb090da465b78 (patch)
treedb341584ccdfc37492f4d74d2ba6c7fd79579149 /session.h
parent8e72bbaa9db050e4a0386f89999ff2131c0afdb6 (diff)
- Get rid of decryptreadbuf, just decrypt in-place with readbuf
- Share make_mac function for both packet creation and validation - Split recv/trans parts of key_context into their own structures --HG-- extra : convert_revision : 043bc598c76ed43625987e6937e32238f7ed6240
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 */