mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-13 14:53:06 +00:00
0fcc1c76d1
This patch adds support for the SHA-256 Secure Hash Algorithm for CPUs that have support for the SHA-256 part of the ARM v8 Crypto Extensions. It greatly improves sha-256 based operations, about 17x faster on iMX8M evk board. ~12ms vs ~208ms for a 20MiB kernel sha-256 verification. asm implementation is a simplified version of the Linux version (from Ard Biesheuvel). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
21 lines
509 B
C
21 lines
509 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* sha256_ce_glue.c - SHA-256 secure hash using ARMv8 Crypto Extensions
|
|
*
|
|
* Copyright (C) 2022 Linaro Ltd <loic.poulain@linaro.org>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <u-boot/sha256.h>
|
|
|
|
extern void sha256_armv8_ce_process(uint32_t state[8], uint8_t const *src,
|
|
uint32_t blocks);
|
|
|
|
void sha256_process(sha256_context *ctx, const unsigned char *data,
|
|
unsigned int blocks)
|
|
{
|
|
if (!blocks)
|
|
return;
|
|
|
|
sha256_armv8_ce_process(ctx->state, data, blocks);
|
|
}
|