aboutsummaryrefslogtreecommitdiff
path: root/coreutils/md5_sha1_sum.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/md5_sha1_sum.c')
-rw-r--r--coreutils/md5_sha1_sum.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 646f8bd10..e79210c0d 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -8,6 +8,8 @@
8 8
9#include "libbb.h" 9#include "libbb.h"
10 10
11/* This is a NOEXEC applet. Be very careful! */
12
11typedef enum { 13typedef enum {
12 /* 4th letter of applet_name is... */ 14 /* 4th letter of applet_name is... */
13 HASH_MD5 = 's', /* "md5>s<um" */ 15 HASH_MD5 = 's', /* "md5>s<um" */
@@ -41,7 +43,7 @@ static uint8_t *hash_file(const char *filename /*, hash_algo_t hash_algo*/)
41 } context; 43 } context;
42 uint8_t *hash_value = NULL; 44 uint8_t *hash_value = NULL;
43 RESERVE_CONFIG_UBUFFER(in_buf, 4096); 45 RESERVE_CONFIG_UBUFFER(in_buf, 4096);
44 void FAST_FUNC (*update)(const void*, size_t, void*); 46 void FAST_FUNC (*update)(void*, const void*, size_t);
45 void FAST_FUNC (*final)(void*, void*); 47 void FAST_FUNC (*final)(void*, void*);
46 hash_algo_t hash_algo = applet_name[3]; 48 hash_algo_t hash_algo = applet_name[3];
47 49
@@ -76,11 +78,11 @@ static uint8_t *hash_file(const char *filename /*, hash_algo_t hash_algo*/)
76 } 78 }
77 79
78 while (0 < (count = safe_read(src_fd, in_buf, 4096))) { 80 while (0 < (count = safe_read(src_fd, in_buf, 4096))) {
79 update(in_buf, count, &context); 81 update(&context, in_buf, count);
80 } 82 }
81 83
82 if (count == 0) { 84 if (count == 0) {
83 final(in_buf, &context); 85 final(&context, in_buf);
84 hash_value = hash_bin_to_hex(in_buf, hash_len); 86 hash_value = hash_bin_to_hex(in_buf, hash_len);
85 } 87 }
86 88