Commit bc4f5d11 authored by Mark Andrews's avatar Mark Andrews
Browse files

silence compiler warnings

parent aa520ab1
......@@ -18,7 +18,7 @@
#ifndef ISC_SHA1_H
#define ISC_SHA1_H 1
/* $Id: sha1.h,v 1.11 2005/04/29 00:23:44 marka Exp $ */
/* $Id: sha1.h,v 1.12 2006/01/31 23:01:23 marka Exp $ */
/* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */
......@@ -31,7 +31,7 @@
#include <isc/lang.h>
#include <isc/types.h>
#define ISC_SHA1_DIGESTLENGTH 20
#define ISC_SHA1_DIGESTLENGTH 20U
typedef struct {
isc_uint32_t state[5];
......
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sha2.h,v 1.4 2006/01/31 00:35:21 marka Exp $ */
/* $Id: sha2.h,v 1.5 2006/01/31 23:01:23 marka Exp $ */
/* $FreeBSD: src/sys/crypto/sha2/sha2.h,v 1.1.2.1 2001/07/03 11:01:36 ume Exp $ */
/* $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $ */
......@@ -64,13 +64,13 @@
#define ISC_SHA224_DIGESTLENGTH 28U
#define ISC_SHA224_DIGESTSTRINGLENGTH (ISC_SHA224_DIGESTLENGTH * 2 + 1)
#define ISC_SHA256_BLOCK_LENGTH 64
#define ISC_SHA256_BLOCK_LENGTH 64U
#define ISC_SHA256_DIGESTLENGTH 32U
#define ISC_SHA256_DIGESTSTRINGLENGTH (ISC_SHA256_DIGESTLENGTH * 2 + 1)
#define ISC_SHA384_BLOCK_LENGTH 128
#define ISC_SHA384_DIGESTLENGTH 48U
#define ISC_SHA384_DIGESTSTRINGLENGTH (ISC_SHA384_DIGESTLENGTH * 2 + 1)
#define ISC_SHA512_BLOCK_LENGTH 128
#define ISC_SHA512_BLOCK_LENGTH 128U
#define ISC_SHA512_DIGESTLENGTH 64U
#define ISC_SHA512_DIGESTSTRINGLENGTH (ISC_SHA512_DIGESTLENGTH * 2 + 1)
......
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sha2.c,v 1.6 2006/01/31 01:58:12 marka Exp $ */
/* $Id: sha2.c,v 1.7 2006/01/31 23:01:23 marka Exp $ */
/* $FreeBSD: src/sys/crypto/sha2/sha2.c,v 1.2.2.2 2002/03/05 08:36:47 ume Exp $ */
/* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $ */
......@@ -573,7 +573,7 @@ void
isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
unsigned int freespace, usedspace;
if (len == 0) {
if (len == 0U) {
/* Calling with no data is valid - we do nothing */
return;
}
......@@ -609,7 +609,7 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
len -= ISC_SHA256_BLOCK_LENGTH;
data += ISC_SHA256_BLOCK_LENGTH;
}
if (len > 0) {
if (len > 0U) {
/* There's left-overs, so save 'em */
memcpy(context->buffer, data, len);
context->bitcount += len << 3;
......@@ -639,16 +639,20 @@ isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) {
if (usedspace <= ISC_SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, ISC_SHA256_SHORT_BLOCK_LENGTH - usedspace);
memset(&context->buffer[usedspace], 0,
ISC_SHA256_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < ISC_SHA256_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0, ISC_SHA256_BLOCK_LENGTH - usedspace);
memset(&context->buffer[usedspace], 0,
ISC_SHA256_BLOCK_LENGTH -
usedspace);
}
/* Do second-to-last transform: */
isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, ISC_SHA256_SHORT_BLOCK_LENGTH);
memset(context->buffer, 0,
ISC_SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
......@@ -903,7 +907,7 @@ isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) {
void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t len) {
unsigned int freespace, usedspace;
if (len == 0) {
if (len == 0U) {
/* Calling with no data is valid - we do nothing */
return;
}
......@@ -939,7 +943,7 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le
len -= ISC_SHA512_BLOCK_LENGTH;
data += ISC_SHA512_BLOCK_LENGTH;
}
if (len > 0) {
if (len > 0U) {
/* There's left-overs, so save 'em */
memcpy(context->buffer, data, len);
ADDINC128(context->bitcount, len << 3);
......@@ -963,10 +967,12 @@ void isc_sha512_last(isc_sha512_t *context) {
if (usedspace <= ISC_SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, ISC_SHA512_SHORT_BLOCK_LENGTH - usedspace);
memset(&context->buffer[usedspace], 0,
ISC_SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < ISC_SHA512_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0, ISC_SHA512_BLOCK_LENGTH - usedspace);
memset(&context->buffer[usedspace], 0,
ISC_SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment