diff options
Diffstat (limited to 'src/lib/libcrypto/md4/md4_dgst.c')
| -rw-r--r-- | src/lib/libcrypto/md4/md4_dgst.c | 95 |
1 files changed, 3 insertions, 92 deletions
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c index ee7cc72262..cfef94af39 100644 --- a/src/lib/libcrypto/md4/md4_dgst.c +++ b/src/lib/libcrypto/md4/md4_dgst.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | #include "md4_locl.h" | 60 | #include "md4_locl.h" |
| 61 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
| 62 | 62 | ||
| 63 | const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT; | 63 | const char MD4_version[]="MD4" OPENSSL_VERSION_PTEXT; |
| 64 | 64 | ||
| 65 | /* Implemented from RFC1186 The MD4 Message-Digest Algorithm | 65 | /* Implemented from RFC1186 The MD4 Message-Digest Algorithm |
| 66 | */ | 66 | */ |
| @@ -70,7 +70,7 @@ const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT; | |||
| 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
| 71 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
| 72 | 72 | ||
| 73 | FIPS_NON_FIPS_MD_Init(MD4) | 73 | int MD4_Init(MD4_CTX *c) |
| 74 | { | 74 | { |
| 75 | c->A=INIT_DATA_A; | 75 | c->A=INIT_DATA_A; |
| 76 | c->B=INIT_DATA_B; | 76 | c->B=INIT_DATA_B; |
| @@ -82,84 +82,11 @@ FIPS_NON_FIPS_MD_Init(MD4) | |||
| 82 | return 1; | 82 | return 1; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | #ifndef md4_block_host_order | ||
| 86 | void md4_block_host_order (MD4_CTX *c, const void *data, int num) | ||
| 87 | { | ||
| 88 | const MD4_LONG *X=data; | ||
| 89 | register unsigned MD32_REG_T A,B,C,D; | ||
| 90 | |||
| 91 | A=c->A; | ||
| 92 | B=c->B; | ||
| 93 | C=c->C; | ||
| 94 | D=c->D; | ||
| 95 | |||
| 96 | for (;num--;X+=HASH_LBLOCK) | ||
| 97 | { | ||
| 98 | /* Round 0 */ | ||
| 99 | R0(A,B,C,D,X[ 0], 3,0); | ||
| 100 | R0(D,A,B,C,X[ 1], 7,0); | ||
| 101 | R0(C,D,A,B,X[ 2],11,0); | ||
| 102 | R0(B,C,D,A,X[ 3],19,0); | ||
| 103 | R0(A,B,C,D,X[ 4], 3,0); | ||
| 104 | R0(D,A,B,C,X[ 5], 7,0); | ||
| 105 | R0(C,D,A,B,X[ 6],11,0); | ||
| 106 | R0(B,C,D,A,X[ 7],19,0); | ||
| 107 | R0(A,B,C,D,X[ 8], 3,0); | ||
| 108 | R0(D,A,B,C,X[ 9], 7,0); | ||
| 109 | R0(C,D,A,B,X[10],11,0); | ||
| 110 | R0(B,C,D,A,X[11],19,0); | ||
| 111 | R0(A,B,C,D,X[12], 3,0); | ||
| 112 | R0(D,A,B,C,X[13], 7,0); | ||
| 113 | R0(C,D,A,B,X[14],11,0); | ||
| 114 | R0(B,C,D,A,X[15],19,0); | ||
| 115 | /* Round 1 */ | ||
| 116 | R1(A,B,C,D,X[ 0], 3,0x5A827999L); | ||
| 117 | R1(D,A,B,C,X[ 4], 5,0x5A827999L); | ||
| 118 | R1(C,D,A,B,X[ 8], 9,0x5A827999L); | ||
| 119 | R1(B,C,D,A,X[12],13,0x5A827999L); | ||
| 120 | R1(A,B,C,D,X[ 1], 3,0x5A827999L); | ||
| 121 | R1(D,A,B,C,X[ 5], 5,0x5A827999L); | ||
| 122 | R1(C,D,A,B,X[ 9], 9,0x5A827999L); | ||
| 123 | R1(B,C,D,A,X[13],13,0x5A827999L); | ||
| 124 | R1(A,B,C,D,X[ 2], 3,0x5A827999L); | ||
| 125 | R1(D,A,B,C,X[ 6], 5,0x5A827999L); | ||
| 126 | R1(C,D,A,B,X[10], 9,0x5A827999L); | ||
| 127 | R1(B,C,D,A,X[14],13,0x5A827999L); | ||
| 128 | R1(A,B,C,D,X[ 3], 3,0x5A827999L); | ||
| 129 | R1(D,A,B,C,X[ 7], 5,0x5A827999L); | ||
| 130 | R1(C,D,A,B,X[11], 9,0x5A827999L); | ||
| 131 | R1(B,C,D,A,X[15],13,0x5A827999L); | ||
| 132 | /* Round 2 */ | ||
| 133 | R2(A,B,C,D,X[ 0], 3,0x6ED9EBA1); | ||
| 134 | R2(D,A,B,C,X[ 8], 9,0x6ED9EBA1); | ||
| 135 | R2(C,D,A,B,X[ 4],11,0x6ED9EBA1); | ||
| 136 | R2(B,C,D,A,X[12],15,0x6ED9EBA1); | ||
| 137 | R2(A,B,C,D,X[ 2], 3,0x6ED9EBA1); | ||
| 138 | R2(D,A,B,C,X[10], 9,0x6ED9EBA1); | ||
| 139 | R2(C,D,A,B,X[ 6],11,0x6ED9EBA1); | ||
| 140 | R2(B,C,D,A,X[14],15,0x6ED9EBA1); | ||
| 141 | R2(A,B,C,D,X[ 1], 3,0x6ED9EBA1); | ||
| 142 | R2(D,A,B,C,X[ 9], 9,0x6ED9EBA1); | ||
| 143 | R2(C,D,A,B,X[ 5],11,0x6ED9EBA1); | ||
| 144 | R2(B,C,D,A,X[13],15,0x6ED9EBA1); | ||
| 145 | R2(A,B,C,D,X[ 3], 3,0x6ED9EBA1); | ||
| 146 | R2(D,A,B,C,X[11], 9,0x6ED9EBA1); | ||
| 147 | R2(C,D,A,B,X[ 7],11,0x6ED9EBA1); | ||
| 148 | R2(B,C,D,A,X[15],15,0x6ED9EBA1); | ||
| 149 | |||
| 150 | A = c->A += A; | ||
| 151 | B = c->B += B; | ||
| 152 | C = c->C += C; | ||
| 153 | D = c->D += D; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | #endif | ||
| 157 | |||
| 158 | #ifndef md4_block_data_order | 85 | #ifndef md4_block_data_order |
| 159 | #ifdef X | 86 | #ifdef X |
| 160 | #undef X | 87 | #undef X |
| 161 | #endif | 88 | #endif |
| 162 | void md4_block_data_order (MD4_CTX *c, const void *data_, int num) | 89 | void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num) |
| 163 | { | 90 | { |
| 164 | const unsigned char *data=data_; | 91 | const unsigned char *data=data_; |
| 165 | register unsigned MD32_REG_T A,B,C,D,l; | 92 | register unsigned MD32_REG_T A,B,C,D,l; |
| @@ -240,19 +167,3 @@ void md4_block_data_order (MD4_CTX *c, const void *data_, int num) | |||
| 240 | } | 167 | } |
| 241 | } | 168 | } |
| 242 | #endif | 169 | #endif |
| 243 | |||
| 244 | #ifdef undef | ||
| 245 | int printit(unsigned long *l) | ||
| 246 | { | ||
| 247 | int i,ii; | ||
| 248 | |||
| 249 | for (i=0; i<2; i++) | ||
| 250 | { | ||
| 251 | for (ii=0; ii<8; ii++) | ||
| 252 | { | ||
| 253 | fprintf(stderr,"%08lx ",l[i*8+ii]); | ||
| 254 | } | ||
| 255 | fprintf(stderr,"\n"); | ||
| 256 | } | ||
| 257 | } | ||
| 258 | #endif | ||
