mbox series

[v3,00/25] Fix and extend i.MX HAB layer

Message ID 1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org
Headers show
Series Fix and extend i.MX HAB layer | expand

Message

Bryan O'Donoghue Dec. 30, 2017, 1:08 a.m. UTC
v3:
- Only call into ROM if headers are verified. - Bryan

- Print HAB event log if and only if a call was made to HAB
  and a meaningful status code has been obtained. - Breno

v2:
- Fix compilation warnings and errors in SPL highlighted by 
  Breno Matheus Lima

- Add CC: Breno Matheus Lima <brenomatheus@gmail.com> to all patches

v1:
This patchset updates the i.MX HAB layer in u-boot to fix a list of
identified issues and then to add and extend existing functionality.

The first block of patches 0001-0006 deal with fixing existing code,

- Fixes indentation
- Fixes the treatment of input parameters to hab_auth_image.

The second block of patches 0007-0013 are about tidying up the HAB code

- Remove reliance on hard-coding to specific offsets
- IVT header drives locating CSF
- Continue to support existing boards

Patches 0014 onwards extend out the HAB functionality.

- hab_rvt_check_target is a recommended check in the NXP documents to
  perform prior to hab_rvt_authenticate_image
- hab_rvt_failsafe is a useful function to set the board into BootROM
  USB recovery mode.

Bryan O'Donoghue (25):
  arm: imx: hab: Make authenticate_image return int
  arm: imx: hab: Fix authenticate_image result code
  arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail
  arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail
  arm: imx: hab: Move IVT_SIZE to hab.h
  arm: imx: hab: Move CSF_PAD_SIZE to hab.h
  arm: imx: hab: Fix authenticate_image input parameters
  arm: imx: hab: Fix authenticate image lockup on MX7
  arm: imx: hab: Add IVT header definitions
  arm: imx: hab: Add IVT header verification
  arm: imx: hab: Verify IVT self matches calculated address
  arm: imx: hab: Only call ROM once headers are verified
  arm: imx: hab: Print CSF based on IVT descriptor
  arm: imx: hab: Print additional IVT elements during debug
  arm: imx: hab: Define rvt_check_target()
  arm: imx: hab: Implement hab_rvt_check_target
  arm: imx: hab: Add a hab_rvt_check_target to image auth
  arm: imx: hab: Print HAB event log only after calling ROM
  arm: imx: hab: Make internal functions and data static
  arm: imx: hab: Prefix authenticate_image with imx_hab
  arm: imx: hab: Rename is_hab_enabled imx_hab_is_enabled
  arm: imx: hab: Make imx_hab_is_enabled global
  arm: imx: hab: Define rvt_failsafe()
  arm: imx: hab: Implement hab_rvt_failsafe
  arm: imx: hab: Add hab_failsafe console command

 arch/arm/include/asm/mach-imx/hab.h |  46 +++-
 arch/arm/mach-imx/hab.c             | 476 ++++++++++++++++++++++--------------
 arch/arm/mach-imx/spl.c             |  38 ++-
 3 files changed, 369 insertions(+), 191 deletions(-)

Comments

Breno Matheus Lima Jan. 2, 2018, 1:30 p.m. UTC | #1
Hi Bryan,

2017-12-29 23:08 GMT-02:00 Bryan O'Donoghue <bryan.odonoghue@linaro.org>:
> v3:
> - Only call into ROM if headers are verified. - Bryan
>
> - Print HAB event log if and only if a call was made to HAB
>   and a meaningful status code has been obtained. - Breno
>
> v2:
> - Fix compilation warnings and errors in SPL highlighted by
>   Breno Matheus Lima
>
> - Add CC: Breno Matheus Lima <brenomatheus@gmail.com> to all patches
>
> v1:
> This patchset updates the i.MX HAB layer in u-boot to fix a list of
> identified issues and then to add and extend existing functionality.
>
> The first block of patches 0001-0006 deal with fixing existing code,
>
> - Fixes indentation
> - Fixes the treatment of input parameters to hab_auth_image.
>
> The second block of patches 0007-0013 are about tidying up the HAB code
>
> - Remove reliance on hard-coding to specific offsets
> - IVT header drives locating CSF
> - Continue to support existing boards
>
> Patches 0014 onwards extend out the HAB functionality.
>
> - hab_rvt_check_target is a recommended check in the NXP documents to
>   perform prior to hab_rvt_authenticate_image
> - hab_rvt_failsafe is a useful function to set the board into BootROM
>   USB recovery mode.
>
> Bryan O'Donoghue (25):
>   arm: imx: hab: Make authenticate_image return int
>   arm: imx: hab: Fix authenticate_image result code
>   arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail
>   arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail
>   arm: imx: hab: Move IVT_SIZE to hab.h
>   arm: imx: hab: Move CSF_PAD_SIZE to hab.h
>   arm: imx: hab: Fix authenticate_image input parameters
>   arm: imx: hab: Fix authenticate image lockup on MX7
>   arm: imx: hab: Add IVT header definitions
>   arm: imx: hab: Add IVT header verification
>   arm: imx: hab: Verify IVT self matches calculated address
>   arm: imx: hab: Only call ROM once headers are verified
>   arm: imx: hab: Print CSF based on IVT descriptor
>   arm: imx: hab: Print additional IVT elements during debug
>   arm: imx: hab: Define rvt_check_target()
>   arm: imx: hab: Implement hab_rvt_check_target
>   arm: imx: hab: Add a hab_rvt_check_target to image auth
>   arm: imx: hab: Print HAB event log only after calling ROM
>   arm: imx: hab: Make internal functions and data static
>   arm: imx: hab: Prefix authenticate_image with imx_hab
>   arm: imx: hab: Rename is_hab_enabled imx_hab_is_enabled
>   arm: imx: hab: Make imx_hab_is_enabled global
>   arm: imx: hab: Define rvt_failsafe()
>   arm: imx: hab: Implement hab_rvt_failsafe
>   arm: imx: hab: Add hab_failsafe console command

I'm trying to test your patchset but I'm having some problems with the
series numbering, looking in U-Boot list the patches from 18 to 25 are
duplicated:

https://lists.denx.de/pipermail/u-boot/2017-December/thread.html

[U-Boot] [PATCH v3 16/25] arm: imx: hab: Implement
hab_rvt_check_target   Bryan O'Donoghue
[U-Boot] [PATCH v3 17/25] arm: imx: hab: Add a hab_rvt_check_target to
image auth   Bryan O'Donoghue
[U-Boot] [PATCH v3 18/25] arm: imx: hab: Make internal functions and
data static   Bryan O'Donoghue
[U-Boot] [PATCH v3 18/25] arm: imx: hab: Print HAB event log only
after calling ROM   Bryan O'Donoghue
[U-Boot] [PATCH v3 19/25] arm: imx: hab: Make internal functions and
data static   Bryan O'Donoghue
[U-Boot] [PATCH v3 19/25] arm: imx: hab: Prefix authenticate_image
with imx_hab   Bryan O'Donoghue
[U-Boot] [PATCH v3 20/25] arm: imx: hab: Prefix authenticate_image
with imx_hab   Bryan O'Donoghue
[U-Boot] [PATCH v3 20/25] arm: imx: hab: Rename is_hab_enabled
imx_hab_is_enabled   Bryan O'Donoghue
[U-Boot] [PATCH v3 21/25] arm: imx: hab: Make imx_hab_is_enabled
global   Bryan O'Donoghue
[U-Boot] [PATCH v3 21/25] arm: imx: hab: Rename is_hab_enabled
imx_hab_is_enabled   Bryan O'Donoghue
[U-Boot] [PATCH v3 22/25] arm: imx: hab: Define rvt_failsafe()   Bryan
O'Donoghue
[U-Boot] [PATCH v3 22/25] arm: imx: hab: Make imx_hab_is_enabled
global   Bryan O'Donoghue
[U-Boot] [PATCH v3 23/25] arm: imx: hab: Define rvt_failsafe()   Bryan
O'Donoghue
[U-Boot] [PATCH v3 23/25] arm: imx: hab: Implement hab_rvt_failsafe
Bryan O'Donoghue
[U-Boot] [PATCH v3 24/25] arm: imx: hab: Add hab_failsafe console
command   Bryan O'Donoghue
[U-Boot] [PATCH v3 24/25] arm: imx: hab: Implement hab_rvt_failsafe
Bryan O'Donoghue
[U-Boot] [PATCH v3 25/25] arm: imx: hab: Add hab_failsafe console
command   Bryan O'Donoghue
[U-Boot] [PATCH v3 25/25] arm: imx: hab: Print HAB event log only
after calling ROM   Bryan O'Donoghue

Can you please resend this patchset so I can test the latest changes?

Thanks,
Breno Lima
Bryan O'Donoghue Jan. 2, 2018, 4:38 p.m. UTC | #2
On 02/01/18 13:30, Breno Matheus Lima wrote:
> Hi Bryan,
> 
> 2017-12-29 23:08 GMT-02:00 Bryan O'Donoghue <bryan.odonoghue@linaro.org>:
>> v3:
>> - Only call into ROM if headers are verified. - Bryan
>>
>> - Print HAB event log if and only if a call was made to HAB
>>    and a meaningful status code has been obtained. - Breno
>>
>> v2:
>> - Fix compilation warnings and errors in SPL highlighted by
>>    Breno Matheus Lima
>>
>> - Add CC: Breno Matheus Lima <brenomatheus@gmail.com> to all patches
>>
>> v1:
>> This patchset updates the i.MX HAB layer in u-boot to fix a list of
>> identified issues and then to add and extend existing functionality.
>>
>> The first block of patches 0001-0006 deal with fixing existing code,
>>
>> - Fixes indentation
>> - Fixes the treatment of input parameters to hab_auth_image.
>>
>> The second block of patches 0007-0013 are about tidying up the HAB code
>>
>> - Remove reliance on hard-coding to specific offsets
>> - IVT header drives locating CSF
>> - Continue to support existing boards
>>
>> Patches 0014 onwards extend out the HAB functionality.
>>
>> - hab_rvt_check_target is a recommended check in the NXP documents to
>>    perform prior to hab_rvt_authenticate_image
>> - hab_rvt_failsafe is a useful function to set the board into BootROM
>>    USB recovery mode.
>>
>> Bryan O'Donoghue (25):
>>    arm: imx: hab: Make authenticate_image return int
>>    arm: imx: hab: Fix authenticate_image result code
>>    arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail
>>    arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail
>>    arm: imx: hab: Move IVT_SIZE to hab.h
>>    arm: imx: hab: Move CSF_PAD_SIZE to hab.h
>>    arm: imx: hab: Fix authenticate_image input parameters
>>    arm: imx: hab: Fix authenticate image lockup on MX7
>>    arm: imx: hab: Add IVT header definitions
>>    arm: imx: hab: Add IVT header verification
>>    arm: imx: hab: Verify IVT self matches calculated address
>>    arm: imx: hab: Only call ROM once headers are verified
>>    arm: imx: hab: Print CSF based on IVT descriptor
>>    arm: imx: hab: Print additional IVT elements during debug
>>    arm: imx: hab: Define rvt_check_target()
>>    arm: imx: hab: Implement hab_rvt_check_target
>>    arm: imx: hab: Add a hab_rvt_check_target to image auth
>>    arm: imx: hab: Print HAB event log only after calling ROM
>>    arm: imx: hab: Make internal functions and data static
>>    arm: imx: hab: Prefix authenticate_image with imx_hab
>>    arm: imx: hab: Rename is_hab_enabled imx_hab_is_enabled
>>    arm: imx: hab: Make imx_hab_is_enabled global
>>    arm: imx: hab: Define rvt_failsafe()
>>    arm: imx: hab: Implement hab_rvt_failsafe
>>    arm: imx: hab: Add hab_failsafe console command
> 
> I'm trying to test your patchset but I'm having some problems with the
> series numbering, looking in U-Boot list the patches from 18 to 25 are
> duplicated:
> 
> https://lists.denx.de/pipermail/u-boot/2017-December/thread.html
> 
> [U-Boot] [PATCH v3 16/25] arm: imx: hab: Implement
> hab_rvt_check_target   Bryan O'Donoghue
> [U-Boot] [PATCH v3 17/25] arm: imx: hab: Add a hab_rvt_check_target to
> image auth   Bryan O'Donoghue
> [U-Boot] [PATCH v3 18/25] arm: imx: hab: Make internal functions and
> data static   Bryan O'Donoghue
> [U-Boot] [PATCH v3 18/25] arm: imx: hab: Print HAB event log only
> after calling ROM   Bryan O'Donoghue
> [U-Boot] [PATCH v3 19/25] arm: imx: hab: Make internal functions and
> data static   Bryan O'Donoghue
> [U-Boot] [PATCH v3 19/25] arm: imx: hab: Prefix authenticate_image
> with imx_hab   Bryan O'Donoghue
> [U-Boot] [PATCH v3 20/25] arm: imx: hab: Prefix authenticate_image
> with imx_hab   Bryan O'Donoghue
> [U-Boot] [PATCH v3 20/25] arm: imx: hab: Rename is_hab_enabled
> imx_hab_is_enabled   Bryan O'Donoghue
> [U-Boot] [PATCH v3 21/25] arm: imx: hab: Make imx_hab_is_enabled
> global   Bryan O'Donoghue
> [U-Boot] [PATCH v3 21/25] arm: imx: hab: Rename is_hab_enabled
> imx_hab_is_enabled   Bryan O'Donoghue
> [U-Boot] [PATCH v3 22/25] arm: imx: hab: Define rvt_failsafe()   Bryan
> O'Donoghue
> [U-Boot] [PATCH v3 22/25] arm: imx: hab: Make imx_hab_is_enabled
> global   Bryan O'Donoghue
> [U-Boot] [PATCH v3 23/25] arm: imx: hab: Define rvt_failsafe()   Bryan
> O'Donoghue
> [U-Boot] [PATCH v3 23/25] arm: imx: hab: Implement hab_rvt_failsafe
> Bryan O'Donoghue
> [U-Boot] [PATCH v3 24/25] arm: imx: hab: Add hab_failsafe console
> command   Bryan O'Donoghue
> [U-Boot] [PATCH v3 24/25] arm: imx: hab: Implement hab_rvt_failsafe
> Bryan O'Donoghue
> [U-Boot] [PATCH v3 25/25] arm: imx: hab: Add hab_failsafe console
> command   Bryan O'Donoghue
> [U-Boot] [PATCH v3 25/25] arm: imx: hab: Print HAB event log only
> after calling ROM   Bryan O'Donoghue
> 
> Can you please resend this patchset so I can test the latest changes?

hmm how did that happen..