Skip to content

Commit ff8622c

Browse files
Andres Amaya GarciaAndres Amaya Garcia
authored andcommitted
Change authcrypt constructor and destructor
1 parent fb71ca2 commit ff8622c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

authcrypt/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ static const char metadata[] = "eg sequence number, routing info";
4646

4747
class Authcrypt {
4848
public:
49-
Authcrypt() : ciphertext(), decrypted()
49+
Authcrypt()
5050
{
51+
memset(ciphertext, 0, sizeof(ciphertext));
52+
memset(decrypted, 0, sizeof(decrypted));
53+
5154
mbedtls_entropy_init(&entropy);
5255
mbedtls_ctr_drbg_init(&drbg);
5356
mbedtls_cipher_init(&cipher);
@@ -58,9 +61,9 @@ class Authcrypt {
5861
memset(ciphertext, 0, sizeof(ciphertext));
5962
memset(decrypted, 0, sizeof(decrypted));
6063

61-
mbedtls_entropy_free(&entropy);
62-
mbedtls_ctr_drbg_free(&drbg);
6364
mbedtls_cipher_free(&cipher);
65+
mbedtls_ctr_drbg_free(&drbg);
66+
mbedtls_entropy_free(&entropy);
6467
}
6568

6669
int run()

0 commit comments

Comments
 (0)