mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-05-27 06:41:05 +03:00
torture_packet: Set encryption/decryption keys
Signed-off-by: Alberto Aguirre <albaguirre@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
parent
1ece5a849c
commit
26734a547a
@ -45,6 +45,8 @@ static void torture_packet(const char *cipher,
|
||||
ssh_session session = ssh_new();
|
||||
int verbosity = torture_libssh_verbosity();
|
||||
struct ssh_crypto_struct *crypto;
|
||||
struct ssh_cipher_struct *in_cipher;
|
||||
struct ssh_cipher_struct *out_cipher;
|
||||
int rc;
|
||||
int sockets[2];
|
||||
uint8_t buffer[1024];
|
||||
@ -87,6 +89,18 @@ static void torture_packet(const char *cipher,
|
||||
crypto->encryptMAC = copy_data(mac, sizeof(mac));
|
||||
crypto->decryptMAC = copy_data(mac, sizeof(mac));
|
||||
|
||||
in_cipher = session->current_crypto->in_cipher;
|
||||
rc = in_cipher->set_decrypt_key(in_cipher,
|
||||
session->current_crypto->decryptkey,
|
||||
session->current_crypto->decryptIV);
|
||||
assert_int_equal(rc, SSH_OK);
|
||||
|
||||
out_cipher = session->current_crypto->out_cipher;
|
||||
rc = out_cipher->set_encrypt_key(out_cipher,
|
||||
session->current_crypto->encryptkey,
|
||||
session->current_crypto->encryptIV);
|
||||
assert_int_equal(rc, SSH_OK);
|
||||
|
||||
assert_non_null(session->out_buffer);
|
||||
ssh_buffer_add_data(session->out_buffer, test_data, payload_len);
|
||||
session->socket->fd_out = sockets[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user