1292782Sallanjude/*-
2292782Sallanjude * Copyright 2005 Colin Percival
3292782Sallanjude * All rights reserved.
4292782Sallanjude *
5292782Sallanjude * Redistribution and use in source and binary forms, with or without
6292782Sallanjude * modification, are permitted provided that the following conditions
7292782Sallanjude * are met:
8292782Sallanjude * 1. Redistributions of source code must retain the above copyright
9292782Sallanjude *    notice, this list of conditions and the following disclaimer.
10292782Sallanjude * 2. Redistributions in binary form must reproduce the above copyright
11292782Sallanjude *    notice, this list of conditions and the following disclaimer in the
12292782Sallanjude *    documentation and/or other materials provided with the distribution.
13292782Sallanjude *
14292782Sallanjude * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15292782Sallanjude * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16292782Sallanjude * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17292782Sallanjude * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18292782Sallanjude * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19292782Sallanjude * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20292782Sallanjude * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21292782Sallanjude * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22292782Sallanjude * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23292782Sallanjude * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24292782Sallanjude * SUCH DAMAGE.
25292782Sallanjude *
26292782Sallanjude * $FreeBSD: stable/10/sys/crypto/sha2/sha384.h 314327 2017-02-27 08:27:38Z avg $
27292782Sallanjude */
28292782Sallanjude
29292782Sallanjude#ifndef _SHA384_H_
30292782Sallanjude#define _SHA384_H_
31292782Sallanjude
32292782Sallanjude#ifndef _KERNEL
33292782Sallanjude#include <sys/types.h>
34292782Sallanjude#endif
35292782Sallanjude
36292782Sallanjude#define SHA384_BLOCK_LENGTH		128
37292782Sallanjude#define SHA384_DIGEST_LENGTH		48
38292782Sallanjude#define SHA384_DIGEST_STRING_LENGTH	(SHA384_DIGEST_LENGTH * 2 + 1)
39292782Sallanjude
40292782Sallanjudetypedef struct SHA384Context {
41292782Sallanjude	uint64_t state[8];
42292782Sallanjude	uint64_t count[2];
43292782Sallanjude	uint8_t buf[SHA384_BLOCK_LENGTH];
44292782Sallanjude} SHA384_CTX;
45292782Sallanjude
46292782Sallanjude__BEGIN_DECLS
47292782Sallanjude
48292782Sallanjude/* Ensure libmd symbols do not clash with libcrypto */
49292782Sallanjude#ifndef SHA384_Init
50292782Sallanjude#define SHA384_Init		_libmd_SHA384_Init
51292782Sallanjude#endif
52292782Sallanjude#ifndef SHA384_Update
53292782Sallanjude#define SHA384_Update		_libmd_SHA384_Update
54292782Sallanjude#endif
55292782Sallanjude#ifndef SHA384_Final
56292782Sallanjude#define SHA384_Final		_libmd_SHA384_Final
57292782Sallanjude#endif
58292782Sallanjude#ifndef SHA384_End
59292782Sallanjude#define SHA384_End		_libmd_SHA384_End
60292782Sallanjude#endif
61292782Sallanjude#ifndef SHA384_File
62292782Sallanjude#define SHA384_File		_libmd_SHA384_File
63292782Sallanjude#endif
64292782Sallanjude#ifndef SHA384_FileChunk
65292782Sallanjude#define SHA384_FileChunk	_libmd_SHA384_FileChunk
66292782Sallanjude#endif
67292782Sallanjude#ifndef SHA384_Data
68292782Sallanjude#define SHA384_Data		_libmd_SHA384_Data
69292782Sallanjude#endif
70292782Sallanjude
71292782Sallanjude#ifndef SHA384_version
72292782Sallanjude#define SHA384_version		_libmd_SHA384_version
73292782Sallanjude#endif
74292782Sallanjude
75292782Sallanjudevoid	SHA384_Init(SHA384_CTX *);
76292782Sallanjudevoid	SHA384_Update(SHA384_CTX *, const void *, size_t);
77292782Sallanjudevoid	SHA384_Final(unsigned char [SHA384_DIGEST_LENGTH], SHA384_CTX *);
78292782Sallanjude#ifndef _KERNEL
79292782Sallanjudechar   *SHA384_End(SHA384_CTX *, char *);
80292782Sallanjudechar   *SHA384_Data(const void *, unsigned int, char *);
81292782Sallanjudechar   *SHA384_File(const char *, char *);
82292782Sallanjudechar   *SHA384_FileChunk(const char *, char *, off_t, off_t);
83292782Sallanjude#endif
84292782Sallanjude
85292782Sallanjude__END_DECLS
86292782Sallanjude
87292782Sallanjude#endif /* !_SHA384_H_ */
88