OLD | NEW |
1 /* crypto/md4/md4_dgst.c */ | 1 /* crypto/md4/md4_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 "md4_locl.h" | 60 #include "md4_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 MD4_version[]="MD4" OPENSSL_VERSION_PTEXT; | 63 const char MD4_version[]="MD4" OPENSSL_VERSION_PTEXT; |
69 | 64 |
70 /* Implemented from RFC1186 The MD4 Message-Digest Algorithm | 65 /* Implemented from RFC1186 The MD4 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(MD4) | 73 int MD4_Init(MD4_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 md4_block_data_order | 83 #ifndef md4_block_data_order |
91 #ifdef X | 84 #ifdef X |
92 #undef X | 85 #undef X |
93 #endif | 86 #endif |
94 void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num) | 87 void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num) |
95 { | 88 { |
96 const unsigned char *data=data_; | 89 const unsigned char *data=data_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 R2(C,D,A,B,X( 7),11,0x6ED9EBA1L); | 158 R2(C,D,A,B,X( 7),11,0x6ED9EBA1L); |
166 R2(B,C,D,A,X(15),15,0x6ED9EBA1L); | 159 R2(B,C,D,A,X(15),15,0x6ED9EBA1L); |
167 | 160 |
168 A = c->A += A; | 161 A = c->A += A; |
169 B = c->B += B; | 162 B = c->B += B; |
170 C = c->C += C; | 163 C = c->C += C; |
171 D = c->D += D; | 164 D = c->D += D; |
172 } | 165 } |
173 } | 166 } |
174 #endif | 167 #endif |
OLD | NEW |