[PATCH] crypto: fsl_hash: Remove unnecessary alignment check in, caam_hash()

Michal Vokáč michal.vokac at ysoft.com
Fri Jun 10 12:02:31 CEST 2022


> On Fri, Apr 29, 2022 at 10:35 AM Stefan Roese <sr at denx.de> wrote:
>>
>> While working on an LX2160 based board and updating to latest mainline
>> I noticed problems using the HW accelerated hash functions on this
>> platform, when trying to boot a FIT Kernel image. Here the resulting
>> error message:
>>
>>    Using 'conf-freescale_lx2160a.dtb' configuration
>>    Trying 'kernel-1' kernel subimage
>>    Verifying Hash Integrity ... sha256Error: Address arguments are not aligned
>> CAAM was not setup properly or it is faulty
>>  error!
>> Bad hash value for 'hash-1' hash node in 'kernel-1' image node
>> Bad Data Hash
>> ERROR: can't get kernel image!
>>
>> Testing and checking with Gaurav Jain from NXP has revealed, that this
>> alignment check is not necessary here at all. So let's remove this
>> check completely.
>>
>> Signed-off-by: Stefan Roese <sr at denx.de>
>> Cc: Gaurav Jain <gaurav.jain at nxp.com>
>> Cc: dullfire at yahoo.com
> 
> I applied this patch against top of tree U-Boot, but I am still
> getting the following
> error on a kontron-sl-mx8mm board with the options below selected:
> 
> CONFIG_IMX_HAB=y
> CONFIG_SPL_DRIVERS_MISC=y
> 
> ### Loading kernel from FIT Image at 42000000 ...
>    Using 'conf-freescale_imx8mm-kontron-n801x-s.dtb' configuration
>    Trying 'kernel-1' kernel subimage
>      Description:  Linux kernel
>      Created:      2022-06-07   1:58:57 UTC
>      Type:         Kernel Image
>      Compression:  gzip compressed
>      Data Start:   0x42000100
>      Data Size:    7609360 Bytes = 7.3 MiB
>      Architecture: AArch64
>      OS:           Linux
>      Load Address: 0x40480000
>      Entry Point:  0x40480000
>      Hash algo:    sha256
>      Hash value:
> d20b5d533e123096edb05a6433d850c0fafb4b39a6e6d47e9bade3f6fa7c26ce
>    Verifying Hash Integrity ... sha256dev_get_priv: null device

Hi Fabio,
I had the very same problem/error on i.MX6 and figured out that
CONFIG_ARCH_MISC_INIT=y must be enabled otherwise the caam_jr driver
is not initialized.

I also tried this patch. Now the caam_hash() returns OK and I can boot
the board but I am still seeing a warning regarding wrong alignment
from cache lib:

=> bootm 12000000#conf-4
## Loading kernel from FIT Image at 12000000 ...
    Using 'conf-4' configuration
    Verifying Hash Integrity ... OK
    Trying 'kernel' kernel subimage
      Description:  Kernel
      Type:         Kernel Image
      Compression:  uncompressed
      Data Start:   0x120000dc
      Data Size:    2901024 Bytes = 2.8 MiB
      Architecture: ARM
      OS:           Linux
      Load Address: 0x10800000
      Entry Point:  0x10800000
      Hash algo:    sha256
      Hash value:   a3343f1df615f14677176ea4966644fcaa25b31bd3808682567b7fedf704cfb8
    Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [120000dc, 122c451c]
+ OK
## Loading fdt from FIT Image at 12000000 ...
    Using 'conf-4' configuration
    Verifying Hash Integrity ... OK
    Trying 'fdt-4' fdt subimage
      Description:  Orion Flattened Device Tree blob
      Type:         Flat Device Tree
      Compression:  uncompressed
      Data Start:   0x122c4604
      Data Size:    41038 Bytes = 40.1 KiB
      Architecture: ARM
      Load Address: 0x18000000
      Hash algo:    sha256
      Hash value:   13e0b23bd49f9e86a0425080fc788db67bf318d6f103f217d5705a455737e91c
    Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [122c4604, 122ce684]
+ OK
    Loading fdt from 0x122c4604 to 0x18000000
    Booting using the fdt blob at 0x18000000
    Loading Kernel Image
    Using Device Tree in place at 18000000, end 1800d04d

Starting kernel ...

Michal



More information about the U-Boot mailing list