Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/crypto/sha2 Remove stuff inside #if 0, remove __P macro ...
details: https://anonhg.NetBSD.org/src/rev/00adb3ca236a
branches: trunk
changeset: 583805:00adb3ca236a
user: elad <elad%NetBSD.org@localhost>
date: Tue Aug 23 16:23:50 2005 +0000
description:
Remove stuff inside #if 0, remove __P macro usage, add helper routines
prototypes inside #ifndef _KERNEL.
diffstat:
sys/crypto/sha2/sha2.h | 93 +++++++++++++++++--------------------------------
1 files changed, 32 insertions(+), 61 deletions(-)
diffs (126 lines):
diff -r 251f3a3994a8 -r 00adb3ca236a sys/crypto/sha2/sha2.h
--- a/sys/crypto/sha2/sha2.h Tue Aug 23 16:20:01 2005 +0000
+++ b/sys/crypto/sha2/sha2.h Tue Aug 23 16:23:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2.h,v 1.3 2005/07/21 15:42:41 tron Exp $ */
+/* $NetBSD: sha2.h,v 1.4 2005/08/23 16:23:50 elad Exp $ */
/* $KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $ */
/*
@@ -39,10 +39,8 @@
#ifndef __SHA2_H__
#define __SHA2_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <sys/types.h>
+#include <sys/cdefs.h>
/*** SHA-256/384/512 Various Length Definitions ***********************/
#define SHA256_BLOCK_LENGTH 64
@@ -57,46 +55,6 @@
/*** SHA-256/384/512 Context Structures *******************************/
-/* NOTE: If your architecture does not define either u_intXX_t types or
- * uintXX_t (from inttypes.h), you may need to define things by hand
- * for your system:
- */
-#if 0
-typedef unsigned char u_int8_t; /* 1-byte (8-bits) */
-typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */
-typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
-#endif
-/*
- * Most BSD systems already define u_intXX_t types, as does Linux.
- * Some systems, however, like Compaq's Tru64 Unix instead can use
- * uintXX_t types defined by very recent ANSI C standards and included
- * in the file:
- *
- * #include <inttypes.h>
- *
- * If you choose to use <inttypes.h> then please define:
- *
- * #define SHA2_USE_INTTYPES_H
- *
- * Or on the command line during compile:
- *
- * cc -DSHA2_USE_INTTYPES_H ...
- */
-#if 0 /*def SHA2_USE_INTTYPES_H*/
-
-typedef struct _SHA256_CTX {
- uint32_t state[8];
- uint64_t bitcount;
- uint8_t buffer[SHA256_BLOCK_LENGTH];
-} SHA256_CTX;
-typedef struct _SHA512_CTX {
- uint64_t state[8];
- uint64_t bitcount[2];
- uint8_t buffer[SHA512_BLOCK_LENGTH];
-} SHA512_CTX;
-
-#else /* SHA2_USE_INTTYPES_H */
-
typedef struct _SHA256_CTX {
u_int32_t state[8];
u_int64_t bitcount;
@@ -108,27 +66,40 @@
u_int8_t buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
-#endif /* SHA2_USE_INTTYPES_H */
-
typedef SHA512_CTX SHA384_CTX;
/*** SHA-256/384/512 Function Prototypes ******************************/
-
-void SHA256_Init __P((SHA256_CTX *));
-void SHA256_Update __P((SHA256_CTX*, const u_int8_t*, size_t));
-void SHA256_Final __P((u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*));
+__BEGIN_DECLS
+void SHA256_Init(SHA256_CTX *);
+void SHA256_Update(SHA256_CTX*, const u_int8_t*, size_t);
+void SHA256_Final(u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
+#ifndef _KERNEL
+char *SHA256_End(SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH]);
+char *SHA256_FileChunk(const char *, char *, off_t, off_t);
+char *SHA256_File(const char *, char *);
+char *SHA256_Data(const u_int8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
-void SHA384_Init __P((SHA384_CTX*));
-void SHA384_Update __P((SHA384_CTX*, const u_int8_t*, size_t));
-void SHA384_Final __P((u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*));
+void SHA384_Init(SHA384_CTX*);
+void SHA384_Update(SHA384_CTX*, const u_int8_t*, size_t);
+void SHA384_Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
+#ifndef _KERNEL
+char *SHA384_End(SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH]);
+char *SHA384_FileChunk(const char *, char *, off_t, off_t);
+char *SHA384_File(const char *, char *);
+char *SHA384_Data(const u_int8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
-void SHA512_Init __P((SHA512_CTX*));
-void SHA512_Update __P((SHA512_CTX*, const u_int8_t*, size_t));
-void SHA512_Final __P((u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*));
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+void SHA512_Init(SHA512_CTX*);
+void SHA512_Update(SHA512_CTX*, const u_int8_t*, size_t);
+void SHA512_Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
+#ifndef _KERNEL
+char *SHA512_End(SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH]);
+char *SHA512_FileChunk(const char *, char *, off_t, off_t);
+char *SHA512_File(const char *, char *);
+char *SHA512_Data(const u_int8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
+__END_DECLS
#endif /* __SHA2_H__ */
- Prev by Date:
[src/trunk]: src/lib/libc/hash/sha2 Add helper routines (end, filechunk, file...
- Next by Date:
[src/trunk]: src/lib/libc/hash/sha2 We don't have SHA{256, 384, 512}_Pad, but w...
- Previous by Thread:
[src/trunk]: src/lib/libc/hash/sha2 Add helper routines (end, filechunk, file...
- Next by Thread:
[src/trunk]: src/lib/libc/hash/sha2 We don't have SHA{256, 384, 512}_Pad, but w...
- Indexes:
Home |
Main Index |
Thread Index |
Old Index