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

Commit b18f050a authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5339334 from d0a5c1dd to pi-qpr3-release

Change-Id: I16d9a62111a97271873aed3ddfc96aa032b3e165
parents 4defd7db d0a5c1dd
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -3897,6 +3897,33 @@ TEST_F(AttestationTest, EcAttestation) {
                                          SecLevel(), cert_chain[0]));
}

/*
 * AttestationTest.EcAttestationByKeySize
 *
 * Verifies that attesting to EC keys works and generates the expected output.
 */
TEST_F(AttestationTest, EcAttestationByKeySize) {
    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
                                             .Authorization(TAG_NO_AUTH_REQUIRED)
                                             .EcdsaSigningKey(256)
                                             .Digest(Digest::SHA_2_256)
                                             .Authorization(TAG_INCLUDE_UNIQUE_ID)));

    hidl_vec<hidl_vec<uint8_t>> cert_chain;
    ASSERT_EQ(ErrorCode::OK,
              AttestKey(AuthorizationSetBuilder()
                            .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge"))
                            .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")),
                        &cert_chain));
    EXPECT_GE(cert_chain.size(), 2U);
    EXPECT_TRUE(verify_chain(cert_chain));

    EXPECT_TRUE(verify_attestation_record("challenge", "foo",                     //
                                          key_characteristics_.softwareEnforced,  //
                                          key_characteristics_.hardwareEnforced,  //
                                          SecLevel(), cert_chain[0]));
}

/*
 * AttestationTest.EcAttestationRequiresAttestationAppId
 *