Merge "Key{Mint,Master} VTS: fix incremental AES tags" am: e5c2bf01fc am: 523b300da7 am: a219992eef

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2020421

Change-Id: I771b72b5f4f439c8b6eea264010b90f0efa876a8
This commit is contained in:
David Drysdale 2022-03-14 17:02:36 +00:00 committed by Automerger Merge Worker
commit 79972e7645
2 changed files with 18 additions and 12 deletions

View file

@ -445,12 +445,15 @@ string KeymasterHidlTest::MacMessage(const string& message, Digest digest, size_
void KeymasterHidlTest::CheckAesIncrementalEncryptOperation(BlockMode block_mode,
int message_size) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.AesEncryptionKey(128)
.BlockMode(block_mode)
.Padding(PaddingMode::NONE)
.Authorization(TAG_MIN_MAC_LENGTH, 128)));
auto builder = AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.AesEncryptionKey(128)
.BlockMode(block_mode)
.Padding(PaddingMode::NONE);
if (block_mode == BlockMode::GCM) {
builder.Authorization(TAG_MIN_MAC_LENGTH, 128);
}
ASSERT_EQ(ErrorCode::OK, GenerateKey(builder));
for (int increment = 1; increment <= message_size; ++increment) {
string message(message_size, 'a');

View file

@ -667,12 +667,15 @@ string KeyMintAidlTestBase::MacMessage(const string& message, Digest digest, siz
void KeyMintAidlTestBase::CheckAesIncrementalEncryptOperation(BlockMode block_mode,
int message_size) {
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.AesEncryptionKey(128)
.BlockMode(block_mode)
.Padding(PaddingMode::NONE)
.Authorization(TAG_MIN_MAC_LENGTH, 128)));
auto builder = AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.AesEncryptionKey(128)
.BlockMode(block_mode)
.Padding(PaddingMode::NONE);
if (block_mode == BlockMode::GCM) {
builder.Authorization(TAG_MIN_MAC_LENGTH, 128);
}
ASSERT_EQ(ErrorCode::OK, GenerateKey(builder));
for (int increment = 1; increment <= message_size; ++increment) {
string message(message_size, 'a');