diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-11-22 15:57:37 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-01-09 10:14:56 +0100 |
commit | 8e0c047031d69bdf882f550886e3dd43afd8db05 (patch) | |
tree | 0ffd94b05abc4693c92efe60492fca690bd9dd32 /include | |
parent | 8d9026666190eecc55548899461b83a4f6cf45ce (diff) | |
download | libssh-8e0c047031d69bdf882f550886e3dd43afd8db05.tar.gz libssh-8e0c047031d69bdf882f550886e3dd43afd8db05.tar.xz libssh-8e0c047031d69bdf882f550886e3dd43afd8db05.zip |
packet: Introduce a new function to access crypto
And remove most of the direct access to the structure throughout the code
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Daiki Ueno <dueno@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/libssh/crypto.h | 1 | ||||
-rw-r--r-- | include/libssh/packet.h | 2 | ||||
-rw-r--r-- | include/libssh/wrapper.h | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/include/libssh/crypto.h b/include/libssh/crypto.h index 16f07325..7358f3cc 100644 --- a/include/libssh/crypto.h +++ b/include/libssh/crypto.h @@ -136,6 +136,7 @@ struct ssh_crypto_struct { char *kex_methods[SSH_KEX_METHODS]; enum ssh_key_exchange_e kex_type; enum ssh_mac_e mac_type; /* Mac operations to use for key gen */ + enum ssh_crypto_direction_e used; /* Is this crypto still used for either of directions? */ }; struct ssh_cipher_struct { diff --git a/include/libssh/packet.h b/include/libssh/packet.h index cd8a4c0f..6334111b 100644 --- a/include/libssh/packet.h +++ b/include/libssh/packet.h @@ -83,5 +83,7 @@ unsigned char *ssh_packet_encrypt(ssh_session session, unsigned int len); int ssh_packet_hmac_verify(ssh_session session,ssh_buffer buffer, unsigned char *mac, enum ssh_hmac_e type); +struct ssh_crypto_struct *ssh_packet_get_current_crypto(ssh_session session, + enum ssh_crypto_direction_e direction); #endif /* PACKET_H_ */ diff --git a/include/libssh/wrapper.h b/include/libssh/wrapper.h index 5dc44094..3a33c34f 100644 --- a/include/libssh/wrapper.h +++ b/include/libssh/wrapper.h @@ -61,6 +61,12 @@ struct ssh_hmac_struct { enum ssh_hmac_e hmac_type; }; +enum ssh_crypto_direction_e { + SSH_DIRECTION_IN = 1, + SSH_DIRECTION_OUT = 2, + SSH_DIRECTION_BOTH = 3, +}; + struct ssh_cipher_struct; typedef struct ssh_mac_ctx_struct *ssh_mac_ctx; |