AES_KEY structure clean up
This commit is contained in:
parent
167fcea095
commit
8b4085ff93
@ -348,6 +348,7 @@ void init_aes_unauth (const char server_nonce[16], const char hidden_client_nonc
|
||||
} else {
|
||||
AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key);
|
||||
}
|
||||
memset (aes_key_raw, 0, sizeof (aes_key_raw));
|
||||
}
|
||||
|
||||
void init_aes_auth (char auth_key[192], char msg_key[16], int encrypt) {
|
||||
@ -387,6 +388,7 @@ void init_aes_auth (char auth_key[192], char msg_key[16], int encrypt) {
|
||||
} else {
|
||||
AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key);
|
||||
}
|
||||
memset (aes_key_raw, 0, sizeof (aes_key_raw));
|
||||
}
|
||||
|
||||
int pad_aes_encrypt (char *from, int from_len, char *to, int size) {
|
||||
|
@ -746,6 +746,7 @@ char *encrypt_decrypted_message (struct secret_chat *E) {
|
||||
AES_KEY aes_key;
|
||||
AES_set_encrypt_key (key, 256, &aes_key);
|
||||
AES_ige_encrypt ((void *)encr_ptr, (void *)encr_ptr, 4 * (encr_end - encr_ptr), &aes_key, iv, 1);
|
||||
memset (&aes_key, 0, sizeof (aes_key));
|
||||
|
||||
return (void *)msg_key;
|
||||
}
|
||||
@ -1290,15 +1291,14 @@ void send_part (struct send_file *f) {
|
||||
if (f->encr) {
|
||||
if (x & 15) {
|
||||
assert (f->offset == f->size);
|
||||
if (x & 15) {
|
||||
secure_random (buf + x, (-x) & 15);
|
||||
x = (x + 15) & ~15;
|
||||
}
|
||||
}
|
||||
|
||||
AES_KEY aes_key;
|
||||
AES_set_encrypt_key (f->key, 256, &aes_key);
|
||||
AES_ige_encrypt ((void *)buf, (void *)buf, x, &aes_key, f->iv, 1);
|
||||
memset (&aes_key, 0, sizeof (aes_key));
|
||||
}
|
||||
out_cstring (buf, x);
|
||||
if (verbosity >= 2) {
|
||||
@ -1803,6 +1803,7 @@ int download_on_answer (struct query *q) {
|
||||
AES_KEY aes_key;
|
||||
AES_set_decrypt_key (D->key, 256, &aes_key);
|
||||
AES_ige_encrypt (ptr, ptr, len, &aes_key, D->iv, 0);
|
||||
memset (&aes_key, 0, sizeof (aes_key));
|
||||
if (len > D->size - D->offset) {
|
||||
len = D->size - D->offset;
|
||||
}
|
||||
|
@ -1376,6 +1376,7 @@ int decrypt_encrypted_message (struct secret_chat *E) {
|
||||
AES_KEY aes_key;
|
||||
AES_set_decrypt_key (key, 256, &aes_key);
|
||||
AES_ige_encrypt ((void *)decr_ptr, (void *)decr_ptr, 4 * (decr_end - decr_ptr), &aes_key, iv, 0);
|
||||
memset (&aes_key, 0, sizeof (aes_key));
|
||||
|
||||
int x = *(decr_ptr);
|
||||
if (x < 0 || (x & 3)) {
|
||||
|
Loading…
Reference in New Issue
Block a user