[U-Boot] [PATCH 1/2][v3] fsl_sec: Add hardware accelerated SHA256 and SHA1
Simon Glass
sjg at chromium.org
Wed Oct 15 17:58:23 CEST 2014
Hi,
On 15 October 2014 11:02, Ruchika Gupta <ruchika.gupta at freescale.com> wrote:
> Hi Simon,
>
> I have defined the functions for hardware acceleration which are already present in hash.c for Freescale platforms.
>
> In hash.c
> static struct hash_algo hash_algo[] = {
> /*
> * CONFIG_SHA_HW_ACCEL is defined if hardware acceleration is
> * available.
> */
> #ifdef CONFIG_SHA_HW_ACCEL
> {
> "sha1",
> SHA1_SUM_LEN,
> hw_sha1,
> CHUNKSZ_SHA1,
> }, {
> "sha256",
> SHA256_SUM_LEN,
> hw_sha256,
> CHUNKSZ_SHA256,
> },
> #endif
> /*
>
> In the patch below, I have added defined the above functions for Freescale platforms.
>
> +void hw_sha256(const unsigned char *pbuf, unsigned int buf_len,
> + unsigned char *pout, unsigned int chunk_size)
> +{
> + if (caam_hash(pbuf, buf_len, pout, SHA256))
> + printf("CAAM was not setup properly or it is faulty\n");
> +}
> +
> +void hw_sha1(const unsigned char *pbuf, unsigned int buf_len,
> + unsigned char *pout, unsigned int chunk_size)
> +{
> + if (caam_hash(pbuf, buf_len, pout, SHA1))
> + printf("CAAM was not setup properly or it is faulty\n");
> +}
OK I see, thanks for explaining this.
Regards,
Simon
More information about the U-Boot
mailing list