xref: /freebsd/sbin/ipf/ipftest/md5.h (revision 783d3ff6d7fae619db8a7990b8a6387de0c677b5)
1 
2 /*
3  ***********************************************************************
4  ** md5.h -- header file for implementation of MD5                    **
5  ** RSA Data Security, Inc. MD5 Message-Digest Algorithm              **
6  ** Created: 2/17/90 RLR                                              **
7  ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version               **
8  ** Revised (for MD5): RLR 4/27/91                                    **
9  **   -- G modified to have y&~z instead of y&z                       **
10  **   -- FF, GG, HH modified to add in last register done             **
11  **   -- Access pattern: round 2 works mod 5, round 3 works mod 3     **
12  **   -- distinct additive constant for each step                     **
13  **   -- round 4 added, working mod 7                                 **
14  ***********************************************************************
15  */
16 
17 /*
18  ***********************************************************************
19  ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved.  **
20  **                                                                   **
21  ** License to copy and use this software is granted provided that    **
22  ** it is identified as the "RSA Data Security, Inc. MD5 Message-     **
23  ** Digest Algorithm" in all material mentioning or referencing this  **
24  ** software or this function.                                        **
25  **                                                                   **
26  ** License is also granted to make and use derivative works          **
27  ** provided that such works are identified as "derived from the RSA  **
28  ** Data Security, Inc. MD5 Message-Digest Algorithm" in all          **
29  ** material mentioning or referencing the derived work.              **
30  **                                                                   **
31  ** RSA Data Security, Inc. makes no representations concerning       **
32  ** either the merchantability of this software or the suitability    **
33  ** of this software for any particular purpose.  It is provided "as  **
34  ** is" without express or implied warranty of any kind.              **
35  **                                                                   **
36  ** These notices must be retained in any copies of any part of this  **
37  ** documentation and/or software.                                    **
38  ***********************************************************************
39  */
40 
41 #if !defined(__MD5_INCLUDE__) && !defined(_SYS_MD5_H)
42 
43 #ifndef __P
44 #  define	__P(x)	x
45 #endif
46 
47 /* typedef a 32-bit type */
48 typedef unsigned int UINT4;
49 
50 /* Data structure for MD5 (Message-Digest) computation */
51 typedef struct {
52   UINT4 i[2];                   /* number of _bits_ handled mod 2^64 */
53   UINT4 buf[4];                                    /* scratch buffer */
54   unsigned char in[64];                              /* input buffer */
55   unsigned char digest[16];     /* actual digest after MD5Final call */
56 } MD5_CTX;
57 
58 extern void MD5Init(MD5_CTX *);
59 extern void MD5Update(MD5_CTX *, unsigned char *, unsigned int);
60 extern void MD5Final(unsigned char *, MD5_CTX *);
61 
62 #define __MD5_INCLUDE__
63 #endif /* __MD5_INCLUDE__ */
64