]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
silence compiler warnings
authorMark Andrews <marka@isc.org>
Tue, 31 Jan 2006 23:01:23 +0000 (23:01 +0000)
committerMark Andrews <marka@isc.org>
Tue, 31 Jan 2006 23:01:23 +0000 (23:01 +0000)
lib/isc/include/isc/sha1.h
lib/isc/include/isc/sha2.h
lib/isc/sha2.c

index c7af8a187e13602e49c089d384c6b7c53bbd18b7..a292cb350605a730eb93449f90761a67eb1682a0 100644 (file)
@@ -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];
index 64dc57cdcc0cce6ae27f4d1b808ae63b82e63ce0..d84d7a060d2d1c3c513acfc2e2f5ff0348f34588 100644 (file)
@@ -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 $    */
 
 #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)
 
index d3fcf4f5795048ef2edfb6d1e2c23b2e623684a7..b0046836ca2ba198fdfeb2c1148956bf443df30c 100644 (file)
@@ -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);