Run through indent

This commit is contained in:
Glenn L McGrath 2003-06-07 14:54:24 +00:00
parent 233b170a85
commit 7aa62cf173

View File

@ -77,8 +77,7 @@
typedef u_int32_t md5_uint32;
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
struct md5_ctx {
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
@ -233,6 +232,7 @@ static const int BLOCKSIZE = 4096;
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
@ -282,7 +282,8 @@ static void *md5_buffer(const char *buffer, size_t len, void *resblock)
return md5_finish_ctx(&ctx, resblock);
}
static void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
static void md5_process_bytes(const void *buffer, size_t len,
struct md5_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
@ -330,12 +331,14 @@ static void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ct
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0. */
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
static void md5_process_block(const void *buffer, size_t len,
struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
size_t nwords = len / sizeof(md5_uint32);
const md5_uint32 *endp = words + nwords;
#if MD5SUM_SIZE_VS_SPEED > 0
static const md5_uint32 C_array[] = {
/* round 1 */
@ -415,10 +418,13 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
words += 16;
#if MD5SUM_SIZE_VS_SPEED > 2
pc = C_array; pp = P_array; ps = S_array - 4;
pc = C_array;
pp = P_array;
ps = S_array - 4;
for (i = 0; i < 64; i++) {
if ((i&0x0f) == 0) ps += 4;
if ((i & 0x0f) == 0)
ps += 4;
temp = A;
switch (i >> 4) {
case 0:
@ -436,16 +442,24 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
temp += cwp[(int) (*pp++)] + *pc++;
CYCLIC(temp, ps[i & 3]);
temp += B;
A = D; D = C; C = B; B = temp;
A = D;
D = C;
C = B;
B = temp;
}
#else
pc = C_array; pp = P_array; ps = S_array;
pc = C_array;
pp = P_array;
ps = S_array;
for (i = 0; i < 16; i++) {
temp = A + FF(B, C, D) + cwp[(int) (*pp++)] + *pc++;
CYCLIC(temp, ps[i & 3]);
temp += B;
A = D; D = C; C = B; B = temp;
A = D;
D = C;
C = B;
B = temp;
}
ps += 4;
@ -453,21 +467,30 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
temp = A + FG(B, C, D) + cwp[(int) (*pp++)] + *pc++;
CYCLIC(temp, ps[i & 3]);
temp += B;
A = D; D = C; C = B; B = temp;
A = D;
D = C;
C = B;
B = temp;
}
ps += 4;
for (i = 0; i < 16; i++) {
temp = A + FH(B, C, D) + cwp[(int) (*pp++)] + *pc++;
CYCLIC(temp, ps[i & 3]);
temp += B;
A = D; D = C; C = B; B = temp;
A = D;
D = C;
C = B;
B = temp;
}
ps += 4;
for (i = 0; i < 16; i++) {
temp = A + FI(B, C, D) + cwp[(int) (*pp++)] + *pc++;
CYCLIC(temp, ps[i & 3]);
temp += B;
A = D; D = C; C = B; B = temp;
A = D;
D = C;
C = B;
B = temp;
}
#endif
@ -666,10 +689,7 @@ static int status_only = 0; /* With -c, don't generate any output.
static int warn = 0; /* With -w, print a message to standard error warning
about each improperly formatted MD5 checksum line */
static int split_3(char *s,
size_t s_len,
unsigned char **u,
char **w)
static int split_3(char *s, size_t s_len, unsigned char **u, char **w)
{
size_t i = 0;
int escaped_filename = 0;
@ -761,8 +781,7 @@ static inline int hex_digits(unsigned char const *s)
/* An interface to md5_stream. Operate on FILENAME (it may be "-") and
put the result in *MD5_RESULT. Return non-zero upon failure, zero
to indicate success. */
static int md5_file(const char *filename,
unsigned char *md5_result)
static int md5_file(const char *filename, unsigned char *md5_result)
{
FILE *fp;
@ -836,7 +855,8 @@ static int md5_check(const char *checkfile_name)
if (split_3(line, line_length, &md5num, &filename)
|| !hex_digits(md5num)) {
if (warn) {
bb_error_msg("%s: %lu: improperly formatted MD5 checksum line",
bb_error_msg
("%s: %lu: improperly formatted MD5 checksum line",
checkfile_name, (unsigned long) line_number);
}
} else {
@ -857,6 +877,7 @@ static int md5_check(const char *checkfile_name)
}
} else {
size_t cnt;
/* Compare generated binary number with text representation
in check file. Ignore case of hex digits. */
for (cnt = 0; cnt < 16; ++cnt) {
@ -901,13 +922,15 @@ static int md5_check(const char *checkfile_name)
- n_open_or_read_failures);
if (n_open_or_read_failures > 0) {
bb_error_msg("WARNING: %d of %d listed files could not be read",
bb_error_msg
("WARNING: %d of %d listed files could not be read",
n_open_or_read_failures, n_properly_formated_lines);
return FALSE;
}
if (n_mismatched_checksums > 0) {
bb_error_msg("WARNING: %d of %d computed checksums did NOT match",
bb_error_msg
("WARNING: %d of %d computed checksums did NOT match",
n_mismatched_checksums, n_computed_checkums);
return FALSE;
}
@ -918,8 +941,7 @@ static int md5_check(const char *checkfile_name)
&& n_open_or_read_failures == 0) ? 0 : 1);
}
int md5sum_main(int argc,
char **argv)
int md5sum_main(int argc, char **argv)
{
unsigned char md5buffer[16];
int do_check = 0;
@ -970,7 +992,8 @@ int md5sum_main(int argc,
}
if (file_type_specified && do_check) {
bb_error_msg_and_die("the -b and -t options are meaningless when verifying checksums");
bb_error_msg_and_die
("the -b and -t options are meaningless when verifying checksums");
}
if (n_strings > 0 && do_check) {
@ -978,11 +1001,13 @@ int md5sum_main(int argc,
}
if (status_only && !do_check) {
bb_error_msg_and_die("the -s option is meaningful only when verifying checksums");
bb_error_msg_and_die
("the -s option is meaningful only when verifying checksums");
}
if (warn && !do_check) {
bb_error_msg_and_die("the -w option is meaningful only when verifying checksums");
bb_error_msg_and_die
("the -w option is meaningful only when verifying checksums");
}
if (n_strings > 0) {
@ -993,6 +1018,7 @@ int md5sum_main(int argc,
}
for (i = 0; i < n_strings; ++i) {
size_t cnt;
md5_buffer(string[i], strlen(string[i]), md5buffer);
for (cnt = 0; cnt < 16; ++cnt)
@ -1018,11 +1044,13 @@ int md5sum_main(int argc,
err |= fail;
if (!fail && file[0] == '-' && file[1] == '\0') {
size_t i;
for (i = 0; i < 16; ++i)
printf("%02x", md5buffer[i]);
putchar('\n');
} else if (!fail) {
size_t i;
/* Output a leading backslash if the file name contains
a newline or backslash. */
if (strchr(file, '\n') || strchr(file, '\\'))