summaryrefslogtreecommitdiffstats
path: root/trusty
diff options
context:
space:
mode:
authorJocelyn Bohr2017-08-15 19:13:37 -0500
committerandroid-build-merger2017-08-15 19:13:37 -0500
commiteb7207dbcd987801a746cff8aa0b78183950c8fa (patch)
tree23482b8eb6fe67b81c87348e45edd49d053f74b9 /trusty
parent784d6626fbbe77c7635177854c4b8850fc8a89ec (diff)
parent3a5d47af18c0a8a635173db7d2c1ce33955e247c (diff)
downloadplatform-system-core-eb7207dbcd987801a746cff8aa0b78183950c8fa.tar.gz
platform-system-core-eb7207dbcd987801a746cff8aa0b78183950c8fa.tar.xz
platform-system-core-eb7207dbcd987801a746cff8aa0b78183950c8fa.zip
Merge "Pass in message_version_ received from the secure side." am: 1a955faab2 am: 4e8bbb968c
am: 3a5d47af18 Change-Id: If57d80e166bb9ffd915ffe58ebb371bb3ada91c1
Diffstat (limited to 'trusty')
-rw-r--r--trusty/keymaster/trusty_keymaster_device.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/trusty/keymaster/trusty_keymaster_device.cpp b/trusty/keymaster/trusty_keymaster_device.cpp
index ff741462e..55a03bdcd 100644
--- a/trusty/keymaster/trusty_keymaster_device.cpp
+++ b/trusty/keymaster/trusty_keymaster_device.cpp
@@ -177,14 +177,14 @@ keymaster_error_t TrustyKeymasterDevice::configure(const keymaster_key_param_set
177 } 177 }
178 178
179 AuthorizationSet params_copy(*params); 179 AuthorizationSet params_copy(*params);
180 ConfigureRequest request; 180 ConfigureRequest request(message_version_);
181 if (!params_copy.GetTagValue(TAG_OS_VERSION, &request.os_version) || 181 if (!params_copy.GetTagValue(TAG_OS_VERSION, &request.os_version) ||
182 !params_copy.GetTagValue(TAG_OS_PATCHLEVEL, &request.os_patchlevel)) { 182 !params_copy.GetTagValue(TAG_OS_PATCHLEVEL, &request.os_patchlevel)) {
183 ALOGD("Configuration parameters must contain OS version and patch level"); 183 ALOGD("Configuration parameters must contain OS version and patch level");
184 return KM_ERROR_INVALID_ARGUMENT; 184 return KM_ERROR_INVALID_ARGUMENT;
185 } 185 }
186 186
187 ConfigureResponse response; 187 ConfigureResponse response(message_version_);
188 keymaster_error_t err = Send(KM_CONFIGURE, request, &response); 188 keymaster_error_t err = Send(KM_CONFIGURE, request, &response);
189 if (err != KM_ERROR_OK) { 189 if (err != KM_ERROR_OK) {
190 return err; 190 return err;
@@ -200,9 +200,9 @@ keymaster_error_t TrustyKeymasterDevice::add_rng_entropy(const uint8_t* data, si
200 return error_; 200 return error_;
201 } 201 }
202 202
203 AddEntropyRequest request; 203 AddEntropyRequest request(message_version_);
204 request.random_data.Reinitialize(data, data_length); 204 request.random_data.Reinitialize(data, data_length);
205 AddEntropyResponse response; 205 AddEntropyResponse response(message_version_);
206 return Send(KM_ADD_RNG_ENTROPY, request, &response); 206 return Send(KM_ADD_RNG_ENTROPY, request, &response);
207} 207}
208 208
@@ -261,11 +261,11 @@ keymaster_error_t TrustyKeymasterDevice::get_key_characteristics(
261 return KM_ERROR_OUTPUT_PARAMETER_NULL; 261 return KM_ERROR_OUTPUT_PARAMETER_NULL;
262 } 262 }
263 263
264 GetKeyCharacteristicsRequest request; 264 GetKeyCharacteristicsRequest request(message_version_);
265 request.SetKeyMaterial(*key_blob); 265 request.SetKeyMaterial(*key_blob);
266 AddClientAndAppData(client_id, app_data, &request); 266 AddClientAndAppData(client_id, app_data, &request);
267 267
268 GetKeyCharacteristicsResponse response; 268 GetKeyCharacteristicsResponse response(message_version_);
269 keymaster_error_t err = Send(KM_GET_KEY_CHARACTERISTICS, request, &response); 269 keymaster_error_t err = Send(KM_GET_KEY_CHARACTERISTICS, request, &response);
270 if (err != KM_ERROR_OK) { 270 if (err != KM_ERROR_OK) {
271 return err; 271 return err;
@@ -379,7 +379,7 @@ keymaster_error_t TrustyKeymasterDevice::attest_key(const keymaster_key_blob_t*
379 cert_chain->entry_count = 0; 379 cert_chain->entry_count = 0;
380 cert_chain->entries = nullptr; 380 cert_chain->entries = nullptr;
381 381
382 AttestKeyRequest request; 382 AttestKeyRequest request(message_version_);
383 request.SetKeyMaterial(*key_to_attest); 383 request.SetKeyMaterial(*key_to_attest);
384 request.attest_params.Reinitialize(*attest_params); 384 request.attest_params.Reinitialize(*attest_params);
385 385
@@ -391,7 +391,7 @@ keymaster_error_t TrustyKeymasterDevice::attest_key(const keymaster_key_blob_t*
391 return KM_ERROR_INVALID_INPUT_LENGTH; 391 return KM_ERROR_INVALID_INPUT_LENGTH;
392 } 392 }
393 393
394 AttestKeyResponse response; 394 AttestKeyResponse response(message_version_);
395 keymaster_error_t err = Send(KM_ATTEST_KEY, request, &response); 395 keymaster_error_t err = Send(KM_ATTEST_KEY, request, &response);
396 if (err != KM_ERROR_OK) { 396 if (err != KM_ERROR_OK) {
397 return err; 397 return err;
@@ -439,11 +439,11 @@ keymaster_error_t TrustyKeymasterDevice::upgrade_key(const keymaster_key_blob_t*
439 return KM_ERROR_OUTPUT_PARAMETER_NULL; 439 return KM_ERROR_OUTPUT_PARAMETER_NULL;
440 } 440 }
441 441
442 UpgradeKeyRequest request; 442 UpgradeKeyRequest request(message_version_);
443 request.SetKeyMaterial(*key_to_upgrade); 443 request.SetKeyMaterial(*key_to_upgrade);
444 request.upgrade_params.Reinitialize(*upgrade_params); 444 request.upgrade_params.Reinitialize(*upgrade_params);
445 445
446 UpgradeKeyResponse response; 446 UpgradeKeyResponse response(message_version_);
447 keymaster_error_t err = Send(KM_UPGRADE_KEY, request, &response); 447 keymaster_error_t err = Send(KM_UPGRADE_KEY, request, &response);
448 if (err != KM_ERROR_OK) { 448 if (err != KM_ERROR_OK) {
449 return err; 449 return err;
@@ -480,12 +480,12 @@ keymaster_error_t TrustyKeymasterDevice::begin(keymaster_purpose_t purpose,
480 *out_params = {}; 480 *out_params = {};
481 } 481 }
482 482
483 BeginOperationRequest request; 483 BeginOperationRequest request(message_version_);
484 request.purpose = purpose; 484 request.purpose = purpose;
485 request.SetKeyMaterial(*key); 485 request.SetKeyMaterial(*key);
486 request.additional_params.Reinitialize(*in_params); 486 request.additional_params.Reinitialize(*in_params);
487 487
488 BeginOperationResponse response; 488 BeginOperationResponse response(message_version_);
489 keymaster_error_t err = Send(KM_BEGIN_OPERATION, request, &response); 489 keymaster_error_t err = Send(KM_BEGIN_OPERATION, request, &response);
490 if (err != KM_ERROR_OK) { 490 if (err != KM_ERROR_OK) {
491 return err; 491 return err;
@@ -528,7 +528,7 @@ keymaster_error_t TrustyKeymasterDevice::update(keymaster_operation_handle_t ope
528 *output = {}; 528 *output = {};
529 } 529 }
530 530
531 UpdateOperationRequest request; 531 UpdateOperationRequest request(message_version_);
532 request.op_handle = operation_handle; 532 request.op_handle = operation_handle;
533 if (in_params) { 533 if (in_params) {
534 request.additional_params.Reinitialize(*in_params); 534 request.additional_params.Reinitialize(*in_params);
@@ -538,7 +538,7 @@ keymaster_error_t TrustyKeymasterDevice::update(keymaster_operation_handle_t ope
538 request.input.Reinitialize(input->data, std::min(input->data_length, max_input_size)); 538 request.input.Reinitialize(input->data, std::min(input->data_length, max_input_size));
539 } 539 }
540 540
541 UpdateOperationResponse response; 541 UpdateOperationResponse response(message_version_);
542 keymaster_error_t err = Send(KM_UPDATE_OPERATION, request, &response); 542 keymaster_error_t err = Send(KM_UPDATE_OPERATION, request, &response);
543 if (err != KM_ERROR_OK) { 543 if (err != KM_ERROR_OK) {
544 return err; 544 return err;
@@ -589,7 +589,7 @@ keymaster_error_t TrustyKeymasterDevice::finish(keymaster_operation_handle_t ope
589 *output = {}; 589 *output = {};
590 } 590 }
591 591
592 FinishOperationRequest request; 592 FinishOperationRequest request(message_version_);
593 request.op_handle = operation_handle; 593 request.op_handle = operation_handle;
594 if (signature && signature->data && signature->data_length > 0) { 594 if (signature && signature->data && signature->data_length > 0) {
595 request.signature.Reinitialize(signature->data, signature->data_length); 595 request.signature.Reinitialize(signature->data, signature->data_length);
@@ -601,7 +601,7 @@ keymaster_error_t TrustyKeymasterDevice::finish(keymaster_operation_handle_t ope
601 request.additional_params.Reinitialize(*in_params); 601 request.additional_params.Reinitialize(*in_params);
602 } 602 }
603 603
604 FinishOperationResponse response; 604 FinishOperationResponse response(message_version_);
605 keymaster_error_t err = Send(KM_FINISH_OPERATION, request, &response); 605 keymaster_error_t err = Send(KM_FINISH_OPERATION, request, &response);
606 if (err != KM_ERROR_OK) { 606 if (err != KM_ERROR_OK) {
607 return err; 607 return err;
@@ -634,9 +634,9 @@ keymaster_error_t TrustyKeymasterDevice::abort(keymaster_operation_handle_t oper
634 return error_; 634 return error_;
635 } 635 }
636 636
637 AbortOperationRequest request; 637 AbortOperationRequest request(message_version_);
638 request.op_handle = operation_handle; 638 request.op_handle = operation_handle;
639 AbortOperationResponse response; 639 AbortOperationResponse response(message_version_);
640 return Send(KM_ABORT_OPERATION, request, &response); 640 return Send(KM_ABORT_OPERATION, request, &response);
641} 641}
642 642