summaryrefslogtreecommitdiff
path: root/userland/libc/include/tb
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-03 16:08:46 +0200
committerAnton Kling <anton@kling.gg>2024-10-03 16:09:12 +0200
commit372c633aa22d826bc515213ad4211791440f60f8 (patch)
treeb2de66c9bf612a0a149c65786335a6cebde37840 /userland/libc/include/tb
parent226d861c9ebb7f09f95665d07d9ab5c6b7ed7d6f (diff)
libc: Add sendfile and queue
Diffstat (limited to 'userland/libc/include/tb')
-rw-r--r--userland/libc/include/tb/sha1.h26
1 files changed, 26 insertions, 0 deletions
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 <anton@kling.gg>
+//
+// SPDX-License-Identifier: 0BSD
+//
+#ifndef SHA1
+#define SHA1
+#include <stddef.h>
+#include <stdint.h>
+
+#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