diff options
Diffstat (limited to 'lib/trusty/ql-tipc')
-rw-r--r-- | lib/trusty/ql-tipc/arch/arm/trusty_mem.c | 2 | ||||
-rw-r--r-- | lib/trusty/ql-tipc/keymaster.c | 22 | ||||
-rw-r--r-- | lib/trusty/ql-tipc/rpmb_proxy.c | 2 | ||||
-rw-r--r-- | lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c | 6 |
4 files changed, 21 insertions, 11 deletions
diff --git a/lib/trusty/ql-tipc/arch/arm/trusty_mem.c b/lib/trusty/ql-tipc/arch/arm/trusty_mem.c index 56d8348d3c..890dbe48bc 100644 --- a/lib/trusty/ql-tipc/arch/arm/trusty_mem.c +++ b/lib/trusty/ql-tipc/arch/arm/trusty_mem.c @@ -97,7 +97,7 @@ static void arm64_write_ATS1ExW(uint64_t vaddr) break; case 0x3: default: - trusty_fatal("Unsupported execution state: EL%u\n", _current_el ); + trusty_fatal("Unsupported execution state: EL%lu\n", _current_el ); break; } diff --git a/lib/trusty/ql-tipc/keymaster.c b/lib/trusty/ql-tipc/keymaster.c index d3957b853b..282cb53cdb 100644 --- a/lib/trusty/ql-tipc/keymaster.c +++ b/lib/trusty/ql-tipc/keymaster.c @@ -247,7 +247,7 @@ static int km_get_version(int32_t *version) rc = km_send_request(KM_GET_VERSION, NULL, 0); if (rc < 0) { - trusty_error("failed to send km version request", rc); + trusty_error("failed (%d) to send km version request", rc); return rc; } @@ -524,7 +524,7 @@ int trusty_get_mppubk(uint8_t *mppubk, uint32_t *size) rc = km_send_request(KM_GET_MPPUBK, NULL, 0); if (rc < 0) { - trusty_error("failed to send km mppubk request\n", rc); + trusty_error("%s: failed (%d) to send km mppubk request\n", __func__, rc); return rc; } @@ -586,6 +586,7 @@ int trusty_set_attestation_id(void) { uint8_t *req = NULL, *tmp = NULL; uint32_t req_size = 0; + char *serial = NULL; int rc; req = trusty_calloc(1024, 1); // 1024 bytes buffer should be enough. @@ -620,10 +621,14 @@ int trusty_set_attestation_id(void) } /* serial number, bail out when fail because it's a MUST. */ - char *serial = get_serial(); - if (serial) - km_attestation_id_data_serialize((uint8_t *)serial, 16, &tmp, &req_size); - else { + serial = get_serial(); + if (serial != NULL) { + rc = km_attestation_id_data_serialize((uint8_t *)serial, 16, &tmp, &req_size); + if (rc < 0) { + trusty_error("%s: failed (%d) to set id serial.\n", __func__, rc); + goto end; + } + } else { trusty_error("%s: failed to get serial number.\n", __func__); goto end; } @@ -685,6 +690,11 @@ int trusty_set_boot_patch_level(uint32_t boot_patch_level) int rc; req = trusty_calloc(4, 1); // 4 bytes should be enough. + if (!req) { + trusty_error("trusty_calloc memory failed!\n"); + return -1; + } + memcpy(req, &boot_patch_level, sizeof(uint32_t)); req_size = sizeof(uint32_t); diff --git a/lib/trusty/ql-tipc/rpmb_proxy.c b/lib/trusty/ql-tipc/rpmb_proxy.c index 3c9d8ee36d..74ce4b32e8 100644 --- a/lib/trusty/ql-tipc/rpmb_proxy.c +++ b/lib/trusty/ql-tipc/rpmb_proxy.c @@ -252,7 +252,7 @@ static int proxy_handle_rpmb(struct trusty_ipc_chan *chan, if (req->write_size) { if ((req->write_size % MMC_BLOCK_SIZE) != 0) { - trusty_error("%: invalid write size %u\n", __func__, + trusty_error("%s: invalid write size %u\n", __func__, req->write_size); msg->result = STORAGE_ERR_NOT_VALID; goto err_response; diff --git a/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c b/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c index 934286cb69..cf15bf77b0 100644 --- a/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c +++ b/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c @@ -74,7 +74,7 @@ int rpmb_storage_send(void *rpmb_dev, const void *rel_write_data, if (rel_write_size) { if (rel_write_size % MMC_BLOCK_SIZE) { trusty_error( - "rel_write_size is not a multiple of MMC_BLOCK_SIZE: %d\n", + "rel_write_size is not a multiple of MMC_BLOCK_SIZE: %lu\n", rel_write_size); ret = TRUSTY_ERR_INVALID_ARGS; goto end; @@ -90,7 +90,7 @@ int rpmb_storage_send(void *rpmb_dev, const void *rel_write_data, } if (write_size) { if (write_size % MMC_BLOCK_SIZE) { - trusty_error("write_size is not a multiple of MMC_BLOCK_SIZE: %d\n", + trusty_error("write_size is not a multiple of MMC_BLOCK_SIZE: %lu\n", write_size); ret = TRUSTY_ERR_INVALID_ARGS; goto end; @@ -105,7 +105,7 @@ int rpmb_storage_send(void *rpmb_dev, const void *rel_write_data, } if (read_size) { if (read_size % MMC_BLOCK_SIZE) { - trusty_error("read_size is not a multiple of MMC_BLOCK_SIZE: %d\n", + trusty_error("read_size is not a multiple of MMC_BLOCK_SIZE: %lu\n", read_size); ret = TRUSTY_ERR_INVALID_ARGS; goto end; |