Skip to content

Commit

Permalink
fix(test): Use 96-bit IV with aes-256-gcm to fix (#4347):
Browse files Browse the repository at this point in the history
I/O error: error:1C800066:Provider routines::cipher operation failed
  • Loading branch information
matejk committed Jan 5, 2024
1 parent 287befc commit 0f25b4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ jobs:
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<SyslogTest>.testOldBSD,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer,
CppUnit::TestCaller<CryptoTest>.testEncryptDecryptGCM"
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
EXCLUDE_TESTS="Redis Data/MySQL Data/ODBC Data/PostgreSQL MongoDB PDF"
./ci/runtests.sh
Expand All @@ -242,8 +241,7 @@ jobs:
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer,
CppUnit::TestCaller<CryptoTest>.testEncryptDecryptGCM"
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
PWD=`pwd`
ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)|(Redis)"
Expand All @@ -268,8 +266,7 @@ jobs:
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer,
CppUnit::TestCaller<CryptoTest>.testEncryptDecryptGCM"
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
PWD=`pwd`
ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)|(Redis)"
Expand Down Expand Up @@ -299,8 +296,7 @@ jobs:
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer,
CppUnit::TestCaller<CryptoTest>.testEncryptDecryptGCM"
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
EXCLUDE_TESTS="Redis Data/MySQL Data/ODBC Data/PostgreSQL MongoDB PDF"
./ci/runtests.sh TSAN
Expand Down Expand Up @@ -330,8 +326,7 @@ jobs:
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer,
CppUnit::TestCaller<CryptoTest>.testEncryptDecryptGCM"
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
EXCLUDE_TESTS="Redis Data/MySQL Data/ODBC Data/PostgreSQL MongoDB PDF"
./ci/runtests.sh
Expand Down Expand Up @@ -361,8 +356,7 @@ jobs:
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN,
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN,
CppUnit::TestCaller<PollSetTest>.testPollClosedServer,
CppUnit::TestCaller<CryptoTest>.testEncryptDecryptGCM"
CppUnit::TestCaller<PollSetTest>.testPollClosedServer"
EXCLUDE_TESTS="Redis Data/MySQL Data/ODBC Data/PostgreSQL MongoDB PDF"
./ci/runtests.sh
Expand Down
11 changes: 4 additions & 7 deletions Crypto/testsuite/src/CryptoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,12 @@ void CryptoTest::testEncryptDecryptDESECB()

void CryptoTest::testEncryptDecryptGCM()
{
//
// The test sometimes fails when it is running for longer time
// This conversation perhaps contains a hint:
// https://github.com/openssl/openssl/issues/21119
//

CipherKey key("aes-256-gcm");

CipherKey::ByteVec iv(20, 213);
// 96-bit (12 byte) IV is recommended for usage with GCM.
// https://crypto.stackexchange.com/questions/41601/aes-gcm-recommended-iv-size-why-12-bytes

CipherKey::ByteVec iv(12, 213);
key.setIV(iv);

Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(key);
Expand Down

0 comments on commit 0f25b4c

Please sign in to comment.