diff options
Diffstat (limited to 'lib/sha1.c')
-rw-r--r-- | lib/sha1.c | 23 |
1 files changed, 6 insertions, 17 deletions
@@ -1,6 +1,6 @@ /* Functions to compute SHA1 message digest of files or memory blocks. according to the definition of SHA1 in FIPS 180-1 from April 1997. - Copyright (C) 2008-2011 Red Hat, Inc. + Copyright (C) 2008-2011, 2015 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2008. @@ -48,8 +48,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. */ void -sha1_init_ctx (ctx) - struct sha1_ctx *ctx; +sha1_init_ctx (struct sha1_ctx *ctx) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; @@ -67,9 +66,7 @@ sha1_init_ctx (ctx) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -sha1_read_ctx (ctx, resbuf) - const struct sha1_ctx *ctx; - void *resbuf; +sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) { ((sha1_uint32 *) resbuf)[0] = SWAP (ctx->A); ((sha1_uint32 *) resbuf)[1] = SWAP (ctx->B); @@ -93,9 +90,7 @@ be64_copy (char *dest, uint64_t x) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -sha1_finish_ctx (ctx, resbuf) - struct sha1_ctx *ctx; - void *resbuf; +sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ sha1_uint32 bytes = ctx->buflen; @@ -123,10 +118,7 @@ sha1_finish_ctx (ctx, resbuf) void -sha1_process_bytes (buffer, len, ctx) - const void *buffer; - size_t len; - struct sha1_ctx *ctx; +sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ @@ -220,10 +212,7 @@ sha1_process_bytes (buffer, len, ctx) It is assumed that LEN % 64 == 0. */ void -sha1_process_block (buffer, len, ctx) - const void *buffer; - size_t len; - struct sha1_ctx *ctx; +sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) { sha1_uint32 computed_words[16]; #define W(i) computed_words[(i) % 16] |