1/* MD5.H - header file for MD5C.C
2 */
3
4/*-
5 SPDX-License-Identifier: RSA-MD
6
7 Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
8rights reserved.
9
10License to copy and use this software is granted provided that it
11is identified as the "RSA Data Security, Inc. MD5 Message-Digest
12Algorithm" in all material mentioning or referencing this software
13or this function.
14
15License is also granted to make and use derivative works provided
16that such works are identified as "derived from the RSA Data
17Security, Inc. MD5 Message-Digest Algorithm" in all material
18mentioning or referencing the derived work.
19
20RSA Data Security, Inc. makes no representations concerning either
21the merchantability of this software or the suitability of this
22software for any particular purpose. It is provided "as is"
23without express or implied warranty of any kind.
24
25These notices must be retained in any copies of any part of this
26documentation and/or software.
27 */
28
29#ifndef _SYS_MD5_H_
30#define _SYS_MD5_H_
31
32#include <sys/types.h>
33
34#define MD5_BLOCK_LENGTH 64
35#define MD5_DIGEST_LENGTH 16
36#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
37
38/* MD5 context. */
39typedef struct MD5Context {
40 u_int32_t state[4]; /* state (ABCD) */
41 u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
42 unsigned char buffer[64]; /* input buffer */
43} MD5_CTX;
44
45#ifndef _KERNEL
46
47/* Ensure libmd symbols do not clash with libcrypto */
48
49#ifndef MD5Init
50#define MD5Init _libmd_MD5Init
51#endif
52#ifndef MD5Update
53#define MD5Update _libmd_MD5Update
54#endif
55#ifndef MD5Pad
56#define MD5Pad _libmd_MD5Pad
57#endif
58#ifndef MD5Final
59#define MD5Final _libmd_MD5Final
60#endif
61#ifndef MD5Transform
62#define MD5Transform _libmd_MD5Transform
63#endif
64#ifndef MD5End
65#define MD5End _libmd_MD5End
66#endif
67#ifndef MD5Fd
68#define MD5Fd _libmd_MD5Fd
69#endif
70#ifndef MD5FdChunk
71#define MD5FdChunk _libmd_MD5FdChunk
72#endif
73#ifndef MD5File
74#define MD5File _libmd_MD5File
75#endif
76#ifndef MD5FileChunk
77#define MD5FileChunk _libmd_MD5FileChunk
78#endif
79#ifndef MD5Data
80#define MD5Data _libmd_MD5Data
81#endif
82
83#endif
84
85#include <sys/cdefs.h>
86
87__BEGIN_DECLS
88void MD5Init (MD5_CTX *);
89void MD5Update (MD5_CTX *, const void *, unsigned int);
90void MD5Final (unsigned char[__min_size(MD5_DIGEST_LENGTH)], MD5_CTX *);
91#ifndef _KERNEL
92char * MD5End(MD5_CTX *, char *);
93char * MD5Fd(int, char *);
94char * MD5FdChunk(int, char *, off_t, off_t);
95char * MD5File(const char *, char *);
96char * MD5FileChunk(const char *, char *, off_t, off_t);
97char * MD5Data(const void *, unsigned int, char *);
98#endif
99__END_DECLS
100#endif /* _SYS_MD5_H_ */