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

Commit 8fb7cbd2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents 9854f58e ff02baac
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