summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/sha_internal.h
diff options
context:
space:
mode:
authorjsing <>2023-04-14 10:45:15 +0000
committerjsing <>2023-04-14 10:45:15 +0000
commitcf8c23344c650c985a16207e78fc8f4b62e4159f (patch)
tree0c2cc5494f42b9056f080802ba999645a01d7e0e /src/lib/libcrypto/sha/sha_internal.h
parentd51664c544bf925201b4c94a522e418074dfbc51 (diff)
downloadopenbsd-cf8c23344c650c985a16207e78fc8f4b62e4159f.tar.gz
openbsd-cf8c23344c650c985a16207e78fc8f4b62e4159f.tar.bz2
openbsd-cf8c23344c650c985a16207e78fc8f4b62e4159f.zip
Add support for truncated SHA512 variants.
This adds support for SHA512/224 and SHA512/256, as specified in FIPS FIPS 180-4. These are truncated versions of the SHA512 hash. ok tb@
Diffstat (limited to 'src/lib/libcrypto/sha/sha_internal.h')
-rw-r--r--src/lib/libcrypto/sha/sha_internal.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/libcrypto/sha/sha_internal.h b/src/lib/libcrypto/sha/sha_internal.h
new file mode 100644
index 0000000000..c479993185
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha_internal.h
@@ -0,0 +1,36 @@
1/* $OpenBSD: sha_internal.h,v 1.1 2023/04/14 10:45:15 jsing Exp $ */
2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/sha.h>
19
20#ifndef HEADER_SHA_INTERNAL_H
21#define HEADER_SHA_INTERNAL_H
22
23#define SHA512_224_DIGEST_LENGTH 28
24#define SHA512_256_DIGEST_LENGTH 32
25
26int SHA512_224_Init(SHA512_CTX *c);
27int SHA512_224_Update(SHA512_CTX *c, const void *data, size_t len)
28 __attribute__ ((__bounded__(__buffer__,2,3)));
29int SHA512_224_Final(unsigned char *md, SHA512_CTX *c);
30
31int SHA512_256_Init(SHA512_CTX *c);
32int SHA512_256_Update(SHA512_CTX *c, const void *data, size_t len)
33 __attribute__ ((__bounded__(__buffer__,2,3)));
34int SHA512_256_Final(unsigned char *md, SHA512_CTX *c);
35
36#endif