From: Krzysztof Jackiewicz Date: Tue, 12 Sep 2023 10:36:35 +0000 (+0200) Subject: Revert "Test proper GCM IV length handling" X-Git-Tag: accepted/tizen/6.0/unified/20230914.095717~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F298712%2F1;p=platform%2Fcore%2Fsecurity%2Fkey-manager.git Revert "Test proper GCM IV length handling" This reverts commit 61b910797b706b3e8494eb5841e4462bf1356125. Change-Id: Ifb7e276f1dee253c606800049ef97aea5c3bec77 --- diff --git a/src/manager/crypto/generic-backend/crypto-params.h b/src/manager/crypto/generic-backend/crypto-params.h index 41a4461..ae23fba 100644 --- a/src/manager/crypto/generic-backend/crypto-params.h +++ b/src/manager/crypto/generic-backend/crypto-params.h @@ -27,7 +27,6 @@ class Params { public: static const size_t DEFAULT_AES_IV_LEN = 16; // max acceptable size of IV - static const size_t DEFAULT_AES_GCM_IV_LEN = 12; // default size of IV in GCM mode static const int DEFAULT_AES_GCM_TAG_LEN_BYTES = 16; // length of AES GCM tag static const int DEFAULT_AES_GCM_TAG_LEN_BITS = DEFAULT_AES_GCM_TAG_LEN_BYTES * 8; static const int DERIVED_KEY_LENGTH = 16; // length of AES key derived from password in bytes diff --git a/unit-tests/test_sw-backend.cpp b/unit-tests/test_sw-backend.cpp index c4ae72c..ae0154e 100644 --- a/unit-tests/test_sw-backend.cpp +++ b/unit-tests/test_sw-backend.cpp @@ -645,17 +645,9 @@ NEGATIVE_TEST_CASE(symmetricEncryptDecryptGcm) // wrong iv auto wrongIv = iv; - wrongIv[iv.size() - 1] ^= 0x1; + wrongIv[0] ^= 0x1; ca2.setParam(ParamName::ED_IV, wrongIv); BOOST_REQUIRE_THROW(key->decrypt(ca2, encrypted), Exc::Crypto::InputParam); - - // shortened iv - auto shortenedIv = iv; - static_assert(Params::DEFAULT_AES_GCM_IV_LEN < Params::DEFAULT_AES_IV_LEN); - shortenedIv.resize(Params::DEFAULT_AES_GCM_IV_LEN); - ca2.setParam(ParamName::ED_IV, shortenedIv); - BOOST_REQUIRE_THROW(key->decrypt(ca2, encrypted), Exc::Crypto::InputParam); - ca2.setParam(ParamName::ED_IV, iv); // wrong ciphertext