xref: /freebsd/sys/sys/md5.h (revision 6fa42b91ca3f481912af98c4d49c44507eb1b8e1)
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
8 rights reserved.
9 
10 License to copy and use this software is granted provided that it
11 is identified as the "RSA Data Security, Inc. MD5 Message-Digest
12 Algorithm" in all material mentioning or referencing this software
13 or this function.
14 
15 License is also granted to make and use derivative works provided
16 that such works are identified as "derived from the RSA Data
17 Security, Inc. MD5 Message-Digest Algorithm" in all material
18 mentioning or referencing the derived work.
19 
20 RSA Data Security, Inc. makes no representations concerning either
21 the merchantability of this software or the suitability of this
22 software for any particular purpose. It is provided "as is"
23 without express or implied warranty of any kind.
24 
25 These notices must be retained in any copies of any part of this
26 documentation 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. */
39 typedef 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
88 void   MD5Init (MD5_CTX *);
89 void   MD5Update (MD5_CTX *, const void *, unsigned int);
90 void   MD5Final (unsigned char[__min_size(MD5_DIGEST_LENGTH)], MD5_CTX *);
91 #ifndef _KERNEL
92 char * MD5End(MD5_CTX *, char *);
93 char * MD5Fd(int, char *);
94 char * MD5FdChunk(int, char *, off_t, off_t);
95 char * MD5File(const char *, char *);
96 char * MD5FileChunk(const char *, char *, off_t, off_t);
97 char * MD5Data(const void *, unsigned int, char *);
98 #endif
99 __END_DECLS
100 #endif /* _SYS_MD5_H_ */
101