Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffb1577e authored by Shawn Willden's avatar Shawn Willden Committed by Automerger Merge Worker
Browse files

Merge "Added a new test case to validate AES algorithm with invalid key...

Merge "Added a new test case to validate AES algorithm with invalid key sizes." am: aef2a756 am: f61a68c6 am: 1177d0a0 am: 61cc4106

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

Change-Id: I89b067a26ecbc1dd871e670d4b7cebf2d0da2e30
parents 79eb77e6 61cc4106
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -921,6 +921,23 @@ TEST_P(NewKeyGenerationTest, HmacDigestNone) {
                              .Authorization(TAG_MIN_MAC_LENGTH, 128)));
}

/**
 * NewKeyGenerationTest.AesInvalidKeySize
 *
 * Verifies that specifying an invalid key size for AES key generation returns
 * UNSUPPORTED_KEY_SIZE.
 */
TEST_P(NewKeyGenerationTest, AesInvalidKeySize) {
    for (auto key_size : InvalidKeySizes(Algorithm::AES)) {
        ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
                  GenerateKey(AuthorizationSetBuilder()
                                      .Authorization(TAG_NO_AUTH_REQUIRED)
                                      .AesEncryptionKey(key_size)
                                      .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
                                      .Padding(PaddingMode::NONE)));
    }
}

INSTANTIATE_KEYMASTER_HIDL_TEST(NewKeyGenerationTest);

typedef KeymasterHidlTest SigningOperationsTest;