aboutsummaryrefslogtreecommitdiff
path: root/lib/crypt/crypt-port.h
diff options
context:
space:
mode:
authorSteffen Jaeckel <jaeckel-floss@eyet-services.de>2021-07-08 15:57:33 +0200
committerTom Rini <trini@konsulko.com>2021-07-23 13:36:14 -0400
commit26dd9936574864155b989b9f14319ca2779f0598 (patch)
tree41fe3ce1471a80916ea6cc91d8a6e7c956c8e2d9 /lib/crypt/crypt-port.h
parentc74675bd904b6ce9d5820a80f27793c0583fd54c (diff)
lib: add crypt subsystem
Add the basic functionality required to support the standard crypt format. The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and their formatting is therefor retained. The integration is done via a crypt_compare() function in crypt.c. ``` libxcrypt $ git describe --long --always --all tags/v4.4.17-0-g6b110bc ``` Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'lib/crypt/crypt-port.h')
-rw-r--r--lib/crypt/crypt-port.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/crypt/crypt-port.h b/lib/crypt/crypt-port.h
new file mode 100644
index 0000000000..680ffe9349
--- /dev/null
+++ b/lib/crypt/crypt-port.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/* Copyright (C) 2020 Steffen Jaeckel <jaeckel-floss@eyet-services.de> */
+
+#include <linux/types.h>
+#include <vsprintf.h>
+
+#define NO_GENSALT
+#define CRYPT_OUTPUT_SIZE 384
+#define ALG_SPECIFIC_SIZE 8192
+
+#define ARG_UNUSED(x) (x)
+
+#define static_assert(a, b) _Static_assert(a, b)
+
+#define strtoul(cp, endp, base) simple_strtoul(cp, endp, base)
+
+extern const unsigned char ascii64[65];
+
+#define b64t ((const char *)ascii64)
+
+void crypt_sha256crypt_rn(const char *phrase, size_t phr_size,
+ const char *setting, size_t ARG_UNUSED(set_size),
+ uint8_t *output, size_t out_size, void *scratch,
+ size_t scr_size);
+void crypt_sha512crypt_rn(const char *phrase, size_t phr_size,
+ const char *setting, size_t ARG_UNUSED(set_size),
+ uint8_t *output, size_t out_size, void *scratch,
+ size_t scr_size);