OLD | NEW |
1 /* crypto/md5/md5_dgst.c */ | 1 /* crypto/md5/md5_dgst.c */ |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * | 52 * |
53 * The licence and distribution terms for any publically available version or | 53 * The licence and distribution terms for any publically available version or |
54 * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 * copied and put under another distribution licence | 55 * copied and put under another distribution licence |
56 * [including the GNU Public Licence.] | 56 * [including the GNU Public Licence.] |
57 */ | 57 */ |
58 | 58 |
59 #include <stdio.h> | 59 #include <stdio.h> |
60 #include "md5_locl.h" | 60 #include "md5_locl.h" |
61 #include <openssl/opensslv.h> | 61 #include <openssl/opensslv.h> |
62 #include <openssl/err.h> | |
63 #ifdef OPENSSL_FIPS | |
64 #include <openssl/fips.h> | |
65 #endif | |
66 | |
67 | 62 |
68 const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT; | 63 const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT; |
69 | 64 |
70 /* Implemented from RFC1321 The MD5 Message-Digest Algorithm | 65 /* Implemented from RFC1321 The MD5 Message-Digest Algorithm |
71 */ | 66 */ |
72 | 67 |
73 #define INIT_DATA_A (unsigned long)0x67452301L | 68 #define INIT_DATA_A (unsigned long)0x67452301L |
74 #define INIT_DATA_B (unsigned long)0xefcdab89L | 69 #define INIT_DATA_B (unsigned long)0xefcdab89L |
75 #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 #define INIT_DATA_C (unsigned long)0x98badcfeL |
76 #define INIT_DATA_D (unsigned long)0x10325476L | 71 #define INIT_DATA_D (unsigned long)0x10325476L |
77 | 72 |
78 FIPS_NON_FIPS_MD_Init(MD5) | 73 int MD5_Init(MD5_CTX *c) |
79 { | 74 { |
| 75 memset (c,0,sizeof(*c)); |
80 c->A=INIT_DATA_A; | 76 c->A=INIT_DATA_A; |
81 c->B=INIT_DATA_B; | 77 c->B=INIT_DATA_B; |
82 c->C=INIT_DATA_C; | 78 c->C=INIT_DATA_C; |
83 c->D=INIT_DATA_D; | 79 c->D=INIT_DATA_D; |
84 c->Nl=0; | |
85 c->Nh=0; | |
86 c->num=0; | |
87 return 1; | 80 return 1; |
88 } | 81 } |
89 | 82 |
90 #ifndef md5_block_data_order | 83 #ifndef md5_block_data_order |
91 #ifdef X | 84 #ifdef X |
92 #undef X | 85 #undef X |
93 #endif | 86 #endif |
94 void md5_block_data_order (MD5_CTX *c, const void *data_, size_t num) | 87 void md5_block_data_order (MD5_CTX *c, const void *data_, size_t num) |
95 { | 88 { |
96 const unsigned char *data=data_; | 89 const unsigned char *data=data_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 R3(C,D,A,B,X( 2),15,0x2ad7d2bbL); | 175 R3(C,D,A,B,X( 2),15,0x2ad7d2bbL); |
183 R3(B,C,D,A,X( 9),21,0xeb86d391L); | 176 R3(B,C,D,A,X( 9),21,0xeb86d391L); |
184 | 177 |
185 A = c->A += A; | 178 A = c->A += A; |
186 B = c->B += B; | 179 B = c->B += B; |
187 C = c->C += C; | 180 C = c->C += C; |
188 D = c->D += D; | 181 D = c->D += D; |
189 } | 182 } |
190 } | 183 } |
191 #endif | 184 #endif |
OLD | NEW |