ARM-software / tf-issues

Issue tracking for the ARM Trusted Firmware project
37 stars 16 forks source link

DTB made compulsory for CoT? #652

Closed Abhishek-brcm closed 5 years ago

Abhishek-brcm commented 5 years ago

CoT(drivers/auth/tbbr/tbbr_cot.c) seems to be forcing config(dts) data to be present in key certificate. [See tb_fw_config_hash_buf, hw_config_hash_buf, soc_fw_config_hash_buf, tos_fw_config_hash_buf, nt_fw_config_hash_buf is under authenticated_data structure]. In my case, as config data is not present in key certificate, following error comes while booting, followed by assert(): "E: Extension for data index 1 not found"

I added dummy DTS files for confirming above theory and observed that this resolves the issue. I think we should add NEED_FDT flag in CoT to avoid error on platforms not utilizing DTS. Please advice.

soby-mathew commented 5 years ago

@Abhishek-brcm, you are right. The config files are meant to be optional and the platform doesn't need to use them if not required to.

One solution is to define another CoT but without the config data so that platforms not interested in them can use that CoT. The current file can be renamed to tbbr_cot_with_config.c or something.

[Edit: see comments below]

Abhishek-brcm commented 5 years ago

@soby-mathew , Thanks for the clarification. I thought we could use NEED_FDT flag in CoT, but I realize that it would be generic across config files(tb-fw, hw, tos, nt, etc.) and would not be customize-able according to config file(s) used by given platform. In that case, it's just better to have CoT for a platform.

soby-mathew commented 5 years ago

@Abhishek-brcm , I got around to finally testing more on this. The config files are optional and if the platform does not have them, the default CoT as defined currently in tbbr_cot.c should work.

So my previous statement suggesting that the CoT need to be changed when configs are absent was wrong. Apologies for the confusion.

If the config is absent, I initially assumed that the authenticated parameter for that config would fail (see here). But if the authenticated parameter is marked as optional then the cert-create creates the authenticated parameter with dummy values (see here). Since the authenticated parameter for the config files are all optional, it will not fail authentication if the files are not present.

Hence if you are creating the certificates using the cert-create provided in the TF-A repo, you should not get an error when the config files are absent.

Platforms not using config can still create another copy of the standard CoT to save memory. This is because the default CoT allocates memory to hold the authenticated parameters for these configs.

Abhishek-brcm commented 5 years ago

@soby-mathew , I will check on this. Thanks for digging this out.

Abhishek-brcm commented 5 years ago

@soby-mathew , confirming that no issue when using cert-create provided in the TF-A repo.

soby-mathew commented 5 years ago

Closing the issue.