mirror of
				https://source.denx.de/u-boot/u-boot.git
				synced 2025-11-03 18:01:41 +01:00 
			
		
		
		
	This patch adds support for the SHA-1 Secure Hash Algorithm for CPUs that have support for the SHA-1 part of the ARM v8 Crypto Extensions. It greatly improves sha-1 based operations, about 10x faster on iMX8M evk board. ~12ms vs ~165ms for a 20MiB kernel sha-1 verification. asm implementation is a simplified version of the Linux version (from Ard Biesheuvel). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
		
			
				
	
	
		
			22 lines
		
	
	
		
			491 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			491 B
		
	
	
	
		
			C
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0-only
 | 
						|
/*
 | 
						|
 * sha1_ce_glue.c - SHA-1 secure hash using ARMv8 Crypto Extensions
 | 
						|
 *
 | 
						|
 * Copyright (C) 2022 Linaro Ltd <loic.poulain@linaro.org>
 | 
						|
 */
 | 
						|
 | 
						|
#include <common.h>
 | 
						|
#include <u-boot/sha1.h>
 | 
						|
 | 
						|
extern void sha1_armv8_ce_process(uint32_t state[5], uint8_t const *src,
 | 
						|
				  uint32_t blocks);
 | 
						|
 | 
						|
void sha1_process(sha1_context *ctx, const unsigned char *data,
 | 
						|
		  unsigned int blocks)
 | 
						|
{
 | 
						|
	if (!blocks)
 | 
						|
		return;
 | 
						|
 | 
						|
	sha1_armv8_ce_process(ctx->state, data, blocks);
 | 
						|
}
 |