Skip to content

Commit

Permalink
bug fixed in AES_auth_encrypt & AES_auth_decrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
m3sserschmitt committed Dec 19, 2021
1 parent f8e1c2c commit 83b81a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 4 additions & 0 deletions src/aes_auth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 83b81a7

Please sign in to comment.