From 2cb7e0aaedad73b076ea18c6900b0e86c5760d79 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 15:00:47 +0200 Subject: Adding upstream version 247.3. Signed-off-by: Daniel Baumann --- src/boot/efi/sha256.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/boot/efi/sha256.h (limited to 'src/boot/efi/sha256.h') diff --git a/src/boot/efi/sha256.h b/src/boot/efi/sha256.h new file mode 100644 index 0000000..464be59 --- /dev/null +++ b/src/boot/efi/sha256.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include +#include + +struct sha256_ctx { + UINT32 H[8]; + + union { + UINT64 total64; +#define TOTAL64_low (1 - (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) +#define TOTAL64_high (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) + UINT32 total[2]; + }; + + UINT32 buflen; + + union { + UINT8 buffer[128]; /* NB: always correctly aligned for UINT32. */ + UINT32 buffer32[32]; + UINT64 buffer64[16]; + }; +}; + +void sha256_init_ctx(struct sha256_ctx *ctx); +void *sha256_finish_ctx(struct sha256_ctx *ctx, VOID *resbuf); +void sha256_process_bytes(const void *buffer, UINTN len, struct sha256_ctx *ctx); -- cgit v1.2.3