summaryrefslogtreecommitdiffstats
path: root/src/fundamental/sha256.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-08-17 11:32:38 +0200
committerLennart Poettering <lennart@poettering.net>2022-08-19 12:53:04 +0200
commit558d96240bea7d910144fa2cad1fe2f8061ffa74 (patch)
tree38cf1c02d55236dfa3865d570818c9882671ad66 /src/fundamental/sha256.h
parentrandom-seed: use SHA256_DIGEST_SIZE (diff)
downloadsystemd-558d96240bea7d910144fa2cad1fe2f8061ffa74.tar.xz
systemd-558d96240bea7d910144fa2cad1fe2f8061ffa74.zip
sha256: add sha256_direct()/SHA256_DIRECT() helpers
Diffstat (limited to 'src/fundamental/sha256.h')
-rw-r--r--src/fundamental/sha256.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fundamental/sha256.h b/src/fundamental/sha256.h
index 337e746c49..31790c2ebd 100644
--- a/src/fundamental/sha256.h
+++ b/src/fundamental/sha256.h
@@ -27,3 +27,7 @@ struct sha256_ctx {
void sha256_init_ctx(struct sha256_ctx *ctx);
uint8_t *sha256_finish_ctx(struct sha256_ctx *ctx, uint8_t resbuf[static SHA256_DIGEST_SIZE]);
void sha256_process_bytes(const void *buffer, size_t len, struct sha256_ctx *ctx);
+
+uint8_t* sha256_direct(const void *buffer, size_t sz, uint8_t result[static SHA256_DIGEST_SIZE]);
+
+#define SHA256_DIRECT(buffer, sz) sha256_direct(buffer, sz, (uint8_t[SHA256_DIGEST_SIZE]) {})