mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
[RESTRICT AUTOMERGE] Allow extra error code in device ID attestation am: b18c757eda am: e2fbd7ea4c am: c19581ea9e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2646738 Change-Id: I9f4d44c289a7643a2312673340d2ac1cbcfec19f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -952,9 +952,7 @@ TEST_P(AttestKeyTest, EcdsaAttestationMismatchID) {
|
||||
vector<Certificate> attested_key_cert_chain;
|
||||
auto result = GenerateKey(builder, attest_key, &attested_key_blob,
|
||||
&attested_key_characteristics, &attested_key_cert_chain);
|
||||
|
||||
ASSERT_TRUE(result == ErrorCode::CANNOT_ATTEST_IDS || result == ErrorCode::INVALID_TAG)
|
||||
<< "result = " << result;
|
||||
device_id_attestation_check_acceptable_error(invalid_tag.tag, result);
|
||||
}
|
||||
CheckedDeleteKey(&attest_key.keyBlob);
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestationMismatchID) {
|
||||
builder.push_back(invalid_tag);
|
||||
auto result = GenerateKey(builder, &key_blob, &key_characteristics);
|
||||
|
||||
ASSERT_TRUE(result == ErrorCode::CANNOT_ATTEST_IDS || result == ErrorCode::INVALID_TAG);
|
||||
device_id_attestation_check_acceptable_error(invalid_tag.tag, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1924,6 +1924,24 @@ void p256_pub_key(const vector<uint8_t>& coseKeyData, EVP_PKEY_Ptr* signingKey)
|
||||
*signingKey = std::move(pubKey);
|
||||
}
|
||||
|
||||
// Check the error code from an attempt to perform device ID attestation with an invalid value.
|
||||
void device_id_attestation_check_acceptable_error(Tag tag, const ErrorCode& result) {
|
||||
if (result == ErrorCode::CANNOT_ATTEST_IDS) {
|
||||
// Standard/default error code for ID mismatch.
|
||||
} else if (result == ErrorCode::INVALID_TAG) {
|
||||
// Depending on the situation, other error codes may be acceptable. First, allow older
|
||||
// implementations to use INVALID_TAG.
|
||||
} else if (result == ErrorCode::ATTESTATION_IDS_NOT_PROVISIONED) {
|
||||
// If the device is not a phone, it will not have IMEI/MEID values available. Allow
|
||||
// ATTESTATION_IDS_NOT_PROVISIONED in this case.
|
||||
ASSERT_TRUE((tag == TAG_ATTESTATION_ID_IMEI || tag == TAG_ATTESTATION_ID_MEID))
|
||||
<< "incorrect error code on attestation ID mismatch";
|
||||
} else {
|
||||
ADD_FAILURE() << "Error code " << result
|
||||
<< " returned on attestation ID mismatch, should be CANNOT_ATTEST_IDS";
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether the given named feature is available.
|
||||
bool check_feature(const std::string& name) {
|
||||
::android::sp<::android::IServiceManager> sm(::android::defaultServiceManager());
|
||||
|
||||
@@ -386,6 +386,7 @@ vector<uint8_t> make_name_from_str(const string& name);
|
||||
void check_maced_pubkey(const MacedPublicKey& macedPubKey, bool testMode,
|
||||
vector<uint8_t>* payload_value);
|
||||
void p256_pub_key(const vector<uint8_t>& coseKeyData, EVP_PKEY_Ptr* signingKey);
|
||||
void device_id_attestation_check_acceptable_error(Tag tag, const ErrorCode& result);
|
||||
bool check_feature(const std::string& name);
|
||||
|
||||
AuthorizationSet HwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
|
||||
|
||||
Reference in New Issue
Block a user