diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-04-29 15:51:17 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-04-29 15:51:17 +0000 |
commit | c082379018832e72c95068e938deaf79530a9458 (patch) | |
tree | 6e16bfb642f94adfe14efc18774aaa5d0ae628d0 /lib | |
parent | bd5f9653f2399919b0aefeb32085ba80116ed969 (diff) |
Undo some recent prototype changes; it is legal to pass the helper
functions can take a NULL buf pointer. They will malloc memory as
needed in this case.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/hash/helper.c | 14 | ||||
-rw-r--r-- | lib/libc/hash/mdX.3 | 10 | ||||
-rw-r--r-- | lib/libc/hash/rmd160.3 | 12 | ||||
-rw-r--r-- | lib/libc/hash/sha1.3 | 12 | ||||
-rw-r--r-- | lib/libc/hash/sha2.3 | 22 |
5 files changed, 35 insertions, 35 deletions
diff --git a/lib/libc/hash/helper.c b/lib/libc/hash/helper.c index 8c686e30150..a1fd763f78d 100644 --- a/lib/libc/hash/helper.c +++ b/lib/libc/hash/helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: helper.c,v 1.3 2004/04/29 02:43:06 millert Exp $ */ +/* $OpenBSD: helper.c,v 1.4 2004/04/29 15:51:16 millert Exp $ */ /* * ---------------------------------------------------------------------------- @@ -10,7 +10,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$OpenBSD: helper.c,v 1.3 2004/04/29 02:43:06 millert Exp $"; +static const char rcsid[] = "$OpenBSD: helper.c,v 1.4 2004/04/29 15:51:16 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -26,14 +26,14 @@ static const char rcsid[] = "$OpenBSD: helper.c,v 1.3 2004/04/29 02:43:06 miller /* ARGSUSED */ char * -HASHEnd(HASH_CTX *ctx, char buf[HASH_DIGEST_STRING_LENGTH]) +HASHEnd(HASH_CTX *ctx, char *buf) { int i; u_int8_t digest[HASH_DIGEST_LENGTH]; static const char hex[] = "0123456789abcdef"; if (buf == NULL && (buf = malloc(HASH_DIGEST_STRING_LENGTH)) == NULL) - return(NULL); + return (NULL); HASHFinal(digest, ctx); for (i = 0; i < HASH_DIGEST_LENGTH; i++) { @@ -46,7 +46,7 @@ HASHEnd(HASH_CTX *ctx, char buf[HASH_DIGEST_STRING_LENGTH]) } char * -HASHFile(char *filename, char buf[HASH_DIGEST_STRING_LENGTH]) +HASHFile(char *filename, char *buf) { u_char buffer[BUFSIZ]; HASH_CTX ctx; @@ -55,7 +55,7 @@ HASHFile(char *filename, char buf[HASH_DIGEST_STRING_LENGTH]) HASHInit(&ctx); if ((fd = open(filename, O_RDONLY)) < 0) - return(NULL); + return (NULL); while ((num = read(fd, buffer, sizeof(buffer))) > 0) HASHUpdate(&ctx, buffer, num); @@ -67,7 +67,7 @@ HASHFile(char *filename, char buf[HASH_DIGEST_STRING_LENGTH]) } char * -HASHData(const u_char *data, size_t len, char buf[HASH_DIGEST_STRING_LENGTH]) +HASHData(const u_char *data, size_t len, char *buf) { HASH_CTX ctx; diff --git a/lib/libc/hash/mdX.3 b/lib/libc/hash/mdX.3 index 2b36cfce230..a5dcb19ec51 100644 --- a/lib/libc/hash/mdX.3 +++ b/lib/libc/hash/mdX.3 @@ -6,9 +6,9 @@ .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp .\" ---------------------------------------------------------------------------- .\" -.\" $OpenBSD: mdX.3,v 1.2 2004/04/29 13:33:58 jmc Exp $ +.\" $OpenBSD: mdX.3,v 1.3 2004/04/29 15:51:16 millert Exp $ .\" -.Dd October 9, 1996 +.Dd April 29, 2004 .Dt MDX 3 .Os .Sh NAME @@ -32,11 +32,11 @@ .Ft void .Fn MDXTransform "u_int32_t state[4]" "u_int8_t block[MDX_BLOCK_LENGTH]" .Ft "char *" -.Fn MDXEnd "MDX_CTX *context" "char buf[MDX_DIGEST_STRING_LENGTH]" +.Fn MDXEnd "MDX_CTX *context" "char *buf" .Ft "char *" -.Fn MDXFile "char *filename" "char buf[MDX_DIGEST_STRING_LENGTH]" +.Fn MDXFile "char *filename" "char *buf" .Ft "char *" -.Fn MDXData "const u_int8_t *data" "unsigned int len" "char buf[MDX_DIGEST_STRING_LENGTH]" +.Fn MDXData "const u_int8_t *data" "size_t len" "char *buf" .Sh DESCRIPTION The MDX functions calculate a 128-bit cryptographic checksum (digest) for any number of input bytes. diff --git a/lib/libc/hash/rmd160.3 b/lib/libc/hash/rmd160.3 index cba5a3ba280..bcb6714a375 100644 --- a/lib/libc/hash/rmd160.3 +++ b/lib/libc/hash/rmd160.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: rmd160.3,v 1.22 2004/04/28 16:54:57 millert Exp $ +.\" $OpenBSD: rmd160.3,v 1.23 2004/04/29 15:51:16 millert Exp $ .\" -.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> +.\" Copyright (c) 1997, 2004 Todd C. Miller <Todd.Miller@courtesan.com> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ .\" See http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html .\" for detailed information about RIPEMD-160. .\" -.Dd July 16, 1997 +.Dd April 29, 2004 .Dt RMD160 3 .Os .Sh NAME @@ -41,11 +41,11 @@ .Ft void .Fn RMD160Transform "u_int32_t state[5]" "const u_int8_t block[RMD160_BLOCK_LENGTH]" .Ft "char *" -.Fn RMD160End "RMD160_CTX *context" "char buf[RMD160_DIGEST_STRING_LENGTH]" +.Fn RMD160End "RMD160_CTX *context" "char *buf" .Ft "char *" -.Fn RMD160File "char *filename" "char buf[RMD160_DIGEST_STRING_LENGTH]" +.Fn RMD160File "char *filename" "char *buf" .Ft "char *" -.Fn RMD160Data "const u_int8_t *data" "size_t len" "char buf[RMD160_DIGEST_STRING_LENGTH]" +.Fn RMD160Data "const u_int8_t *data" "size_t len" "char *buf" .Sh DESCRIPTION The RMD160 functions implement the 160-bit RIPE message digest hash algorithm (RMD-160). diff --git a/lib/libc/hash/sha1.3 b/lib/libc/hash/sha1.3 index 8514f047457..937423cb9d3 100644 --- a/lib/libc/hash/sha1.3 +++ b/lib/libc/hash/sha1.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: sha1.3,v 1.28 2004/04/28 16:54:57 millert Exp $ +.\" $OpenBSD: sha1.3,v 1.29 2004/04/29 15:51:16 millert Exp $ .\" -.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> +.\" Copyright (c) 1997, 2004 Todd C. Miller <Todd.Miller@courtesan.com> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ .\" See http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.txt .\" for the detailed standard .\" -.Dd July 10, 1997 +.Dd April 29, 2004 .Dt SHA1 3 .Os .Sh NAME @@ -41,11 +41,11 @@ .Ft void .Fn SHA1Transform "u_int32_t state[5]" "u_int8_t buffer[SHA1_BLOCK_LENGTH]" .Ft "char *" -.Fn SHA1End "SHA1_CTX *context" "char buf[SHA1_DIGEST_STRING_LENGTH]" +.Fn SHA1End "SHA1_CTX *context" "char *buf" .Ft "char *" -.Fn SHA1File "char *filename" "char buf[SHA1_DIGEST_STRING_LENGTH]" +.Fn SHA1File "char *filename" "char *buf" .Ft "char *" -.Fn SHA1Data "const u_int8_t *data" "u_int len" "char buf[SHA1_DIGEST_STRING_LENGTH]" +.Fn SHA1Data "const u_int8_t *data" "size_t len" "char *buf" .Sh DESCRIPTION The SHA1 functions implement the NIST Secure Hash Algorithm (SHA-1), FIPS PUB 180-1. diff --git a/lib/libc/hash/sha2.3 b/lib/libc/hash/sha2.3 index f74784afb3a..deabd6f5c98 100644 --- a/lib/libc/hash/sha2.3 +++ b/lib/libc/hash/sha2.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: sha2.3,v 1.5 2003/10/03 13:57:39 jmc Exp $ +.\" $OpenBSD: sha2.3,v 1.6 2004/04/29 15:51:16 millert Exp $ .\" -.\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> +.\" Copyright (c) 2003, 2004 Todd C. Miller <Todd.Miller@courtesan.com> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -41,11 +41,11 @@ .Ft void .Fn SHA256_Final "u_int8_t digest[SHA256_DIGEST_LENGTH]" "SHA256_CTX *context" .Ft "char *" -.Fn SHA256_End "SHA256_CTX *context" "char buf[SHA256_DIGEST_STRING_LENGTH]" +.Fn SHA256_End "SHA256_CTX *context" "char *buf" .Ft "char *" -.Fn SHA256_File "char *filename" "char buf[SHA256_DIGEST_STRING_LENGTH]" +.Fn SHA256_File "char *filename" "char *buf" .Ft "char *" -.Fn SHA256_Data "u_int8_t *data" "u_int len" "char buf[SHA256_DIGEST_STRING_LENGTH]" +.Fn SHA256_Data "u_int8_t *data" "u_int len" "char *buf" .Ft void .Fn SHA384_Init "SHA384_CTX *context" .Ft void @@ -53,11 +53,11 @@ .Ft void .Fn SHA384_Final "u_int8_t digest[SHA384_DIGEST_LENGTH]" "SHA384_CTX *context" .Ft "char *" -.Fn SHA384_End "SHA384_CTX *context" "char buf[SHA384_DIGEST_STRING_LENGTH]" +.Fn SHA384_End "SHA384_CTX *context" "char *buf" .Ft "char *" -.Fn SHA384_File "char *filename" "char buf[SHA384_DIGEST_STRING_LENGTH]" +.Fn SHA384_File "char *filename" "char *buf" .Ft "char *" -.Fn SHA384_Data "u_int8_t *data" "size_t len" "char buf[SHA384_DIGEST_STRING_LENGTH]" +.Fn SHA384_Data "u_int8_t *data" "size_t len" "char *buf" .Ft void .Fn SHA512_Init "SHA512_CTX *context" .Ft void @@ -65,11 +65,11 @@ .Ft void .Fn SHA512_Final "u_int8_t digest[SHA512_DIGEST_LENGTH]" "SHA512_CTX *context" .Ft "char *" -.Fn SHA512_End "SHA512_CTX *context" "char buf[SHA512_DIGEST_STRING_LENGTH]" +.Fn SHA512_End "SHA512_CTX *context" "char *buf" .Ft "char *" -.Fn SHA512_File "char *filename" "char buf[SHA512_DIGEST_STRING_LENGTH]" +.Fn SHA512_File "char *filename" "char *buf" .Ft "char *" -.Fn SHA512_Data "u_int8_t *data" "size_t len" "char buf[SHA512_DIGEST_STRING_LENGTH]" +.Fn SHA512_Data "u_int8_t *data" "size_t len" "char *buf" .Sh DESCRIPTION The SHA2 functions implement the NIST Secure Hash Standard, FIPS PUB 180-2. |