From dc08fbe8abfbaa16390cdfd360be9d74f0a28576 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 2 Jan 2018 10:19:52 -0800 Subject: SHA1 should just use void * for message pointers in API. --- src/supplemental/sha1/sha1.c | 10 ++++++---- src/supplemental/sha1/sha1.h | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/supplemental/sha1/sha1.c b/src/supplemental/sha1/sha1.c index 39a98e07..228b497d 100644 --- a/src/supplemental/sha1/sha1.c +++ b/src/supplemental/sha1/sha1.c @@ -1,6 +1,6 @@ // -// Copyright 2017 Staysail Systems, Inc. -// Copyright 2017 Capitar IT Group BV +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -86,7 +86,7 @@ nni_sha1_final(nni_sha1_ctx *ctx, uint8_t digest[20]) // nni_sha1 is a convenience that does the entire init, update, and final // sequence in a single operation. void -nni_sha1(const uint8_t *msg, size_t length, uint8_t digest[20]) +nni_sha1(const void *msg, size_t length, uint8_t digest[20]) { nni_sha1_ctx ctx; @@ -97,8 +97,10 @@ nni_sha1(const uint8_t *msg, size_t length, uint8_t digest[20]) // nni_sha1_update updates the SHA1 context, reading from the message supplied. void -nni_sha1_update(nni_sha1_ctx *ctx, const uint8_t *msg, size_t length) +nni_sha1_update(nni_sha1_ctx *ctx, const void *data, size_t length) { + const uint8_t *msg = data; + if (!length) { return; } diff --git a/src/supplemental/sha1/sha1.h b/src/supplemental/sha1/sha1.h index 3fe19d17..adaa9a85 100644 --- a/src/supplemental/sha1/sha1.h +++ b/src/supplemental/sha1/sha1.h @@ -1,6 +1,6 @@ // -// Copyright 2017 Staysail Systems, Inc. -// Copyright 2017 Capitar IT Group BV +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -19,8 +19,8 @@ typedef struct { } nni_sha1_ctx; extern void nni_sha1_init(nni_sha1_ctx *); -extern void nni_sha1_update(nni_sha1_ctx *, const uint8_t *, size_t); +extern void nni_sha1_update(nni_sha1_ctx *, const void *, size_t); extern void nni_sha1_final(nni_sha1_ctx *, uint8_t[20]); -extern void nni_sha1(const uint8_t *, size_t, uint8_t[20]); +extern void nni_sha1(const void *, size_t, uint8_t[20]); #endif // NNG_SUPPLEMENTAL_SHA1_SHA1_H -- cgit v1.2.3-70-g09d2