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

Commit 614337fd authored by David Drysdale's avatar David Drysdale Committed by Automerger Merge Worker
Browse files

Merge "KeyMint: allow extra error code" into main am: ae8c2818 am:...

Merge "KeyMint: allow extra error code" into main am: ae8c2818 am: 338d8e99 am: b5de35ce am: ec188404 am: 25de039d

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



Change-Id: Id46087ece72590e972f227dad3ddaddaa290ee89
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1057f75a 25de039d
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -2565,22 +2565,24 @@ TEST_P(NewKeyGenerationTest, LimitedUsageEcdsa) {
 * NewKeyGenerationTest.EcdsaDefaultSize
 *
 * Verifies that failing to specify a curve for EC key generation returns
 * UNSUPPORTED_KEY_SIZE.
 * UNSUPPORTED_KEY_SIZE or UNSUPPORTED_EC_CURVE.
 */
TEST_P(NewKeyGenerationTest, EcdsaDefaultSize) {
    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
              GenerateKey(AuthorizationSetBuilder()
    auto result = GenerateKey(AuthorizationSetBuilder()
                                      .Authorization(TAG_ALGORITHM, Algorithm::EC)
                                      .SigningKey()
                                      .Digest(Digest::NONE)
                                  .SetDefaultValidity()));
                                      .SetDefaultValidity());
    ASSERT_TRUE(result == ErrorCode::UNSUPPORTED_KEY_SIZE ||
                result == ErrorCode::UNSUPPORTED_EC_CURVE)
            << "unexpected result " << result;
}

/*
 * NewKeyGenerationTest.EcdsaInvalidCurve
 *
 * Verifies that specifying an invalid curve for EC key generation returns
 * UNSUPPORTED_KEY_SIZE.
 * UNSUPPORTED_KEY_SIZE or UNSUPPORTED_EC_CURVE.
 */
TEST_P(NewKeyGenerationTest, EcdsaInvalidCurve) {
    for (auto curve : InvalidCurves()) {
@@ -2593,7 +2595,8 @@ TEST_P(NewKeyGenerationTest, EcdsaInvalidCurve) {
                                          .SetDefaultValidity(),
                                  &key_blob, &key_characteristics);
        ASSERT_TRUE(result == ErrorCode::UNSUPPORTED_KEY_SIZE ||
                    result == ErrorCode::UNSUPPORTED_EC_CURVE);
                    result == ErrorCode::UNSUPPORTED_EC_CURVE)
                << "unexpected result " << result;
    }

    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,