bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix compiler warnings in hurd/random


From: Flavio Cruz
Subject: [PATCH] fix compiler warnings in hurd/random
Date: Tue, 29 Dec 2015 23:12:58 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

---

random: Fix compiler warnings.

* random/gnupg-random.c: Use byte instead of char.
* random/gnupg-rmd.h (rmd160_mixblock): Use byte instead of char.
* random/gnupg-rmd.c (rmd160_mixblock): Likewise.
* random/gnupg-rmd.c: Place #ifdef __HURD__ earlier to avoid warnings.

diff --git a/random/gnupg-random.c b/random/gnupg-random.c
index 54ee3c5..3cf7812 100644
--- a/random/gnupg-random.c
+++ b/random/gnupg-random.c
@@ -98,8 +98,8 @@
 
 static int is_initialized;
 #define MASK_LEVEL(a) do {if( a > 2 ) a = 2; else if( a < 0 ) a = 0; } while(0)
-static char *rndpool;  /* allocated size is POOLSIZE+BLOCKLEN */
-static char *keypool;  /* allocated size is POOLSIZE+BLOCKLEN */
+static byte *rndpool;  /* allocated size is POOLSIZE+BLOCKLEN */
+static byte *keypool;  /* allocated size is POOLSIZE+BLOCKLEN */
 static size_t pool_readpos;
 static size_t pool_writepos;
 static int pool_filled;
@@ -209,7 +209,7 @@ quick_random_gen( int onoff )
 void
 randomize_buffer( byte *buffer, size_t length, int level )
 {
-    char *p = get_random_bits( length*8, level, 1 );
+    byte *p = get_random_bits( length*8, level, 1 );
     memcpy( buffer, p, length );
     m_free(p);
 }
@@ -267,8 +267,8 @@ get_random_bits( size_t nbits, int level, int secure )
 static void
 mix_pool(byte *pool)
 {
-    char *hashbuf = pool + POOLSIZE;
-    char *p, *pend;
+    byte *hashbuf = pool + POOLSIZE;
+    byte *p, *pend;
     int i, n;
     RMD160_CONTEXT md;
 
@@ -291,7 +291,7 @@ mix_pool(byte *pool)
        if( p+DIGESTLEN+BLOCKLEN < pend )
            memcpy(hashbuf+DIGESTLEN, p+DIGESTLEN, BLOCKLEN-DIGESTLEN);
        else {
-           char *pp = p+DIGESTLEN;
+           byte *pp = p+DIGESTLEN;
            for(i=DIGESTLEN; i < BLOCKLEN; i++ ) {
                if( pp >= pend )
                    pp = pool;
@@ -323,7 +323,7 @@ read_seed_file()
 {
     int fd;
     struct stat sb;
-    unsigned char buffer[POOLSIZE];
+    byte buffer[POOLSIZE];
     int n;
 
     if( !seed_file_name )
diff --git a/random/gnupg-rmd.h b/random/gnupg-rmd.h
index 2446fc7..102624a 100644
--- a/random/gnupg-rmd.h
+++ b/random/gnupg-rmd.h
@@ -33,6 +33,6 @@ typedef struct {
 } RMD160_CONTEXT;
 
 void rmd160_init( RMD160_CONTEXT *hd );
-void rmd160_mixblock( RMD160_CONTEXT *hd, char *buffer );
+void rmd160_mixblock( RMD160_CONTEXT *hd, byte *buffer );
 
 #endif /*G10_RMD_H*/
diff --git a/random/gnupg-rmd160.c b/random/gnupg-rmd160.c
index 6610768..8f4207b 100644
--- a/random/gnupg-rmd160.c
+++ b/random/gnupg-rmd160.c
@@ -458,9 +458,9 @@ rmd160_write( RMD160_CONTEXT *hd, byte *inbuf, size_t inlen)
  * Returns: 16 bytes in buffer with the mixed contentes of buffer.
  */
 void
-rmd160_mixblock( RMD160_CONTEXT *hd, char *buffer )
+rmd160_mixblock( RMD160_CONTEXT *hd, byte *buffer )
 {
-    char *p = buffer;
+    byte *p = buffer;
     transform( hd, buffer );
   #define X(a) do { *(u32*)p = hd->h##a ; p += 4; } while(0)
     X(0);
@@ -536,12 +536,6 @@ rmd160_final( RMD160_CONTEXT *hd )
   #undef X
 }
 
-static byte *
-rmd160_read( RMD160_CONTEXT *hd )
-{
-    return hd->buf;
-}
-
 
 
 /****************
@@ -560,6 +554,14 @@ rmd160_hash_buffer( char *outbuf, const char *buffer, 
size_t length )
 }
 
 
+#ifndef __HURD__
+
+static byte *
+rmd160_read( RMD160_CONTEXT *hd )
+{
+    return hd->buf;
+}
+
 /****************
  * Return some information about the algorithm.  We need algo here to
  * distinguish different flavors of the algorithm.
@@ -643,9 +645,6 @@ gnupgext_enum_func( int what, int *sequence, int *class, 
int *vers )
     return ret;
 }
 
-
-
-#ifndef __HURD__
 #ifndef IS_MODULE
 void
 rmd160_constructor(void)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]