diff options
Diffstat (limited to 'libbb/hash_md5_sha.c')
-rw-r--r-- | libbb/hash_md5_sha.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c index b87d1dde8..a313c2a65 100644 --- a/libbb/hash_md5_sha.c +++ b/libbb/hash_md5_sha.c | |||
@@ -104,12 +104,12 @@ static void FAST_FUNC common64_end(md5_ctx_t *ctx, int swap_needed) | |||
104 | */ | 104 | */ |
105 | 105 | ||
106 | /* 0: fastest, 3: smallest */ | 106 | /* 0: fastest, 3: smallest */ |
107 | #if CONFIG_MD5_SIZE_VS_SPEED < 0 | 107 | #if CONFIG_MD5_SMALL < 0 |
108 | # define MD5_SIZE_VS_SPEED 0 | 108 | # define MD5_SMALL 0 |
109 | #elif CONFIG_MD5_SIZE_VS_SPEED > 3 | 109 | #elif CONFIG_MD5_SMALL > 3 |
110 | # define MD5_SIZE_VS_SPEED 3 | 110 | # define MD5_SMALL 3 |
111 | #else | 111 | #else |
112 | # define MD5_SIZE_VS_SPEED CONFIG_MD5_SIZE_VS_SPEED | 112 | # define MD5_SMALL CONFIG_MD5_SMALL |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | /* These are the four functions used in the four steps of the MD5 algorithm | 115 | /* These are the four functions used in the four steps of the MD5 algorithm |
@@ -129,7 +129,7 @@ static void FAST_FUNC common64_end(md5_ctx_t *ctx, int swap_needed) | |||
129 | /* Hash a single block, 64 bytes long and 4-byte aligned */ | 129 | /* Hash a single block, 64 bytes long and 4-byte aligned */ |
130 | static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | 130 | static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) |
131 | { | 131 | { |
132 | #if MD5_SIZE_VS_SPEED > 0 | 132 | #if MD5_SMALL > 0 |
133 | /* Before we start, one word to the strange constants. | 133 | /* Before we start, one word to the strange constants. |
134 | They are defined in RFC 1321 as | 134 | They are defined in RFC 1321 as |
135 | T[i] = (int)(4294967296.0 * fabs(sin(i))), i=1..64 | 135 | T[i] = (int)(4294967296.0 * fabs(sin(i))), i=1..64 |
@@ -157,7 +157,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
157 | 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 | 157 | 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 |
158 | }; | 158 | }; |
159 | static const char P_array[] ALIGN1 = { | 159 | static const char P_array[] ALIGN1 = { |
160 | # if MD5_SIZE_VS_SPEED > 1 | 160 | # if MD5_SMALL > 1 |
161 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 1 */ | 161 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 1 */ |
162 | # endif | 162 | # endif |
163 | 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, /* 2 */ | 163 | 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, /* 2 */ |
@@ -171,7 +171,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
171 | uint32_t C = ctx->hash[2]; | 171 | uint32_t C = ctx->hash[2]; |
172 | uint32_t D = ctx->hash[3]; | 172 | uint32_t D = ctx->hash[3]; |
173 | 173 | ||
174 | #if MD5_SIZE_VS_SPEED >= 2 /* 2 or 3 */ | 174 | #if MD5_SMALL >= 2 /* 2 or 3 */ |
175 | 175 | ||
176 | static const char S_array[] ALIGN1 = { | 176 | static const char S_array[] ALIGN1 = { |
177 | 7, 12, 17, 22, | 177 | 7, 12, 17, 22, |
@@ -190,7 +190,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
190 | words[i] = SWAP_LE32(words[i]); | 190 | words[i] = SWAP_LE32(words[i]); |
191 | # endif | 191 | # endif |
192 | 192 | ||
193 | # if MD5_SIZE_VS_SPEED == 3 | 193 | # if MD5_SMALL == 3 |
194 | pc = C_array; | 194 | pc = C_array; |
195 | pp = P_array; | 195 | pp = P_array; |
196 | ps = S_array - 4; | 196 | ps = S_array - 4; |
@@ -220,7 +220,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
220 | C = B; | 220 | C = B; |
221 | B = temp; | 221 | B = temp; |
222 | } | 222 | } |
223 | # else /* MD5_SIZE_VS_SPEED == 2 */ | 223 | # else /* MD5_SMALL == 2 */ |
224 | pc = C_array; | 224 | pc = C_array; |
225 | pp = P_array; | 225 | pp = P_array; |
226 | ps = S_array; | 226 | ps = S_array; |
@@ -271,13 +271,13 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
271 | ctx->hash[2] += C; | 271 | ctx->hash[2] += C; |
272 | ctx->hash[3] += D; | 272 | ctx->hash[3] += D; |
273 | 273 | ||
274 | #else /* MD5_SIZE_VS_SPEED == 0 or 1 */ | 274 | #else /* MD5_SMALL == 0 or 1 */ |
275 | 275 | ||
276 | uint32_t A_save = A; | 276 | uint32_t A_save = A; |
277 | uint32_t B_save = B; | 277 | uint32_t B_save = B; |
278 | uint32_t C_save = C; | 278 | uint32_t C_save = C; |
279 | uint32_t D_save = D; | 279 | uint32_t D_save = D; |
280 | # if MD5_SIZE_VS_SPEED == 1 | 280 | # if MD5_SMALL == 1 |
281 | const uint32_t *pc; | 281 | const uint32_t *pc; |
282 | const char *pp; | 282 | const char *pp; |
283 | int i; | 283 | int i; |
@@ -299,7 +299,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
299 | } while (0) | 299 | } while (0) |
300 | 300 | ||
301 | /* Round 1 */ | 301 | /* Round 1 */ |
302 | # if MD5_SIZE_VS_SPEED == 1 | 302 | # if MD5_SMALL == 1 |
303 | pc = C_array; | 303 | pc = C_array; |
304 | for (i = 0; i < 4; i++) { | 304 | for (i = 0; i < 4; i++) { |
305 | OP(A, B, C, D, 7, *pc++); | 305 | OP(A, B, C, D, 7, *pc++); |
@@ -339,7 +339,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
339 | } while (0) | 339 | } while (0) |
340 | 340 | ||
341 | /* Round 2 */ | 341 | /* Round 2 */ |
342 | # if MD5_SIZE_VS_SPEED == 1 | 342 | # if MD5_SMALL == 1 |
343 | pp = P_array; | 343 | pp = P_array; |
344 | for (i = 0; i < 4; i++) { | 344 | for (i = 0; i < 4; i++) { |
345 | OP(FG, A, B, C, D, (int) (*pp++), 5, *pc++); | 345 | OP(FG, A, B, C, D, (int) (*pp++), 5, *pc++); |
@@ -367,7 +367,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
367 | # endif | 367 | # endif |
368 | 368 | ||
369 | /* Round 3 */ | 369 | /* Round 3 */ |
370 | # if MD5_SIZE_VS_SPEED == 1 | 370 | # if MD5_SMALL == 1 |
371 | for (i = 0; i < 4; i++) { | 371 | for (i = 0; i < 4; i++) { |
372 | OP(FH, A, B, C, D, (int) (*pp++), 4, *pc++); | 372 | OP(FH, A, B, C, D, (int) (*pp++), 4, *pc++); |
373 | OP(FH, D, A, B, C, (int) (*pp++), 11, *pc++); | 373 | OP(FH, D, A, B, C, (int) (*pp++), 11, *pc++); |
@@ -394,7 +394,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) | |||
394 | # endif | 394 | # endif |
395 | 395 | ||
396 | /* Round 4 */ | 396 | /* Round 4 */ |
397 | # if MD5_SIZE_VS_SPEED == 1 | 397 | # if MD5_SMALL == 1 |
398 | for (i = 0; i < 4; i++) { | 398 | for (i = 0; i < 4; i++) { |
399 | OP(FI, A, B, C, D, (int) (*pp++), 6, *pc++); | 399 | OP(FI, A, B, C, D, (int) (*pp++), 6, *pc++); |
400 | OP(FI, D, A, B, C, (int) (*pp++), 10, *pc++); | 400 | OP(FI, D, A, B, C, (int) (*pp++), 10, *pc++); |