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

Commit 616ab3d4 authored by David Drysdale's avatar David Drysdale
Browse files

More error codes for device unique attestation

The Keymaster 4.1 spec says that "TRUSTED_ENVIRONMENT IKeymasterDevices
must return ErrorCode::INVALID_ARGUMENT if they receive
DEVICE_UNIQUE_ATTESTATION".  However, the corresponding VTS test was
expecting ErrorCode::UNIMPLEMENTED instead.

Make the test cope with either error code value.

Test: build
Bug: 388386210
Change-Id: Iaec708422793e6a76d33d21c3e4a9b8782411c0b
parent 6e208b99
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -229,13 +229,13 @@ TEST_P(DeviceUniqueAttestationTest, NonStrongBoxOnly) {
                                                         .Authorization(TAG_INCLUDE_UNIQUE_ID))));

    hidl_vec<hidl_vec<uint8_t>> cert_chain;
    EXPECT_EQ(ErrorCode::UNIMPLEMENTED,
              convert(AttestKey(
                      AuthorizationSetBuilder()
    ErrorCode result = convert(
            AttestKey(AuthorizationSetBuilder()
                              .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION)
                              .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge"))
                              .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")),
                      &cert_chain)));
                      &cert_chain));
    EXPECT_TRUE(result == ErrorCode::UNIMPLEMENTED || result == ErrorCode::INVALID_ARGUMENT);
    CheckedDeleteKey();

    ASSERT_EQ(ErrorCode::OK, convert(GenerateKey(AuthorizationSetBuilder()
@@ -244,13 +244,13 @@ TEST_P(DeviceUniqueAttestationTest, NonStrongBoxOnly) {
                                                         .Digest(Digest::SHA_2_256)
                                                         .Authorization(TAG_INCLUDE_UNIQUE_ID))));

    EXPECT_EQ(ErrorCode::UNIMPLEMENTED,
              convert(AttestKey(
                      AuthorizationSetBuilder()
    result = convert(
            AttestKey(AuthorizationSetBuilder()
                              .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION)
                              .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge"))
                              .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")),
                      &cert_chain)));
                      &cert_chain));
    EXPECT_TRUE(result == ErrorCode::UNIMPLEMENTED || result == ErrorCode::INVALID_ARGUMENT);
    CheckedDeleteKey();
}