diff options
Diffstat (limited to 'libbb/hash_md5prime.c')
-rw-r--r-- | libbb/hash_md5prime.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libbb/hash_md5prime.c b/libbb/hash_md5prime.c index 7986f4d29..e089a15f5 100644 --- a/libbb/hash_md5prime.c +++ b/libbb/hash_md5prime.c | |||
@@ -59,7 +59,7 @@ | |||
59 | * Completely removed static PADDING array. | 59 | * Completely removed static PADDING array. |
60 | * | 60 | * |
61 | * Reintroduced the loop unrolling in md5_transform and added the | 61 | * Reintroduced the loop unrolling in md5_transform and added the |
62 | * MD5_SIZE_VS_SPEED option for configurability. Define below as: | 62 | * MD5_SMALL option for configurability. Define below as: |
63 | * 0 fully unrolled loops | 63 | * 0 fully unrolled loops |
64 | * 1 partially unrolled (4 ops per loop) | 64 | * 1 partially unrolled (4 ops per loop) |
65 | * 2 no unrolling -- introduces the need to swap 4 variables (slow) | 65 | * 2 no unrolling -- introduces the need to swap 4 variables (slow) |
@@ -75,12 +75,12 @@ | |||
75 | #include "libbb.h" | 75 | #include "libbb.h" |
76 | 76 | ||
77 | /* 1: fastest, 3: smallest */ | 77 | /* 1: fastest, 3: smallest */ |
78 | #if CONFIG_MD5_SIZE_VS_SPEED < 1 | 78 | #if CONFIG_MD5_SMALL < 1 |
79 | # define MD5_SIZE_VS_SPEED 1 | 79 | # define MD5_SMALL 1 |
80 | #elif CONFIG_MD5_SIZE_VS_SPEED > 3 | 80 | #elif CONFIG_MD5_SMALL > 3 |
81 | # define MD5_SIZE_VS_SPEED 3 | 81 | # define MD5_SMALL 3 |
82 | #else | 82 | #else |
83 | # define MD5_SIZE_VS_SPEED CONFIG_MD5_SIZE_VS_SPEED | 83 | # define MD5_SMALL CONFIG_MD5_SMALL |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | #if BB_LITTLE_ENDIAN | 86 | #if BB_LITTLE_ENDIAN |
@@ -152,7 +152,7 @@ memcpy32_le2cpu(uint32_t *output, const unsigned char *input, unsigned len) | |||
152 | static void md5_transform(uint32_t state[4], const unsigned char block[64]) | 152 | static void md5_transform(uint32_t state[4], const unsigned char block[64]) |
153 | { | 153 | { |
154 | uint32_t a, b, c, d, x[16]; | 154 | uint32_t a, b, c, d, x[16]; |
155 | #if MD5_SIZE_VS_SPEED > 1 | 155 | #if MD5_SMALL > 1 |
156 | uint32_t temp; | 156 | uint32_t temp; |
157 | const unsigned char *ps; | 157 | const unsigned char *ps; |
158 | 158 | ||
@@ -162,9 +162,9 @@ static void md5_transform(uint32_t state[4], const unsigned char block[64]) | |||
162 | 4, 11, 16, 23, | 162 | 4, 11, 16, 23, |
163 | 6, 10, 15, 21 | 163 | 6, 10, 15, 21 |
164 | }; | 164 | }; |
165 | #endif /* MD5_SIZE_VS_SPEED > 1 */ | 165 | #endif /* MD5_SMALL > 1 */ |
166 | 166 | ||
167 | #if MD5_SIZE_VS_SPEED > 0 | 167 | #if MD5_SMALL > 0 |
168 | const uint32_t *pc; | 168 | const uint32_t *pc; |
169 | const unsigned char *pp; | 169 | const unsigned char *pp; |
170 | int i; | 170 | int i; |
@@ -198,7 +198,7 @@ static void md5_transform(uint32_t state[4], const unsigned char block[64]) | |||
198 | 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 /* 4 */ | 198 | 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 /* 4 */ |
199 | }; | 199 | }; |
200 | 200 | ||
201 | #endif /* MD5_SIZE_VS_SPEED > 0 */ | 201 | #endif /* MD5_SMALL > 0 */ |
202 | 202 | ||
203 | memcpy32_le2cpu(x, block, 64); | 203 | memcpy32_le2cpu(x, block, 64); |
204 | 204 | ||
@@ -207,7 +207,7 @@ static void md5_transform(uint32_t state[4], const unsigned char block[64]) | |||
207 | c = state[2]; | 207 | c = state[2]; |
208 | d = state[3]; | 208 | d = state[3]; |
209 | 209 | ||
210 | #if MD5_SIZE_VS_SPEED > 2 | 210 | #if MD5_SMALL > 2 |
211 | pc = C; | 211 | pc = C; |
212 | pp = P; | 212 | pp = P; |
213 | ps = S - 4; | 213 | ps = S - 4; |
@@ -233,7 +233,7 @@ static void md5_transform(uint32_t state[4], const unsigned char block[64]) | |||
233 | temp += b; | 233 | temp += b; |
234 | a = d; d = c; c = b; b = temp; | 234 | a = d; d = c; c = b; b = temp; |
235 | } | 235 | } |
236 | #elif MD5_SIZE_VS_SPEED > 1 | 236 | #elif MD5_SMALL > 1 |
237 | pc = C; | 237 | pc = C; |
238 | pp = P; | 238 | pp = P; |
239 | ps = S; | 239 | ps = S; |
@@ -260,7 +260,7 @@ static void md5_transform(uint32_t state[4], const unsigned char block[64]) | |||
260 | II(a, b, c, d, x[*pp], ps[i & 0x3], *pc); pp++; pc++; | 260 | II(a, b, c, d, x[*pp], ps[i & 0x3], *pc); pp++; pc++; |
261 | temp = d; d = c; c = b; b = a; a = temp; | 261 | temp = d; d = c; c = b; b = a; a = temp; |
262 | } | 262 | } |
263 | #elif MD5_SIZE_VS_SPEED > 0 | 263 | #elif MD5_SMALL > 0 |
264 | pc = C; | 264 | pc = C; |
265 | pp = P; | 265 | pp = P; |
266 | /* Round 1 */ | 266 | /* Round 1 */ |