diff --git a/CMakeLists.txt b/CMakeLists.txt index 93537f2..cd2895a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,5 +24,7 @@ add_library(cryptography6 STATIC ./src/sha.cc ) +target_link_libraries(cryptography6 crypto) + add_executable(libcryptography_tests ./tests/main.cc) -target_link_libraries(libcryptography_tests cryptography6 crypto) +target_link_libraries(libcryptography_tests cryptography6) diff --git a/src/aes_auth.cc b/src/aes_auth.cc index 294b7c8..03573c5 100644 --- a/src/aes_auth.cc +++ b/src/aes_auth.cc @@ -118,6 +118,8 @@ int CRYPTO::AES_auth_encrypt(AES_CRYPTO ctx, const BYTE *in, SIZE inlen, const B delete[] tag; tag = 0; + EVP_CIPHER_CTX_reset(ctx->encr); + return f_len + len + AES_GCM_IV_SIZE + AES_GCM_TAG_SIZE; } @@ -193,6 +195,8 @@ int CRYPTO::AES_auth_decrypt(AES_CRYPTO ctx, const BYTE *in, SIZE inlen, const B return -1; } + EVP_CIPHER_CTX_reset(ctx->decr); + return len + f_len; }