X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=crc%2Fsha1.c;h=8d64c8ee7b836e9322c8c6b9dde01b718f1416d6;hp=620679783b40df5e5d1d574a01efff274801fd13;hb=04ba61dfa67784d4dfcc22a2b3de7ede28e22e40;hpb=23d2461974c334d77eb7a06a2dbd1f37aeee85d4 diff --git a/crc/sha1.c b/crc/sha1.c index 62067978..8d64c8ee 100644 --- a/crc/sha1.c +++ b/crc/sha1.c @@ -10,9 +10,9 @@ #include "sha1.h" /* Hash one 64-byte block of data */ -static void blk_SHA1Block(struct sha1_ctx *ctx, const unsigned int *data); +static void blk_SHA1Block(struct fio_sha1_ctx *ctx, const unsigned int *data); -void sha1_init(struct sha1_ctx *ctx) +void fio_sha1_init(struct fio_sha1_ctx *ctx) { ctx->size = 0; @@ -25,7 +25,8 @@ void sha1_init(struct sha1_ctx *ctx) ctx->H[4] = 0xc3d2e1f0; } -void sha1_update(struct sha1_ctx *ctx, const void *data, unsigned long len) +void fio_sha1_update(struct fio_sha1_ctx *ctx, const void *data, + unsigned long len) { int lenW = ctx->size & 63; @@ -54,7 +55,7 @@ void sha1_update(struct sha1_ctx *ctx, const void *data, unsigned long len) memcpy(ctx->W, data, len); } -void sha1_final(unsigned char hashout[20], struct sha1_ctx *ctx) +void fio_sha1_final(struct fio_sha1_ctx *ctx) { static const unsigned char pad[64] = { 0x80 }; unsigned int padlen[2]; @@ -66,13 +67,8 @@ void sha1_final(unsigned char hashout[20], struct sha1_ctx *ctx) padlen[1] = htonl(ctx->size << 3); i = ctx->size & 63; - sha1_update(ctx, pad, 1+ (63 & (55 - i))); - sha1_update(ctx, padlen, 8); - - /* Output hash - */ - for (i = 0; i < 5; i++) - ((unsigned int *)hashout)[i] = htonl(ctx->H[i]); + fio_sha1_update(ctx, pad, 1+ (63 & (55 - i))); + fio_sha1_update(ctx, padlen, 8); } #if defined(__i386__) || defined(__x86_64__) @@ -111,7 +107,7 @@ void sha1_final(unsigned char hashout[20], struct sha1_ctx *ctx) #define T_40_59(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, ((B&C)+(D&(B^C))) , 0x8f1bbcdc, A, B, C, D, E ) #define T_60_79(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0xca62c1d6, A, B, C, D, E ) -static void blk_SHA1Block(struct sha1_ctx *ctx, const unsigned int *data) +static void blk_SHA1Block(struct fio_sha1_ctx *ctx, const unsigned int *data) { unsigned int A,B,C,D,E; unsigned int array[16];