From 372c633aa22d826bc515213ad4211791440f60f8 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 3 Oct 2024 16:08:46 +0200 Subject: libc: Add sendfile and queue --- userland/libc/include/tb/sha1.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 userland/libc/include/tb/sha1.h (limited to 'userland/libc/include/tb') diff --git a/userland/libc/include/tb/sha1.h b/userland/libc/include/tb/sha1.h new file mode 100644 index 0000000..fe84196 --- /dev/null +++ b/userland/libc/include/tb/sha1.h @@ -0,0 +1,26 @@ +// +// Copyright (C) 2022-2023 by Anton Kling +// +// SPDX-License-Identifier: 0BSD +// +#ifndef SHA1 +#define SHA1 +#include +#include + +#define BLOCK_BYTES (64) /* 512/8 */ +#define SHA1_LEN (20) + +typedef struct SHA1_CTX { + uint32_t h[5]; + uint8_t block[BLOCK_BYTES]; + uint64_t active_len; + uint64_t len; +} SHA1_CTX; + +void SHA1_Init(SHA1_CTX *ctx); +void SHA1_Update(SHA1_CTX *ctx, const void *data, uint64_t len); +void SHA1_Final(SHA1_CTX *ctx, unsigned char *message_digest); +void SHA1_HMAC(unsigned char *message, uint64_t message_len, unsigned char *key, + uint64_t key_len, uint8_t output[SHA1_LEN]); +#endif -- cgit v1.2.3