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

Commit 2e220a75 authored by Max Bires's avatar Max Bires Committed by android-build-merger
Browse files

Merge "Adding test to check another ASN.1 Encoding Case"

am: 8fb7cbd2

Change-Id: I5dc31965558053c018df874e68816a8aa3e4be8e
parents 3610f3f0 8fb7cbd2
Loading
Loading
Loading
Loading
+23 −19
Original line number Diff line number Diff line
@@ -4338,6 +4338,8 @@ TEST_F(AttestationTest, EcAttestationRequiresAttestationAppId) {
 * to specify how many following bytes will be used to encode the length.
 */
TEST_F(AttestationTest, AttestationApplicationIDLengthProperlyEncoded) {
    std::vector<uint32_t> app_id_lengths{143, 258};
    for (uint32_t length : app_id_lengths) {
        auto creation_time = std::chrono::system_clock::now();
        ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
                                                     .Authorization(TAG_NO_AUTH_REQUIRED)
@@ -4345,7 +4347,7 @@ TEST_F(AttestationTest, AttestationApplicationIDLengthProperlyEncoded) {
                                                     .Digest(Digest::SHA_2_256)));

        hidl_vec<hidl_vec<uint8_t>> cert_chain;
    const string app_id(143, 'a');
        const string app_id(length, 'a');
        ASSERT_EQ(ErrorCode::OK,
                  AttestKey(AuthorizationSetBuilder()
                                    .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge"))
@@ -4357,6 +4359,8 @@ TEST_F(AttestationTest, AttestationApplicationIDLengthProperlyEncoded) {
                                              key_characteristics_.softwareEnforced,  //
                                              key_characteristics_.hardwareEnforced,  //
                                              SecLevel(), cert_chain[0], creation_time));
        CheckedDeleteKey();
    }
}
/*
 * AttestationTest.AesAttestation