Fix possible crash for mbedtls

This commit is contained in:
Benau 2021-02-25 12:15:26 +08:00
parent fe6d38b9e2
commit b05452a9c9

View File

@ -114,6 +114,8 @@ public:
assert(iv.size() == 12);
std::copy_n(iv.begin(), 12, m_iv.begin());
m_packet_counter = 0;
mbedtls_gcm_init(&m_aes_encrypt_context);
mbedtls_gcm_init(&m_aes_decrypt_context);
mbedtls_gcm_setkey(&m_aes_encrypt_context, MBEDTLS_CIPHER_ID_AES,
key.data(), key.size() * 8);
mbedtls_gcm_setkey(&m_aes_decrypt_context, MBEDTLS_CIPHER_ID_AES,