mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-19 01:25:45 +03:00
crypto: fix secure burning, structure members naming
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
committed by
Andreas Schneider
parent
0cd0f685c9
commit
33cd594f1f
@@ -115,9 +115,9 @@ struct ssh_cipher_struct {
|
|||||||
/* sets the new key for immediate use */
|
/* sets the new key for immediate use */
|
||||||
int (*set_encrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
int (*set_encrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
||||||
int (*set_decrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
int (*set_decrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
||||||
void (*cbc_encrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
void (*encrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
||||||
unsigned long len);
|
unsigned long len);
|
||||||
void (*cbc_decrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
void (*decrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
||||||
unsigned long len);
|
unsigned long len);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -77,11 +77,10 @@ int packet_decrypt(ssh_session session, void *data,uint32_t len) {
|
|||||||
SAFE_FREE(out);
|
SAFE_FREE(out);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
crypto->cbc_decrypt(crypto,data,out,len);
|
crypto->decrypt(crypto,data,out,len);
|
||||||
|
|
||||||
memcpy(data,out,len);
|
memcpy(data,out,len);
|
||||||
memset(out,0,len);
|
BURN_BUFFER(out, len);
|
||||||
|
|
||||||
SAFE_FREE(out);
|
SAFE_FREE(out);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -136,10 +135,10 @@ unsigned char *packet_encrypt(ssh_session session, void *data, uint32_t len) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto->cbc_encrypt(crypto, data, out, len);
|
crypto->encrypt(crypto, data, out, len);
|
||||||
|
|
||||||
memcpy(data, out, len);
|
memcpy(data, out, len);
|
||||||
memset(out, 0, len);
|
BURN_BUFFER(out, len);
|
||||||
SAFE_FREE(out);
|
SAFE_FREE(out);
|
||||||
|
|
||||||
if (session->version == 2) {
|
if (session->version == 2) {
|
||||||
|
Reference in New Issue
Block a user