]> git.ozlabs.org Git - ppp.git/blob - pppd/md4.h
Merge pull request #349 from enaess/ppp-autotools
[ppp.git] / pppd / md4.h
1
2 /*
3 ** ********************************************************************
4 ** md4.h -- Header file for implementation of                        **
5 ** MD4 Message Digest Algorithm                                      **
6 ** Updated: 2/13/90 by Ronald L. Rivest                              **
7 ** (C) 1990 RSA Data Security, Inc.                                  **
8 ** ********************************************************************
9 */
10 #ifndef PPP_MD4_H
11 #define PPP_MD4_H
12
13 #include "pppdconf.h"
14
15 #ifndef USE_MD4
16 #include <openssl/md4.h>
17 #define MD4Init MD4_Init
18 #define MD4Update MD4_Update
19 #define MD4Final MD4_Final
20 #else
21
22 /* MDstruct is the data structure for a message digest computation.
23 */
24 typedef struct {
25         unsigned int buffer[4]; /* Holds 4-word result of MD computation */
26         unsigned char count[8]; /* Number of bits processed so far */
27         unsigned int done;      /* Nonzero means MD computation finished */
28 } MD4_CTX;
29
30 /* MD4Init(MD4_CTX *)
31 ** Initialize the MD4_CTX prepatory to doing a message digest
32 ** computation.
33 */
34 extern void MD4Init(MD4_CTX *MD);
35
36 /* MD4Update(MD,X,count)
37 ** Input: X -- a pointer to an array of unsigned characters.
38 **        count -- the number of bits of X to use (an unsigned int).
39 ** Updates MD using the first "count" bits of X.
40 ** The array pointed to by X is not modified.
41 ** If count is not a multiple of 8, MD4Update uses high bits of
42 ** last byte.
43 ** This is the basic input routine for a user.
44 ** The routine terminates the MD computation when count < 512, so
45 ** every MD computation should end with one call to MD4Update with a
46 ** count less than 512.  Zero is OK for a count.
47 */
48 extern void MD4Update(MD4_CTX *MD, unsigned char *X, unsigned int count);
49
50 /* MD4Print(MD)
51 ** Prints message digest buffer MD as 32 hexadecimal digits.
52 ** Order is from low-order byte of buffer[0] to high-order byte
53 ** of buffer[3].
54 ** Each byte is printed with high-order hexadecimal digit first.
55 */
56 extern void MD4Print(MD4_CTX *);
57
58 /* MD4Final(buf, MD)
59 ** Returns message digest from MD and terminates the message
60 ** digest computation.
61 */
62 extern void MD4Final(unsigned char *, MD4_CTX *);
63
64 /*
65 ** End of md4.h
66 ****************************(cut)***********************************/
67 #endif  /* USE_MD4 */
68 #endif  /* PPP_MD4_H */