[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 15/20] packet_crypt: Avoid setting keys every time


Avoid setting keys on every packet decrypt or encrypt operation.

Signed-off-by: Alberto Aguirre <albaguirre@xxxxxxxxx>
---
 src/packet_crypt.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/packet_crypt.c b/src/packet_crypt.c
index a0f7635a..4d7a71aa 100644
--- a/src/packet_crypt.c
+++ b/src/packet_crypt.c
@@ -94,11 +94,6 @@ int ssh_packet_decrypt(ssh_session session, uint8_t *destination, uint8_t *sourc
         return SSH_ERROR;
     }
 
-    if (crypto->set_decrypt_key(crypto, session->current_crypto->decryptkey,
-            session->current_crypto->decryptIV) < 0) {
-        return -1;
-    }
-
     if (crypto->aead_decrypt != NULL){
         return crypto->aead_decrypt(crypto, source, destination, encrypted_size,
                 session->recv_seq);
@@ -148,12 +143,6 @@ unsigned char *ssh_packet_encrypt(ssh_session session, void *data, uint32_t len)
       hmac_update(ctx,data,len);
       hmac_final(ctx,session->current_crypto->hmacbuf,&finallen);
 
-      if (crypto->set_encrypt_key(crypto, session->current_crypto->encryptkey,
-          session->current_crypto->encryptIV) < 0) {
-        SAFE_FREE(out);
-        return NULL;
-      }
-
 #ifdef DEBUG_CRYPTO
       ssh_print_hexa("mac: ",data,hmac_digest_len(type));
       if (finallen != hmac_digest_len(type)) {
-- 
2.14.1


References:
[PATCH 00/20] Add chacha20-poly1305 supportAlberto Aguirre <albaguirre@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org