diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-16 20:45:27 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-16 20:45:27 +0200 |
commit | c0683acce88efc1fe15d9a4332428b5a9fdc6c2e (patch) | |
tree | cb0f5bb99b5e5f4490be175238d3a877115bc468 /libbb/md5.c | |
parent | 1a5e11c874a1f53c5205140a9d675b7e6404bbc9 (diff) | |
download | busybox-w32-c0683acce88efc1fe15d9a4332428b5a9fdc6c2e.tar.gz busybox-w32-c0683acce88efc1fe15d9a4332428b5a9fdc6c2e.tar.bz2 busybox-w32-c0683acce88efc1fe15d9a4332428b5a9fdc6c2e.zip |
*: pass md5/shaN context pointer as 1st arg, not last
function old new delta
md5_hash_block 458 459 +1
filter_rename_config 252 250 -2
md5_crypt 591 587 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/md5.c')
-rw-r--r-- | libbb/md5.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/md5.c b/libbb/md5.c index 1f9d59e6e..47f5fc6f8 100644 --- a/libbb/md5.c +++ b/libbb/md5.c | |||
@@ -49,7 +49,7 @@ void FAST_FUNC md5_begin(md5_ctx_t *ctx) | |||
49 | #define rotl32(w, s) (((w) << (s)) | ((w) >> (32 - (s)))) | 49 | #define rotl32(w, s) (((w) << (s)) | ((w) >> (32 - (s)))) |
50 | 50 | ||
51 | /* Hash a single block, 64 bytes long and 4-byte aligned. */ | 51 | /* Hash a single block, 64 bytes long and 4-byte aligned. */ |
52 | static void md5_hash_block(const void *buffer, md5_ctx_t *ctx) | 52 | static void md5_hash_block(md5_ctx_t *ctx, const void *buffer) |
53 | { | 53 | { |
54 | uint32_t correct_words[16]; | 54 | uint32_t correct_words[16]; |
55 | const uint32_t *words = buffer; | 55 | const uint32_t *words = buffer; |
@@ -361,7 +361,7 @@ static void md5_hash_block(const void *buffer, md5_ctx_t *ctx) | |||
361 | * with chunks of data that are 4-byte aligned and a multiple of 64 bytes. | 361 | * with chunks of data that are 4-byte aligned and a multiple of 64 bytes. |
362 | * This function's internal buffer remembers previous data until it has 64 | 362 | * This function's internal buffer remembers previous data until it has 64 |
363 | * bytes worth to pass on. Call md5_end() to flush this buffer. */ | 363 | * bytes worth to pass on. Call md5_end() to flush this buffer. */ |
364 | void FAST_FUNC md5_hash(const void *buffer, size_t len, md5_ctx_t *ctx) | 364 | void FAST_FUNC md5_hash(md5_ctx_t *ctx, const void *buffer, size_t len) |
365 | { | 365 | { |
366 | const char *buf = buffer; | 366 | const char *buf = buffer; |
367 | unsigned buflen = BUFLEN(ctx); | 367 | unsigned buflen = BUFLEN(ctx); |
@@ -385,7 +385,7 @@ void FAST_FUNC md5_hash(const void *buffer, size_t len, md5_ctx_t *ctx) | |||
385 | if (buflen != 0) | 385 | if (buflen != 0) |
386 | break; | 386 | break; |
387 | /* Buffer is filled up, process it. */ | 387 | /* Buffer is filled up, process it. */ |
388 | md5_hash_block(ctx->buffer, ctx); | 388 | md5_hash_block(ctx, ctx->buffer); |
389 | /*buflen = 0; - already is */ | 389 | /*buflen = 0; - already is */ |
390 | } | 390 | } |
391 | } | 391 | } |
@@ -395,7 +395,7 @@ void FAST_FUNC md5_hash(const void *buffer, size_t len, md5_ctx_t *ctx) | |||
395 | * endian byte order, so that a byte-wise output yields to the wanted | 395 | * endian byte order, so that a byte-wise output yields to the wanted |
396 | * ASCII representation of the message digest. | 396 | * ASCII representation of the message digest. |
397 | */ | 397 | */ |
398 | void FAST_FUNC md5_end(void *resbuf, md5_ctx_t *ctx) | 398 | void FAST_FUNC md5_end(md5_ctx_t *ctx, void *resbuf) |
399 | { | 399 | { |
400 | uint64_t total; | 400 | uint64_t total; |
401 | char *buf = ctx->buffer; | 401 | char *buf = ctx->buffer; |
@@ -419,8 +419,8 @@ void FAST_FUNC md5_end(void *resbuf, md5_ctx_t *ctx) | |||
419 | 419 | ||
420 | /* Process last bytes. */ | 420 | /* Process last bytes. */ |
421 | if (buf != ctx->buffer) | 421 | if (buf != ctx->buffer) |
422 | md5_hash_block(ctx->buffer, ctx); | 422 | md5_hash_block(ctx, ctx->buffer); |
423 | md5_hash_block(buf, ctx); | 423 | md5_hash_block(ctx, buf); |
424 | 424 | ||
425 | /* The MD5 result is in little endian byte order. | 425 | /* The MD5 result is in little endian byte order. |
426 | * We (ab)use the fact that A-D are consecutive in memory. | 426 | * We (ab)use the fact that A-D are consecutive in memory. |