diff options
author | joerg <joerg@pkgsrc.org> | 2007-09-14 08:12:29 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2007-09-14 08:12:29 +0000 |
commit | 74c40a302dc45c117afbf46a77be6118ae6f9bfb (patch) | |
tree | 5d6286046fa8bca43ca1412e65047c2cee5023a0 /pkgtools | |
parent | f66e92153eec2a59d9b414411c5738e4f664e237 (diff) | |
download | pkgsrc-74c40a302dc45c117afbf46a77be6118ae6f9bfb.tar.gz |
Don't use u_char when uint8_t are meant. Don't mess with __attribute__,
conditionally use it in the only place it is used. This should fix
problems on QNX reported by Sean Boudreau.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/digest/files/config.h.in | 14 | ||||
-rw-r--r-- | pkgtools/digest/files/configure.ac | 16 | ||||
-rw-r--r-- | pkgtools/digest/files/digest.c | 6 | ||||
-rw-r--r-- | pkgtools/digest/files/rmd160.c | 10 | ||||
-rw-r--r-- | pkgtools/digest/files/rmd160.h | 10 | ||||
-rw-r--r-- | pkgtools/digest/files/rmd160hl.c | 10 | ||||
-rw-r--r-- | pkgtools/digest/files/sha1.c | 20 | ||||
-rw-r--r-- | pkgtools/digest/files/sha1.h | 12 | ||||
-rw-r--r-- | pkgtools/digest/files/sha1hl.c | 10 | ||||
-rw-r--r-- | pkgtools/digest/files/sha2.h | 2 | ||||
-rw-r--r-- | pkgtools/digest/files/sha2hl.c | 26 |
11 files changed, 70 insertions, 66 deletions
diff --git a/pkgtools/digest/files/config.h.in b/pkgtools/digest/files/config.h.in index 9a9e1178d75..40dec55f9da 100644 --- a/pkgtools/digest/files/config.h.in +++ b/pkgtools/digest/files/config.h.in @@ -130,19 +130,21 @@ #undef uint8_t - -#ifndef HAVE___ATTRIBUTE__ -# define __attribute__(x) -#endif - #ifdef HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -#ifndef __IDSTRING +#if defined(__GNUC__) && !defined(__IDSTRING) +#if (__GNUC__ == 2 && __GNUC_MINOR >= 7) || (__GNUC__ > 2) # define __IDSTRING(name,string) \ static const char name[] __attribute__((__unused__)) = string #endif +#endif + +#ifndef __IDSTRING +# define __IDSTRING(name,string) \ + static const char name[] = string +#endif #ifndef __RCSID # define __RCSID(_s) __IDSTRING(rcsid,_s) diff --git a/pkgtools/digest/files/configure.ac b/pkgtools/digest/files/configure.ac index e23a5320010..8499a8a9e1f 100644 --- a/pkgtools/digest/files/configure.ac +++ b/pkgtools/digest/files/configure.ac @@ -1,4 +1,4 @@ -dnl $Id: configure.ac,v 1.11 2007/08/03 21:42:04 tnn Exp $ +dnl $Id: configure.ac,v 1.12 2007/09/14 08:12:29 joerg Exp $ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT([nbsd-digest],[20070803],[agc@netbsd.org]) @@ -40,19 +40,21 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([bcopy bzero memset memcpy setlocale]) # AH_BOTTOM([ - -#ifndef HAVE___ATTRIBUTE__ -# define __attribute__(x) -#endif - #ifdef HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -#ifndef __IDSTRING +#if defined(__GNUC__) && !defined(__IDSTRING) +#if (__GNUC__ == 2 && __GNUC_MINOR >= 7) || (__GNUC__ > 2) # define __IDSTRING(name,string) \ static const char name[] __attribute__((__unused__)) = string #endif +#endif + +#ifndef __IDSTRING +# define __IDSTRING(name,string) \ + static const char name[] = string +#endif #ifndef __RCSID # define __RCSID(_s) __IDSTRING(rcsid,_s) diff --git a/pkgtools/digest/files/digest.c b/pkgtools/digest/files/digest.c index 1a5fb4c198a..0c20cdc39b9 100644 --- a/pkgtools/digest/files/digest.c +++ b/pkgtools/digest/files/digest.c @@ -1,4 +1,4 @@ -/* $NetBSD: digest.c,v 1.13 2007/08/03 17:10:07 tnn Exp $ */ +/* $NetBSD: digest.c,v 1.14 2007/09/14 08:12:29 joerg Exp $ */ /* * Copyright (c) 2001-2005 Alistair G. Crooks. All rights reserved. @@ -37,7 +37,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 2001-2005 \ The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: digest.c,v 1.13 2007/08/03 17:10:07 tnn Exp $"); +__RCSID("$NetBSD: digest.c,v 1.14 2007/09/14 08:12:29 joerg Exp $"); #endif @@ -138,7 +138,7 @@ digest_file(char *fn, alg_t *alg) if (fn == NULL) { (*alg->hash_init)(&alg->hash_ctx); while ((cc = read(STDIN_FILENO, in, sizeof(in))) > 0) { - (*alg->hash_update)(&alg->hash_ctx, (u_char *)in, + (*alg->hash_update)(&alg->hash_ctx, (uint8_t *)in, (unsigned) cc); } (void) printf("%s\n", (*alg->hash_end)(&alg->hash_ctx, digest)); diff --git a/pkgtools/digest/files/rmd160.c b/pkgtools/digest/files/rmd160.c index b021b2d4b8f..c2e93276811 100644 --- a/pkgtools/digest/files/rmd160.c +++ b/pkgtools/digest/files/rmd160.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmd160.c,v 1.5 2007/07/27 17:08:27 joerg Exp $ */ +/* $NetBSD: rmd160.c,v 1.6 2007/09/14 08:12:29 joerg Exp $ */ /********************************************************************\ * @@ -23,7 +23,7 @@ #endif #ifndef lint -__RCSID("$NetBSD: rmd160.c,v 1.5 2007/07/27 17:08:27 joerg Exp $"); +__RCSID("$NetBSD: rmd160.c,v 1.6 2007/09/14 08:12:29 joerg Exp $"); #endif /* not lint */ /* header files */ @@ -360,7 +360,7 @@ RMD160Transform(uint32_t state[5], const uint32_t block[16]) /********************************************************************/ void -RMD160Update(RMD160_CTX *context, const u_char *data, uint32_t nbytes) +RMD160Update(RMD160_CTX *context, const uint8_t *data, uint32_t nbytes) { uint32_t X[16]; uint32_t ofs = 0; @@ -420,7 +420,7 @@ RMD160Update(RMD160_CTX *context, const u_char *data, uint32_t nbytes) /********************************************************************/ void -RMD160Final(u_char digest[20], RMD160_CTX *context) +RMD160Final(uint8_t digest[20], RMD160_CTX *context) { uint32_t i; uint32_t X[16]; @@ -432,7 +432,7 @@ RMD160Final(u_char digest[20], RMD160_CTX *context) _DIAGASSERT(context != NULL); /* append the bit m_n == 1 */ - context->bbuffer[context->buflen] = (u_char)'\200'; + context->bbuffer[context->buflen] = (uint8_t)'\200'; ZEROIZE(context->bbuffer + context->buflen + 1, 63 - context->buflen); diff --git a/pkgtools/digest/files/rmd160.h b/pkgtools/digest/files/rmd160.h index 4bb3e7a987f..bd61218acfa 100644 --- a/pkgtools/digest/files/rmd160.h +++ b/pkgtools/digest/files/rmd160.h @@ -1,4 +1,4 @@ -/* $NetBSD: rmd160.h,v 1.5 2007/08/02 13:54:34 joerg Exp $ */ +/* $NetBSD: rmd160.h,v 1.6 2007/09/14 08:12:29 joerg Exp $ */ /********************************************************************\ * @@ -35,19 +35,19 @@ typedef struct { uint32_t state[5]; /* state (ABCDE) */ uint32_t length[2]; /* number of bits */ - u_char bbuffer[64]; /* overflow buffer */ + uint8_t bbuffer[64]; /* overflow buffer */ uint32_t buflen; /* number of chars in bbuffer */ } RMD160_CTX; __BEGIN_DECLS void RMD160Init(RMD160_CTX *); void RMD160Transform(uint32_t[5], const uint32_t[16]); -void RMD160Update(RMD160_CTX *, const u_char *, uint32_t); -void RMD160Final(u_char[20], RMD160_CTX *); +void RMD160Update(RMD160_CTX *, const uint8_t *, uint32_t); +void RMD160Final(uint8_t[20], RMD160_CTX *); #ifndef _KERNEL char *RMD160End(RMD160_CTX *, char *); char *RMD160File(char *, char *); -char *RMD160Data(const u_char *, size_t, char *); +char *RMD160Data(const uint8_t *, size_t, char *); #endif /* _KERNEL */ __END_DECLS diff --git a/pkgtools/digest/files/rmd160hl.c b/pkgtools/digest/files/rmd160hl.c index 66961db6f20..80af9e6ea20 100644 --- a/pkgtools/digest/files/rmd160hl.c +++ b/pkgtools/digest/files/rmd160hl.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmd160hl.c,v 1.4 2007/07/03 18:54:04 joerg Exp $ */ +/* $NetBSD: rmd160hl.c,v 1.5 2007/09/14 08:12:29 joerg Exp $ */ /* rmd160hl.c * ---------------------------------------------------------------------------- @@ -16,7 +16,7 @@ #endif #ifndef lint -__RCSID("$NetBSD: rmd160hl.c,v 1.4 2007/07/03 18:54:04 joerg Exp $"); +__RCSID("$NetBSD: rmd160hl.c,v 1.5 2007/09/14 08:12:29 joerg Exp $"); #endif /* not lint */ @@ -53,7 +53,7 @@ RMD160End(RMD160_CTX *ctx, char *buf) { int i; char *p = buf; - u_char digest[20]; + uint8_t digest[20]; static const char hex[]="0123456789abcdef"; _DIAGASSERT(ctx != NULL); @@ -74,7 +74,7 @@ RMD160End(RMD160_CTX *ctx, char *buf) char * RMD160File(char *filename, char *buf) { - u_char buffer[BUFSIZ]; + uint8_t buffer[BUFSIZ]; RMD160_CTX ctx; int fd, num, oerrno; @@ -96,7 +96,7 @@ RMD160File(char *filename, char *buf) } char * -RMD160Data(const u_char *data, size_t len, char *buf) +RMD160Data(const uint8_t *data, size_t len, char *buf) { RMD160_CTX ctx; diff --git a/pkgtools/digest/files/sha1.c b/pkgtools/digest/files/sha1.c index 102f91e191b..8027f1b0cfd 100644 --- a/pkgtools/digest/files/sha1.c +++ b/pkgtools/digest/files/sha1.c @@ -1,4 +1,4 @@ -/* $NetBSD: sha1.c,v 1.7 2007/07/27 17:08:27 joerg Exp $ */ +/* $NetBSD: sha1.c,v 1.8 2007/09/14 08:12:29 joerg Exp $ */ /* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */ /* @@ -78,7 +78,7 @@ __weak_alias(SHA1Final,_SHA1Final) #endif typedef union { - u_char c[64]; + uint8_t c[64]; u_int l[16]; } CHAR64LONG16; @@ -138,7 +138,7 @@ do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LON /* * Hash a single 512-bit block. This is the core of the algorithm. */ -void SHA1Transform(uint32_t state[5], const u_char buffer[64]) +void SHA1Transform(uint32_t state[5], const uint8_t buffer[64]) { uint32_t a, b, c, d, e; CHAR64LONG16 *block; @@ -229,7 +229,7 @@ void SHA1Init(context) */ void SHA1Update(context, data, len) SHA1_CTX *context; - const u_char *data; + const uint8_t *data; u_int len; { u_int i, j; @@ -258,27 +258,27 @@ void SHA1Update(context, data, len) * Add padding and return the message digest. */ void SHA1Final(digest, context) - u_char digest[20]; + uint8_t digest[20]; SHA1_CTX* context; { u_int i; - u_char finalcount[8]; + uint8_t finalcount[8]; _DIAGASSERT(digest != 0); _DIAGASSERT(context != 0); for (i = 0; i < 8; i++) { - finalcount[i] = (u_char)((context->count[(i >= 4 ? 0 : 1)] + finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ } - SHA1Update(context, (const u_char *)"\200", 1); + SHA1Update(context, (const uint8_t *)"\200", 1); while ((context->count[0] & 504) != 448) - SHA1Update(context, (const u_char *)"\0", 1); + SHA1Update(context, (const uint8_t *)"\0", 1); SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ if (digest) { for (i = 0; i < 20; i++) - digest[i] = (u_char) + digest[i] = (uint8_t) ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } } diff --git a/pkgtools/digest/files/sha1.h b/pkgtools/digest/files/sha1.h index 0921e1ad3a5..0f1d4293e19 100644 --- a/pkgtools/digest/files/sha1.h +++ b/pkgtools/digest/files/sha1.h @@ -1,4 +1,4 @@ -/* $NetBSD: sha1.h,v 1.5 2007/08/02 13:54:34 joerg Exp $ */ +/* $NetBSD: sha1.h,v 1.6 2007/09/14 08:12:29 joerg Exp $ */ /* * SHA-1 in C @@ -20,17 +20,17 @@ typedef struct { uint32_t state[5]; uint32_t count[2]; - u_char buffer[64]; + uint8_t buffer[64]; } SHA1_CTX; -void SHA1Transform __P((uint32_t state[5], const u_char buffer[64])); +void SHA1Transform __P((uint32_t state[5], const uint8_t buffer[64])); void SHA1Init __P((SHA1_CTX *context)); -void SHA1Update __P((SHA1_CTX *context, const u_char *data, u_int len)); -void SHA1Final __P((u_char digest[20], SHA1_CTX *context)); +void SHA1Update __P((SHA1_CTX *context, const uint8_t *data, u_int len)); +void SHA1Final __P((uint8_t digest[20], SHA1_CTX *context)); #ifndef _KERNEL char *SHA1End __P((SHA1_CTX *, char *)); char *SHA1File __P((char *, char *)); -char *SHA1Data __P((const u_char *, size_t, char *)); +char *SHA1Data __P((const uint8_t *, size_t, char *)); #endif /* _KERNEL */ #endif /* _SYS_SHA1_H_ */ diff --git a/pkgtools/digest/files/sha1hl.c b/pkgtools/digest/files/sha1hl.c index f753da8a6c4..1664b9129a0 100644 --- a/pkgtools/digest/files/sha1hl.c +++ b/pkgtools/digest/files/sha1hl.c @@ -1,4 +1,4 @@ -/* $NetBSD: sha1hl.c,v 1.5 2007/07/03 18:54:05 joerg Exp $ */ +/* $NetBSD: sha1hl.c,v 1.6 2007/09/14 08:12:29 joerg Exp $ */ /* sha1hl.c * ---------------------------------------------------------------------------- @@ -33,7 +33,7 @@ #endif #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: sha1hl.c,v 1.5 2007/07/03 18:54:05 joerg Exp $"); +__RCSID("$NetBSD: sha1hl.c,v 1.6 2007/09/14 08:12:29 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #ifndef _DIAGASSERT @@ -54,7 +54,7 @@ SHA1End(ctx, buf) { int i; char *p = buf; - u_char digest[20]; + uint8_t digest[20]; static const char hex[]="0123456789abcdef"; _DIAGASSERT(ctx != NULL); @@ -77,7 +77,7 @@ SHA1File (filename, buf) char *filename; char *buf; { - u_char buffer[BUFSIZ]; + uint8_t buffer[BUFSIZ]; SHA1_CTX ctx; int fd, num, oerrno; @@ -100,7 +100,7 @@ SHA1File (filename, buf) char * SHA1Data (data, len, buf) - const u_char *data; + const uint8_t *data; size_t len; char *buf; { diff --git a/pkgtools/digest/files/sha2.h b/pkgtools/digest/files/sha2.h index 1c41e6039bc..43da8cb0ae2 100644 --- a/pkgtools/digest/files/sha2.h +++ b/pkgtools/digest/files/sha2.h @@ -85,7 +85,7 @@ typedef SHA512_CTX SHA384_CTX; void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); -char* SHA256_End(SHA256_CTX*, u_char[SHA256_DIGEST_STRING_LENGTH]); +char* SHA256_End(SHA256_CTX*, uint8_t[SHA256_DIGEST_STRING_LENGTH]); char* SHA256_Data(const uint8_t*, size_t, uint8_t *); char *SHA256_File(char *, char *); diff --git a/pkgtools/digest/files/sha2hl.c b/pkgtools/digest/files/sha2hl.c index c0cedacf710..f796f137120 100644 --- a/pkgtools/digest/files/sha2hl.c +++ b/pkgtools/digest/files/sha2hl.c @@ -1,4 +1,4 @@ -/* $NetBSD: sha2hl.c,v 1.5 2007/07/03 18:54:05 joerg Exp $ */ +/* $NetBSD: sha2hl.c,v 1.6 2007/09/14 08:12:30 joerg Exp $ */ /* * sha2hl.c @@ -45,7 +45,7 @@ #endif #ifndef lint -__RCSID("$NetBSD: sha2hl.c,v 1.5 2007/07/03 18:54:05 joerg Exp $"); +__RCSID("$NetBSD: sha2hl.c,v 1.6 2007/09/14 08:12:30 joerg Exp $"); #endif /* not lint */ @@ -81,7 +81,7 @@ static const char sha2_hex_digits[] = "0123456789abcdef"; char * SHA256_File(char *filename, char *buf) { - u_char buffer[BUFSIZ * 20]; + uint8_t buffer[BUFSIZ * 20]; SHA256_CTX ctx; int fd, num, oerrno; @@ -104,10 +104,10 @@ SHA256_File(char *filename, char *buf) char * -SHA256_End(SHA256_CTX *ctx, u_char *buffer) +SHA256_End(SHA256_CTX *ctx, uint8_t *buffer) { - u_char digest[SHA256_DIGEST_LENGTH], *d = digest; - u_char *ret; + uint8_t digest[SHA256_DIGEST_LENGTH], *d = digest; + uint8_t *ret; int i; /* Sanity check: */ @@ -130,7 +130,7 @@ SHA256_End(SHA256_CTX *ctx, u_char *buffer) } char * -SHA256_Data(const sha2_byte * data, size_t len, u_char *digest) +SHA256_Data(const sha2_byte * data, size_t len, uint8_t *digest) { SHA256_CTX ctx; @@ -143,7 +143,7 @@ char * SHA384_File(char *filename, char *buf) { SHA384_CTX ctx; - u_char buffer[BUFSIZ * 20]; + uint8_t buffer[BUFSIZ * 20]; int fd, num, oerrno; _DIAGASSERT(filename != NULL); @@ -166,8 +166,8 @@ SHA384_File(char *filename, char *buf) char * SHA384_End(SHA384_CTX * ctx, char buffer[]) { - u_char digest[SHA384_DIGEST_LENGTH], *d = digest; - u_char *ret; + uint8_t digest[SHA384_DIGEST_LENGTH], *d = digest; + uint8_t *ret; int i; /* Sanity check: */ @@ -203,7 +203,7 @@ char * SHA512_File(char *filename, char *buf) { SHA512_CTX ctx; - u_char buffer[BUFSIZ * 20]; + uint8_t buffer[BUFSIZ * 20]; int fd, num, oerrno; _DIAGASSERT(filename != NULL); @@ -226,8 +226,8 @@ SHA512_File(char *filename, char *buf) char * SHA512_End(SHA512_CTX * ctx, char buffer[]) { - u_char digest[SHA512_DIGEST_LENGTH], *d = digest; - u_char *ret; + uint8_t digest[SHA512_DIGEST_LENGTH], *d = digest; + uint8_t *ret; int i; /* Sanity check: */ |