summaryrefslogtreecommitdiff
path: root/pkgtools/digest
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-09-21 18:44:36 +0000
committerjoerg <joerg@pkgsrc.org>2007-09-21 18:44:36 +0000
commitf60512c7851ec6b37fae3fe0c32841646d766467 (patch)
treee5830d0603a38d2c5444aee5be0a329466e44863 /pkgtools/digest
parent00c4ce12d9a34ad1dc47ab74ef3b44fe87ed5fa4 (diff)
downloadpkgsrc-f60512c7851ec6b37fae3fe0c32841646d766467.tar.gz
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 (limited to 'pkgtools/digest')
-rw-r--r--pkgtools/digest/files/config.h.in8
-rw-r--r--pkgtools/digest/files/configure.ac10
-rw-r--r--pkgtools/digest/files/digest.c6
-rw-r--r--pkgtools/digest/files/md5.h14
-rw-r--r--pkgtools/digest/files/md5c.c23
-rw-r--r--pkgtools/digest/files/md5hl.c18
-rw-r--r--pkgtools/digest/files/rmd160.c6
-rw-r--r--pkgtools/digest/files/rmd160.h4
-rw-r--r--pkgtools/digest/files/sha1.c30
-rw-r--r--pkgtools/digest/files/sha1.h16
-rw-r--r--pkgtools/digest/files/sha1hl.c26
-rw-r--r--pkgtools/digest/files/sha2.c10
-rw-r--r--pkgtools/digest/files/sha2.h28
-rw-r--r--pkgtools/digest/files/sha2hl.c33
-rw-r--r--pkgtools/digest/files/tiger.c4
-rw-r--r--pkgtools/digest/files/tiger.h4
16 files changed, 91 insertions, 149 deletions
diff --git a/pkgtools/digest/files/config.h.in b/pkgtools/digest/files/config.h.in
index 40dec55f9da..e6eec8fd1d6 100644
--- a/pkgtools/digest/files/config.h.in
+++ b/pkgtools/digest/files/config.h.in
@@ -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 --git a/pkgtools/digest/files/configure.ac b/pkgtools/digest/files/configure.ac
index 8499a8a9e1f..e7cd85510fa 100644
--- a/pkgtools/digest/files/configure.ac
+++ b/pkgtools/digest/files/configure.ac
@@ -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])
@@ -64,14 +64,6 @@ AH_BOTTOM([
# 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 --git a/pkgtools/digest/files/digest.c b/pkgtools/digest/files/digest.c
index 0c20cdc39b9..4b9100c0055 100644
--- a/pkgtools/digest/files/digest.c
+++ b/pkgtools/digest/files/digest.c
@@ -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 @@ __RCSID("$NetBSD: digest.c,v 1.14 2007/09/14 08:12:29 joerg Exp $");
#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 --git a/pkgtools/digest/files/md5.h b/pkgtools/digest/files/md5.h
index 96bdab52080..08892162ca9 100644
--- a/pkgtools/digest/files/md5.h
+++ b/pkgtools/digest/files/md5.h
@@ -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 @@ typedef struct MD5Context {
} 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 --git a/pkgtools/digest/files/md5c.c b/pkgtools/digest/files/md5c.c
index 52a5a53e1bb..6798847c67f 100644
--- a/pkgtools/digest/files/md5c.c
+++ b/pkgtools/digest/files/md5c.c
@@ -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 @@ __weak_alias(MD5Final,_MD5Final)
#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 @@ static const unsigned char PADDING[64] = {
* 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 @@ MD5Init(context)
* 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 @@ MD5Update(context, input, inputLen)
* 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 --git a/pkgtools/digest/files/md5hl.c b/pkgtools/digest/files/md5hl.c
index d1432c9af06..e120df1d3d6 100644
--- a/pkgtools/digest/files/md5hl.c
+++ b/pkgtools/digest/files/md5hl.c
@@ -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>, 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 @@ MDNAME(File)(filename, buf)
{
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 @@ MDNAME(File)(filename, buf)
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 @@ MDNAME(File)(filename, buf)
}
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 --git a/pkgtools/digest/files/rmd160.c b/pkgtools/digest/files/rmd160.c
index c2e93276811..d3cdd24c548 100644
--- a/pkgtools/digest/files/rmd160.c
+++ b/pkgtools/digest/files/rmd160.c
@@ -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 @@ RMD160Transform(uint32_t state[5], const uint32_t block[16])
/********************************************************************/
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 --git a/pkgtools/digest/files/rmd160.h b/pkgtools/digest/files/rmd160.h
index bd61218acfa..aebb0e684df 100644
--- a/pkgtools/digest/files/rmd160.h
+++ b/pkgtools/digest/files/rmd160.h
@@ -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 @@ typedef struct {
__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 --git a/pkgtools/digest/files/sha1.c b/pkgtools/digest/files/sha1.c
index 8027f1b0cfd..e0184ba9f8c 100644
--- a/pkgtools/digest/files/sha1.c
+++ b/pkgtools/digest/files/sha1.c
@@ -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 @@ __weak_alias(SHA1Final,_SHA1Final)
typedef union {
uint8_t c[64];
- u_int l[16];
+ uint32_t l[16];
} CHAR64LONG16;
#ifdef __sparc_v9__
@@ -138,7 +138,8 @@ 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 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 @@ void SHA1Transform(uint32_t state[5], const uint8_t buffer[64])
/*
* SHA1Init - Initialize new context
*/
-void SHA1Init(context)
- SHA1_CTX *context;
+void
+SHA1Init(SHA1_CTX *context)
{
_DIAGASSERT(context != 0);
@@ -227,12 +228,11 @@ void SHA1Init(context)
/*
* Run your data through this.
*/
-void SHA1Update(context, data, len)
- SHA1_CTX *context;
- const uint8_t *data;
- u_int len;
+void
+SHA1Update(SHA1_CTX *context, const uint8_t *data, size_t len)
{
- u_int i, j;
+ unsigned int i;
+ uint32_t j;
_DIAGASSERT(context != 0);
_DIAGASSERT(data != 0);
@@ -242,7 +242,8 @@ void SHA1Update(context, data, len)
context->count[1] += (len>>29)+1;
j = (j >> 3) & 63;
if ((j + len) > 63) {
- (void)memcpy(&context->buffer[j], data, (i = 64-j));
+ i = 64 - j;
+ (void)memcpy(&context->buffer[j], data, i);
SHA1Transform(context->state, context->buffer);
for ( ; i + 63 < len; i += 64)
SHA1Transform(context->state, &data[i]);
@@ -257,11 +258,10 @@ void SHA1Update(context, data, len)
/*
* Add padding and return the message digest.
*/
-void SHA1Final(digest, context)
- uint8_t digest[20];
- SHA1_CTX* context;
+void
+SHA1Final(uint8_t digest[20], SHA1_CTX* context)
{
- u_int i;
+ unsigned int i;
uint8_t finalcount[8];
_DIAGASSERT(digest != 0);
diff --git a/pkgtools/digest/files/sha1.h b/pkgtools/digest/files/sha1.h
index 0f1d4293e19..c3373aef1b5 100644
--- a/pkgtools/digest/files/sha1.h
+++ b/pkgtools/digest/files/sha1.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1.h,v 1.6 2007/09/14 08:12:29 joerg Exp $ */
+/* $NetBSD: sha1.h,v 1.7 2007/09/21 18:44:37 joerg Exp $ */
/*
* SHA-1 in C
@@ -23,14 +23,14 @@ typedef struct {
uint8_t buffer[64];
} SHA1_CTX;
-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 uint8_t *data, u_int len));
-void SHA1Final __P((uint8_t digest[20], SHA1_CTX *context));
+void SHA1Transform(uint32_t state[5], const uint8_t buffer[64]);
+void SHA1Init(SHA1_CTX *context);
+void SHA1Update(SHA1_CTX *context, const uint8_t *data, size_t len);
+void SHA1Final(uint8_t digest[20], SHA1_CTX *context);
#ifndef _KERNEL
-char *SHA1End __P((SHA1_CTX *, char *));
-char *SHA1File __P((char *, char *));
-char *SHA1Data __P((const uint8_t *, size_t, char *));
+char *SHA1End(SHA1_CTX *, char *);
+char *SHA1File(char *, char *);
+char *SHA1Data(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 1664b9129a0..da1f38f0d0d 100644
--- a/pkgtools/digest/files/sha1hl.c
+++ b/pkgtools/digest/files/sha1hl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1hl.c,v 1.6 2007/09/14 08:12:29 joerg Exp $ */
+/* $NetBSD: sha1hl.c,v 1.7 2007/09/21 18:44:37 joerg Exp $ */
/* sha1hl.c
* ----------------------------------------------------------------------------
@@ -33,24 +33,16 @@
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sha1hl.c,v 1.6 2007/09/14 08:12:29 joerg Exp $");
+__RCSID("$NetBSD: sha1hl.c,v 1.7 2007/09/21 18:44:37 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#ifndef _DIAGASSERT
#define _DIAGASSERT(cond) assert(cond)
#endif
-#if 0
-__weak_alias(SHA1End,_SHA1End)
-__weak_alias(SHA1File,_SHA1File)
-__weak_alias(SHA1Data,_SHA1Data)
-#endif
-
/* ARGSUSED */
char *
-SHA1End(ctx, buf)
- SHA1_CTX *ctx;
- char *buf;
+SHA1End(SHA1_CTX *ctx, char *buf)
{
int i;
char *p = buf;
@@ -73,13 +65,12 @@ SHA1End(ctx, buf)
}
char *
-SHA1File (filename, buf)
- char *filename;
- char *buf;
+SHA1File(char *filename, char *buf)
{
uint8_t buffer[BUFSIZ];
SHA1_CTX ctx;
- int fd, num, oerrno;
+ int fd, oerrno;
+ size_t num;
_DIAGASSERT(filename != NULL);
/* XXX: buf may be NULL ? */
@@ -99,10 +90,7 @@ SHA1File (filename, buf)
}
char *
-SHA1Data (data, len, buf)
- const uint8_t *data;
- size_t len;
- char *buf;
+SHA1Data(const uint8_t *data, size_t len, char *buf)
{
SHA1_CTX ctx;
diff --git a/pkgtools/digest/files/sha2.c b/pkgtools/digest/files/sha2.c
index 78b8144c62a..1fe804fb778 100644
--- a/pkgtools/digest/files/sha2.c
+++ b/pkgtools/digest/files/sha2.c
@@ -460,7 +460,8 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
#endif /* SHA2_UNROLL_TRANSFORM */
-void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
+void SHA256_Update(SHA256_CTX* context, const uint8_t *data, size_t len)
+{
unsigned int freespace, usedspace;
if (len == 0) {
@@ -750,7 +751,9 @@ void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
#endif /* SHA2_UNROLL_TRANSFORM */
-void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
+void
+SHA512_Update(SHA512_CTX* context, const uint8_t *data, size_t len)
+{
unsigned int freespace, usedspace;
if (len == 0) {
@@ -879,7 +882,8 @@ void SHA384_Init(SHA384_CTX* context) {
context->bitcount[0] = context->bitcount[1] = 0;
}
-void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
+void SHA384_Update(SHA384_CTX* context, const uint8_t * data, size_t len)
+{
SHA512_Update((SHA512_CTX*)context, data, len);
}
diff --git a/pkgtools/digest/files/sha2.h b/pkgtools/digest/files/sha2.h
index 43da8cb0ae2..9b76536ee4b 100644
--- a/pkgtools/digest/files/sha2.h
+++ b/pkgtools/digest/files/sha2.h
@@ -79,9 +79,6 @@ typedef struct _SHA512_CTX {
typedef SHA512_CTX SHA384_CTX;
-/*** SHA-256/384/512 Function Prototypes ******************************/
-#ifndef NOPROTO
-
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*);
@@ -103,31 +100,6 @@ char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
char *SHA512_File(char *, char *);
-#else /* NOPROTO */
-
-void SHA256_Init();
-void SHA256_Update();
-void SHA256_Final();
-char* SHA256_End();
-char* SHA256_Data();
-char *SHA256_File();
-
-void SHA384_Init();
-void SHA384_Update();
-void SHA384_Final();
-char* SHA384_End();
-char* SHA384_Data();
-char *SHA384_File();
-
-void SHA512_Init();
-void SHA512_Update();
-void SHA512_Final();
-char* SHA512_End();
-char* SHA512_Data();
-char *SHA512_File();
-
-#endif /* NOPROTO */
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/pkgtools/digest/files/sha2hl.c b/pkgtools/digest/files/sha2hl.c
index f796f137120..4d83a016a17 100644
--- a/pkgtools/digest/files/sha2hl.c
+++ b/pkgtools/digest/files/sha2hl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2hl.c,v 1.6 2007/09/14 08:12:30 joerg Exp $ */
+/* $NetBSD: sha2hl.c,v 1.7 2007/09/21 18:44:38 joerg Exp $ */
/*
* sha2hl.c
@@ -45,7 +45,7 @@
#endif
#ifndef lint
-__RCSID("$NetBSD: sha2hl.c,v 1.6 2007/09/14 08:12:30 joerg Exp $");
+__RCSID("$NetBSD: sha2hl.c,v 1.7 2007/09/21 18:44:38 joerg Exp $");
#endif /* not lint */
@@ -83,7 +83,8 @@ SHA256_File(char *filename, char *buf)
{
uint8_t buffer[BUFSIZ * 20];
SHA256_CTX ctx;
- int fd, num, oerrno;
+ int fd, oerrno;
+ ssize_t num;
_DIAGASSERT(filename != NULL);
/* XXX: buf may be NULL ? */
@@ -103,7 +104,7 @@ SHA256_File(char *filename, char *buf)
}
-char *
+char *
SHA256_End(SHA256_CTX *ctx, uint8_t *buffer)
{
uint8_t digest[SHA256_DIGEST_LENGTH], *d = digest;
@@ -129,8 +130,8 @@ SHA256_End(SHA256_CTX *ctx, uint8_t *buffer)
return ret;
}
-char *
-SHA256_Data(const sha2_byte * data, size_t len, uint8_t *digest)
+char *
+SHA256_Data(const uint8_t * data, size_t len, uint8_t *digest)
{
SHA256_CTX ctx;
@@ -144,7 +145,8 @@ SHA384_File(char *filename, char *buf)
{
SHA384_CTX ctx;
uint8_t buffer[BUFSIZ * 20];
- int fd, num, oerrno;
+ int fd, oerrno;
+ ssize_t num;
_DIAGASSERT(filename != NULL);
/* XXX: buf may be NULL ? */
@@ -163,7 +165,7 @@ SHA384_File(char *filename, char *buf)
return (num < 0 ? 0 : SHA384_End(&ctx, buf));
}
-char *
+char *
SHA384_End(SHA384_CTX * ctx, char buffer[])
{
uint8_t digest[SHA384_DIGEST_LENGTH], *d = digest;
@@ -189,8 +191,8 @@ SHA384_End(SHA384_CTX * ctx, char buffer[])
return ret;
}
-char *
-SHA384_Data(const sha2_byte * data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH])
+char *
+SHA384_Data(const uint8_t * data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH])
{
SHA384_CTX ctx;
@@ -199,12 +201,13 @@ SHA384_Data(const sha2_byte * data, size_t len, char digest[SHA384_DIGEST_STRING
return SHA384_End(&ctx, digest);
}
-char *
+char *
SHA512_File(char *filename, char *buf)
{
SHA512_CTX ctx;
uint8_t buffer[BUFSIZ * 20];
- int fd, num, oerrno;
+ int fd, oerrno;
+ ssize_t num;
_DIAGASSERT(filename != NULL);
/* XXX: buf may be NULL ? */
@@ -223,7 +226,7 @@ SHA512_File(char *filename, char *buf)
return (num < 0 ? 0 : SHA512_End(&ctx, buf));
}
-char *
+char *
SHA512_End(SHA512_CTX * ctx, char buffer[])
{
uint8_t digest[SHA512_DIGEST_LENGTH], *d = digest;
@@ -249,8 +252,8 @@ SHA512_End(SHA512_CTX * ctx, char buffer[])
return ret;
}
-char *
-SHA512_Data(const sha2_byte * data, size_t len, char *digest)
+char *
+SHA512_Data(const uint8_t * data, size_t len, char *digest)
{
SHA512_CTX ctx;
diff --git a/pkgtools/digest/files/tiger.c b/pkgtools/digest/files/tiger.c
index cf781a95ee6..09821f46d2b 100644
--- a/pkgtools/digest/files/tiger.c
+++ b/pkgtools/digest/files/tiger.c
@@ -653,7 +653,7 @@ TIGERInit(tiger_context_t *tp)
}
void
-TIGERUpdate(tiger_context_t *tp, const uint8_t *data, uint32_t len)
+TIGERUpdate(tiger_context_t *tp, const uint8_t *data, size_t len)
{
const uint64_t *str = (const uint64_t *)data;
uint64_t i;
@@ -747,7 +747,7 @@ TIGERFile(char *filename, char *buf)
tiger_context_t ctx;
uint8_t buffer[BUFSIZ];
int fd;
- int num;
+ ssize_t num;
int oerrno;
TIGERInit(&ctx);
diff --git a/pkgtools/digest/files/tiger.h b/pkgtools/digest/files/tiger.h
index 8c1dd2e7f52..0009285f8ac 100644
--- a/pkgtools/digest/files/tiger.h
+++ b/pkgtools/digest/files/tiger.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tiger.h,v 1.3 2007/08/02 13:54:34 joerg Exp $ */
+/* $NetBSD: tiger.h,v 1.4 2007/09/21 18:44:38 joerg Exp $ */
/*
* Copyright © 2005 Alistair Crooks. All rights reserved.
@@ -47,7 +47,7 @@ typedef struct tiger_context_t {
} tiger_context_t;
void TIGERInit(tiger_context_t *);
-void TIGERUpdate(tiger_context_t *, const uint8_t *, uint32_t);
+void TIGERUpdate(tiger_context_t *, const uint8_t *, size_t);
void TIGERFinal(uint8_t *, tiger_context_t *);
char *TIGEREnd(tiger_context_t *, char *);