OLD | NEW |
1 /* crypto/md5/md5.h */ | 1 /* crypto/md5/md5.h */ |
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #ifndef HEADER_MD5_H | 59 #ifndef HEADER_MD5_H |
60 #define HEADER_MD5_H | 60 #define HEADER_MD5_H |
61 | 61 |
62 #include <openssl/e_os2.h> | 62 #include <openssl/e_os2.h> |
63 #include <stddef.h> | 63 #include <stddef.h> |
64 | 64 |
65 #ifdef __cplusplus | 65 #ifdef __cplusplus |
66 extern "C" { | 66 extern "C" { |
67 #endif | 67 #endif |
68 | 68 |
69 #include <stddef.h> | |
70 | |
71 #ifdef OPENSSL_NO_MD5 | 69 #ifdef OPENSSL_NO_MD5 |
72 #error MD5 is disabled. | 70 #error MD5 is disabled. |
73 #endif | 71 #endif |
74 | 72 |
75 /* | 73 /* |
76 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 74 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
77 * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! | 75 * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! |
78 * ! MD5_LONG_LOG2 has to be defined along. ! | 76 * ! MD5_LONG_LOG2 has to be defined along. ! |
79 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 77 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
80 */ | 78 */ |
81 | 79 |
82 #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 80 #if defined(__LP32__) |
83 #define MD5_LONG unsigned long | 81 #define MD5_LONG unsigned long |
84 #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | 82 #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
85 #define MD5_LONG unsigned long | 83 #define MD5_LONG unsigned long |
86 #define MD5_LONG_LOG2 3 | 84 #define MD5_LONG_LOG2 3 |
87 /* | 85 /* |
88 * _CRAY note. I could declare short, but I have no idea what impact | 86 * _CRAY note. I could declare short, but I have no idea what impact |
89 * does it have on performance on none-T3E machines. I could declare | 87 * does it have on performance on none-T3E machines. I could declare |
90 * int, but at least on C90 sizeof(int) can be chosen at compile time. | 88 * int, but at least on C90 sizeof(int) can be chosen at compile time. |
91 * So I've chosen long... | 89 * So I've chosen long... |
92 * <appro@fy.chalmers.se> | 90 * <appro@fy.chalmers.se> |
93 */ | 91 */ |
94 #else | 92 #else |
95 #define MD5_LONG unsigned int | 93 #define MD5_LONG unsigned int |
96 #endif | 94 #endif |
97 | 95 |
98 #define MD5_CBLOCK 64 | 96 #define MD5_CBLOCK 64 |
99 #define MD5_LBLOCK (MD5_CBLOCK/4) | 97 #define MD5_LBLOCK (MD5_CBLOCK/4) |
100 #define MD5_DIGEST_LENGTH 16 | 98 #define MD5_DIGEST_LENGTH 16 |
101 | 99 |
102 typedef struct MD5state_st | 100 typedef struct MD5state_st |
103 { | 101 { |
104 MD5_LONG A,B,C,D; | 102 MD5_LONG A,B,C,D; |
105 MD5_LONG Nl,Nh; | 103 MD5_LONG Nl,Nh; |
106 MD5_LONG data[MD5_LBLOCK]; | 104 MD5_LONG data[MD5_LBLOCK]; |
107 unsigned int num; | 105 unsigned int num; |
108 } MD5_CTX; | 106 } MD5_CTX; |
109 | 107 |
110 #ifdef OPENSSL_FIPS | |
111 int private_MD5_Init(MD5_CTX *c); | |
112 #endif | |
113 int MD5_Init(MD5_CTX *c); | 108 int MD5_Init(MD5_CTX *c); |
114 int MD5_Update(MD5_CTX *c, const void *data, size_t len); | 109 int MD5_Update(MD5_CTX *c, const void *data, size_t len); |
115 int MD5_Final(unsigned char *md, MD5_CTX *c); | 110 int MD5_Final(unsigned char *md, MD5_CTX *c); |
116 unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); | 111 unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); |
117 void MD5_Transform(MD5_CTX *c, const unsigned char *b); | 112 void MD5_Transform(MD5_CTX *c, const unsigned char *b); |
118 #ifdef __cplusplus | 113 #ifdef __cplusplus |
119 } | 114 } |
120 #endif | 115 #endif |
121 | 116 |
122 #endif | 117 #endif |
OLD | NEW |