trusty: set_attestation_key: Provision device IDs
Bug: 221128605 Test: /vendor/bin/trusty_keymaster_set_attestation_key /vendor/etc/keymaster_soft_attestation_keys.xml Change-Id: Iabe2162a7d50f16c966f16ca2eda5a7651779848
This commit is contained in:
parent
8b162ac936
commit
7aeb43ecfc
1 changed files with 29 additions and 4 deletions
|
@ -342,6 +342,19 @@ static int parse_xml_file(const char* filename) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int provision_ids(void) {
|
||||
keymaster::SetAttestationIdsRequest req(4 /* ver */);
|
||||
keymaster::EmptyKeymasterResponse rsp(4 /* ver */);
|
||||
|
||||
req.brand.Reinitialize("trusty", 6);
|
||||
req.device.Reinitialize("trusty", 6);
|
||||
req.product.Reinitialize("trusty", 6);
|
||||
req.manufacturer.Reinitialize("trusty", 6);
|
||||
req.model.Reinitialize("trusty", 6);
|
||||
|
||||
return trusty_keymaster_send(KM_SET_ATTESTATION_IDS, req, &rsp);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0;
|
||||
|
||||
|
@ -353,10 +366,22 @@ int main(int argc, char** argv) {
|
|||
ret = trusty_keymaster_connect();
|
||||
if (ret) {
|
||||
fprintf(stderr, "trusty_keymaster_connect failed %d\n", ret);
|
||||
} else {
|
||||
ret = parse_xml_file(argv[optind]);
|
||||
trusty_keymaster_disconnect();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
ret = parse_xml_file(argv[optind]);
|
||||
if (ret) {
|
||||
fprintf(stderr, "parse_xml_file failed %d\n", ret);
|
||||
trusty_keymaster_disconnect();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
ret = provision_ids();
|
||||
if (ret) {
|
||||
fprintf(stderr, "provision_ids failed %d\n", ret);
|
||||
trusty_keymaster_disconnect();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue