MA-13357 [Trusty] Init hwcrypto service even rpmb key not set

RPMB storage proxy service will return fail if the rpmb key is not
correct, we should not return early here if the rpmb key has not
been set because we still need to initialize the hwcrypto service
to generate the rpmb key blob.
This commit also adds more hint when set the rpmb key.

Change-Id: I8ee59e4e277b545283d63b1070e671d508dbe0c2
Signed-off-by: Luo Ji <ji.luo@nxp.com>
This commit is contained in:
Luo Ji 2018-11-09 13:12:32 +08:00
parent f0d02f2da5
commit a37a72c84f
2 changed files with 7 additions and 6 deletions

View File

@ -1533,7 +1533,7 @@ int fastboot_set_rpmb_key(uint8_t *staged_buf, uint32_t key_size)
ret = -1; ret = -1;
goto fail; goto fail;
} else } else
printf("RPMB key programed successfully!"); printf("RPMB key programed successfully!\n");
/* Generate keyblob with CAAM. */ /* Generate keyblob with CAAM. */
kp.rpmb_keyblob_len = RPMBKEY_LENGTH + CAAM_PAD; kp.rpmb_keyblob_len = RPMBKEY_LENGTH + CAAM_PAD;
@ -1543,7 +1543,9 @@ int fastboot_set_rpmb_key(uint8_t *staged_buf, uint32_t key_size)
printf("ERROR - generate rpmb key blob error!\n"); printf("ERROR - generate rpmb key blob error!\n");
ret = -1; ret = -1;
goto fail; goto fail;
} } else
printf("RPMB key blob generated!\n");
memcpy(kp.rpmb_keyblob, blob, kp.rpmb_keyblob_len); memcpy(kp.rpmb_keyblob, blob, kp.rpmb_keyblob_len);
/* Store the rpmb key blob to last block of boot1 partition. */ /* Store the rpmb key blob to last block of boot1 partition. */

View File

@ -95,11 +95,10 @@ int trusty_ipc_init(void)
trusty_error("RPMB key was destroyed!\n"); trusty_error("RPMB key was destroyed!\n");
hang(); hang();
} else { } else {
/* rpmb key hasn't been set, use software /* rpmb key hasn't been set, use software keymaster.
* keymaster and return earily. * Don't return here because we want to initalize the
*/ * hardware crypto service to set rpmb key. */
env_set("keystore", "software"); env_set("keystore", "software");
return rc;
} }
#else #else
return rc; return rc;