pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/digest/files Fully ANSIfy and use size_t and ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/ef9eac9372e6
branches: trunk
changeset: 533592:ef9eac9372e6
user: joerg <joerg%pkgsrc.org@localhost>
date: Fri Sep 21 18:44:36 2007 +0000
description:
Fully ANSIfy and use size_t and uint32_t in places where u_int was used
before. This fixes the build on QNX, where u_int is not exposed by the
current set of headers. Make the prototypes of the crypto functions
consistent.
diffstat:
pkgtools/digest/files/config.h.in | 8 --------
pkgtools/digest/files/configure.ac | 10 +---------
pkgtools/digest/files/digest.c | 6 +++---
pkgtools/digest/files/md5.h | 14 +++++++-------
pkgtools/digest/files/md5c.c | 23 +++++++++--------------
pkgtools/digest/files/md5hl.c | 18 +++++++-----------
pkgtools/digest/files/rmd160.c | 6 +++---
pkgtools/digest/files/rmd160.h | 4 ++--
pkgtools/digest/files/sha1.c | 30 +++++++++++++++---------------
pkgtools/digest/files/sha1.h | 16 ++++++++--------
pkgtools/digest/files/sha1hl.c | 26 +++++++-------------------
pkgtools/digest/files/sha2.c | 10 +++++++---
pkgtools/digest/files/sha2.h | 28 ----------------------------
pkgtools/digest/files/sha2hl.c | 33 ++++++++++++++++++---------------
pkgtools/digest/files/tiger.c | 4 ++--
pkgtools/digest/files/tiger.h | 4 ++--
16 files changed, 91 insertions(+), 149 deletions(-)
diffs (truncated from 673 to 300 lines):
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/config.h.in
--- a/pkgtools/digest/files/config.h.in Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/config.h.in Fri Sep 21 18:44:36 2007 +0000
@@ -154,14 +154,6 @@
# define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
#endif
-#ifndef __P
-# if defined(__STDC__) || defined(__cplusplus)
-# define __P(protos) protos /* full-blown ANSI C */
-# else
-# define __P(protos) () /* traditional C preprocessor */
-# endif
-#endif
-
#ifndef __CONCAT
# if defined(__STDC__) || defined(__cplusplus)
# define __CONCAT(x,y) x ## y
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/configure.ac
--- a/pkgtools/digest/files/configure.ac Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/configure.ac Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-dnl $Id: configure.ac,v 1.12 2007/09/14 08:12:29 joerg Exp $
+dnl $Id: configure.ac,v 1.13 2007/09/21 18:44:36 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@localhost])
@@ -64,14 +64,6 @@
# define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
#endif
-#ifndef __P
-# if defined(__STDC__) || defined(__cplusplus)
-# define __P(protos) protos /* full-blown ANSI C */
-# else
-# define __P(protos) () /* traditional C preprocessor */
-# endif
-#endif
-
#ifndef __CONCAT
# if defined(__STDC__) || defined(__cplusplus)
# define __CONCAT(x,y) x ## y
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/digest.c
--- a/pkgtools/digest/files/digest.c Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/digest.c Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: digest.c,v 1.14 2007/09/14 08:12:29 joerg Exp $ */
+/* $NetBSD: digest.c,v 1.15 2007/09/21 18:44:36 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.14 2007/09/14 08:12:29 joerg Exp $");
+__RCSID("$NetBSD: digest.c,v 1.15 2007/09/21 18:44:36 joerg Exp $");
#endif
@@ -61,7 +61,7 @@
#endif
typedef void (*HASH_init)(void *);
-typedef void (*HASH_update)(void *, const unsigned char *, unsigned int);
+typedef void (*HASH_update)(void *, const uint8_t *, size_t);
typedef char *(*HASH_end)(void *, char *);
typedef char *(*HASH_file)(char *, char *);
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/md5.h
--- a/pkgtools/digest/files/md5.h Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/md5.h Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md5.h,v 1.5 2007/08/02 13:54:34 joerg Exp $ */
+/* $NetBSD: md5.h,v 1.6 2007/09/21 18:44:36 joerg Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
@@ -48,13 +48,13 @@
} MD5_CTX;
__BEGIN_DECLS
-void MD5Init __P((MD5_CTX *));
-void MD5Update __P((MD5_CTX *, const unsigned char *, unsigned int));
-void MD5Final __P((unsigned char[16], MD5_CTX *));
+void MD5Init(MD5_CTX *);
+void MD5Update(MD5_CTX *, const uint8_t *, size_t);
+void MD5Final(unsigned char[16], MD5_CTX *);
#ifndef _KERNEL
-char *MD5End __P((MD5_CTX *, char *));
-char *MD5File __P((const char *, char *));
-char *MD5Data __P((const unsigned char *, unsigned int, char *));
+char *MD5End(MD5_CTX *, char *);
+char *MD5File(const char *, char *);
+char *MD5Data(const uint8_t *, size_t, char *);
#endif /* _KERNEL */
__END_DECLS
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/md5c.c
--- a/pkgtools/digest/files/md5c.c Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/md5c.c Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md5c.c,v 1.4 2007/07/03 18:54:04 joerg Exp $ */
+/* $NetBSD: md5c.c,v 1.5 2007/09/21 18:44:36 joerg Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
@@ -91,10 +91,10 @@
#define _DIAGASSERT(cond) assert(cond)
#endif
-static void MD5Transform __P((UINT4 [4], const unsigned char [64]));
+static void MD5Transform(UINT4 [4], const unsigned char [64]);
-static void Encode __P((unsigned char *, UINT4 *, unsigned int));
-static void Decode __P((UINT4 *, const unsigned char *, unsigned int));
+static void Encode(unsigned char *, UINT4 *, unsigned int);
+static void Decode(UINT4 *, const unsigned char *, unsigned int);
/*
* Encodes input (UINT4) into output (unsigned char). Assumes len is
@@ -184,8 +184,7 @@
* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
void
-MD5Init(context)
- MD5_CTX *context; /* context */
+MD5Init(MD5_CTX *context)
{
_DIAGASSERT(context != 0);
@@ -205,10 +204,7 @@
* context.
*/
void
-MD5Update(context, input, inputLen)
- MD5_CTX *context; /* context */
- const unsigned char *input; /* input block */
- unsigned int inputLen; /* length of input block */
+MD5Update(MD5_CTX *context, const uint8_t *input, size_t inputLen)
{
unsigned int i, idx, partLen;
@@ -251,12 +247,11 @@
* message digest and zeroing the context.
*/
void
-MD5Final(digest, context)
- unsigned char digest[16]; /* message digest */
- MD5_CTX *context; /* context */
+MD5Final(unsigned char digest[16], MD5_CTX *context)
{
unsigned char bits[8];
- unsigned int idx, padLen;
+ unsigned int idx;
+ size_t padLen;
_DIAGASSERT(digest != 0);
_DIAGASSERT(context != 0);
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/md5hl.c
--- a/pkgtools/digest/files/md5hl.c Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/md5hl.c Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md5hl.c,v 1.5 2007/07/03 18:54:04 joerg Exp $ */
+/* $NetBSD: md5hl.c,v 1.6 2007/09/21 18:44:37 joerg Exp $ */
/*
* Written by Jason R. Thorpe <thorpej%netbsd.org@localhost>, April 29, 1997.
@@ -18,7 +18,7 @@
#define _DIAGASSERT(cond) assert(cond)
#endif
-/* $NetBSD: md5hl.c,v 1.5 2007/07/03 18:54:04 joerg Exp $ */
+/* $NetBSD: md5hl.c,v 1.6 2007/09/21 18:44:37 joerg Exp $ */
/*
* ----------------------------------------------------------------------------
@@ -52,9 +52,7 @@
#define MDNAME(x) CONCAT(MDALGORITHM,x)
char *
-MDNAME(End)(ctx, buf)
- MDNAME(_CTX) *ctx;
- char *buf;
+MDNAME(End)(MDNAME(_CTX) *ctx, char *buf)
{
int i;
unsigned char digest[16];
@@ -85,7 +83,8 @@
{
unsigned char buffer[BUFSIZ];
MDNAME(_CTX) ctx;
- int f, i, j;
+ int f, j;
+ size_t i;
_DIAGASSERT(filename != 0);
/* buf may be NULL */
@@ -96,7 +95,7 @@
return NULL;
while ((i = read(f, buffer, sizeof(buffer))) > 0)
- MDNAME(Update)(&ctx, buffer, (unsigned int)i);
+ MDNAME(Update)(&ctx, buffer, (size_t)i);
j = errno;
close(f);
@@ -109,10 +108,7 @@
}
char *
-MDNAME(Data)(data, len, buf)
- const unsigned char *data;
- unsigned int len;
- char *buf;
+MDNAME(Data)(const uint8_t *data, size_t len, char *buf)
{
MDNAME(_CTX) ctx;
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/rmd160.c
--- a/pkgtools/digest/files/rmd160.c Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/rmd160.c Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rmd160.c,v 1.6 2007/09/14 08:12:29 joerg Exp $ */
+/* $NetBSD: rmd160.c,v 1.7 2007/09/21 18:44:37 joerg Exp $ */
/********************************************************************\
*
@@ -23,7 +23,7 @@
#endif
#ifndef lint
-__RCSID("$NetBSD: rmd160.c,v 1.6 2007/09/14 08:12:29 joerg Exp $");
+__RCSID("$NetBSD: rmd160.c,v 1.7 2007/09/21 18:44:37 joerg Exp $");
#endif /* not lint */
/* header files */
@@ -360,7 +360,7 @@
/********************************************************************/
void
-RMD160Update(RMD160_CTX *context, const uint8_t *data, uint32_t nbytes)
+RMD160Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
{
uint32_t X[16];
uint32_t ofs = 0;
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/rmd160.h
--- a/pkgtools/digest/files/rmd160.h Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/rmd160.h Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rmd160.h,v 1.6 2007/09/14 08:12:29 joerg Exp $ */
+/* $NetBSD: rmd160.h,v 1.7 2007/09/21 18:44:37 joerg Exp $ */
/********************************************************************\
*
@@ -42,7 +42,7 @@
__BEGIN_DECLS
void RMD160Init(RMD160_CTX *);
void RMD160Transform(uint32_t[5], const uint32_t[16]);
-void RMD160Update(RMD160_CTX *, const uint8_t *, uint32_t);
+void RMD160Update(RMD160_CTX *, const uint8_t *, size_t);
void RMD160Final(uint8_t[20], RMD160_CTX *);
#ifndef _KERNEL
char *RMD160End(RMD160_CTX *, char *);
diff -r 38ca88936eb2 -r ef9eac9372e6 pkgtools/digest/files/sha1.c
--- a/pkgtools/digest/files/sha1.c Fri Sep 21 18:40:42 2007 +0000
+++ b/pkgtools/digest/files/sha1.c Fri Sep 21 18:44:36 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1.c,v 1.8 2007/09/14 08:12:29 joerg Exp $ */
+/* $NetBSD: sha1.c,v 1.9 2007/09/21 18:44:37 joerg Exp $ */
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
/*
@@ -79,7 +79,7 @@
typedef union {
uint8_t c[64];
- u_int l[16];
+ uint32_t l[16];
} CHAR64LONG16;
#ifdef __sparc_v9__
@@ -138,7 +138,8 @@
/*
* Hash a single 512-bit block. This is the core of the algorithm.
*/
-void SHA1Transform(uint32_t state[5], const uint8_t buffer[64])
+void
+SHA1Transform(uint32_t state[5], const uint8_t buffer[64])
{
uint32_t a, b, c, d, e;
CHAR64LONG16 *block;
@@ -208,8 +209,8 @@
/*
* SHA1Init - Initialize new context
*/
-void SHA1Init(context)
- SHA1_CTX *context;
+void
+SHA1Init(SHA1_CTX *context)
Home |
Main Index |
Thread Index |
Old Index