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

Commit 7b565c4e authored by Tri Vo's avatar Tri Vo
Browse files

Don't require UNKNOWN_ERROR

Negative test cases should not expect UNKNOWN_ERROR from Keymint since
the exact cause of failure is known.

In general, we should avoid UNKNOWN_ERROR because it makes error
attribution difficult.

To avoid adding retroactive requirements KM implementation, relax the
check to expect any error.

Bug: 298194325
Test: VtsAidlKeyMintTargetTest
Change-Id: I136fb6d36ae92c9e3722ffefe9a067d3515dcbf9
parent 38a85e77
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -4792,7 +4792,7 @@ TEST_P(ImportKeyTest, RsaOaepMGFDigestSuccess) {

        EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
        string result;
        EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
        EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
        EXPECT_EQ(0U, result.size());
    }
}
@@ -5300,7 +5300,7 @@ TEST_P(EncryptionOperationsTest, RsaOaepSuccess) {

        EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
        string result;
        EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
        EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
        EXPECT_EQ(0U, result.size());
    }
}
@@ -5367,7 +5367,7 @@ TEST_P(EncryptionOperationsTest, RsaOaepDecryptWithWrongDigest) {
                                                                .Digest(Digest::SHA_2_256)
                                                                .Padding(PaddingMode::RSA_OAEP)));
    string result;
    EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext, &result));
    EXPECT_NE(ErrorCode::OK, Finish(ciphertext, &result));
    EXPECT_EQ(0U, result.size());
}

@@ -5437,7 +5437,7 @@ TEST_P(EncryptionOperationsTest, RsaOaepWithMGFDigestSuccess) {

        EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
        string result;
        EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
        EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
        EXPECT_EQ(0U, result.size());
    }
}
@@ -5481,7 +5481,7 @@ TEST_P(EncryptionOperationsTest, RsaOaepMGFDigestDefaultSuccess) {

    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
    string result;
    EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext, &result));
    EXPECT_NE(ErrorCode::OK, Finish(ciphertext, &result));
    EXPECT_EQ(0U, result.size());
}

@@ -5613,7 +5613,7 @@ TEST_P(EncryptionOperationsTest, RsaPkcs1Success) {

    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
    string result;
    EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
    EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
    EXPECT_EQ(0U, result.size());
}