aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2020-04-28 12:25:50 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-05-05 14:23:06 +0200
commit201fd661767f769584d782503c9fa59a5d1f340d (patch)
tree5c5be8dfec5faa2489cf77c18bbdade225632f71 /src
parente6aee24a1e3be68417e1ac4ab4a02c65bf9db637 (diff)
downloadlibssh-201fd661767f769584d782503c9fa59a5d1f340d.tar.gz
libssh-201fd661767f769584d782503c9fa59a5d1f340d.tar.xz
libssh-201fd661767f769584d782503c9fa59a5d1f340d.zip
packet: Use temporary variables to avoid long lines
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/packet.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/packet.c b/src/packet.c
index 9fb4a1bf..c53800ea 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -1877,6 +1877,7 @@ int
ssh_packet_set_newkeys(ssh_session session,
enum ssh_crypto_direction_e direction)
{
+ struct ssh_cipher_struct *in_cipher = NULL, *out_cipher = NULL;
int rc;
SSH_LOG(SSH_LOG_TRACE,
@@ -1953,16 +1954,15 @@ ssh_packet_set_newkeys(ssh_session session,
return SSH_ERROR;
}
- if (session->next_crypto->in_cipher == NULL ||
- session->next_crypto->out_cipher == NULL) {
+ in_cipher = session->next_crypto->in_cipher;
+ out_cipher = session->next_crypto->out_cipher;
+ if (in_cipher == NULL || out_cipher == NULL) {
return SSH_ERROR;
}
/* Initialize rekeying states */
- ssh_init_rekey_state(session,
- session->next_crypto->out_cipher);
- ssh_init_rekey_state(session,
- session->next_crypto->in_cipher);
+ ssh_init_rekey_state(session, out_cipher);
+ ssh_init_rekey_state(session, in_cipher);
if (session->opts.rekey_time != 0) {
ssh_timestamp_init(&session->last_rekey_time);
SSH_LOG(SSH_LOG_PROTOCOL, "Set rekey after %" PRIu32 " seconds",
@@ -1970,20 +1970,18 @@ ssh_packet_set_newkeys(ssh_session session,
}
/* Initialize the encryption and decryption keys in next_crypto */
- rc = session->next_crypto->in_cipher->set_decrypt_key(
- session->next_crypto->in_cipher,
- session->next_crypto->decryptkey,
- session->next_crypto->decryptIV);
+ rc = in_cipher->set_decrypt_key(in_cipher,
+ session->next_crypto->decryptkey,
+ session->next_crypto->decryptIV);
if (rc < 0) {
/* On error, make sure it is not used */
session->next_crypto->used = 0;
return SSH_ERROR;
}
- rc = session->next_crypto->out_cipher->set_encrypt_key(
- session->next_crypto->out_cipher,
- session->next_crypto->encryptkey,
- session->next_crypto->encryptIV);
+ rc = out_cipher->set_encrypt_key(out_cipher,
+ session->next_crypto->encryptkey,
+ session->next_crypto->encryptIV);
if (rc < 0) {
/* On error, make sure it is not used */
session->next_crypto->used = 0;