summaryrefslogtreecommitdiff
path: root/random
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2015-12-29 23:12:58 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-12-29 23:19:44 +0100
commitf5490b490c549efa89eefb6deefdc7341aa6a913 (patch)
tree8d037f950d37621e4f6a144cf71a8bc612f9a51e /random
parent87673d93fd87c3fda97e91842c3d7d326a30ef8c (diff)
fix compiler warnings in hurd/random
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.
Diffstat (limited to 'random')
-rw-r--r--random/gnupg-random.c14
-rw-r--r--random/gnupg-rmd.h2
-rw-r--r--random/gnupg-rmd160.c21
3 files changed, 18 insertions, 19 deletions
diff --git a/random/gnupg-random.c b/random/gnupg-random.c
index 54ee3c55..3cf78121 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 2446fc7d..102624ad 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 66107685..8f4207b3 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)