summaryrefslogtreecommitdiffstats
path: root/include/sha1.h
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-07-10 22:52:59 +0000
committermillert <millert@openbsd.org>1997-07-10 22:52:59 +0000
commite7ee6cdc55c0755ee516b147456f7f4c1bddac01 (patch)
tree867f84eb7b536d5adc91a7a1e00fb059c6c23bc3 /include/sha1.h
parentNeed err.h for warnx proto. (diff)
downloadwireguard-openbsd-e7ee6cdc55c0755ee516b147456f7f4c1bddac01.tar.xz
wireguard-openbsd-e7ee6cdc55c0755ee516b147456f7f4c1bddac01.zip
Different sha1 functions (taken from netinet's if_sha1.c) that
are more consistent with md4/md5 functions.
Diffstat (limited to 'include/sha1.h')
-rw-r--r--include/sha1.h66
1 files changed, 16 insertions, 50 deletions
diff --git a/include/sha1.h b/include/sha1.h
index 277f7998aa2..c876d8a6aa9 100644
--- a/include/sha1.h
+++ b/include/sha1.h
@@ -1,57 +1,23 @@
-/* --------------------------------- SHA1.H ------------------------------- */
-
-/* NIST proposed Secure Hash Standard.
-
- Written 2 September 1992, Peter C. Gutmann.
- This implementation placed in the public domain.
-
- Comments to pgut1@cs.aukuni.ac.nz */
+/* $OpenBSD: sha1.h,v 1.5 1997/07/10 22:53:01 millert Exp $ */
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ * 100% Public Domain
+ */
#ifndef _SHA1_H
#define _SHA1_H
-/* The SHA1 block size and message digest sizes, in bytes */
-
-#define SHA1_BLOCKSIZE 64
-#define SHA1_DIGESTSIZE 20
-
-/* The structure for storing SHA1 info */
-
typedef struct {
- u_int32_t digest[ 5 ]; /* Message digest */
- u_int32_t countLo, countHi; /* 64-bit bit count */
- u_int32_t data[ 16 ]; /* SHA1 data buffer */
-} SHA1_INFO;
-
-/* The next def turns on the change to the algorithm introduced by NIST at
- * the behest of the NSA. It supposedly corrects a weakness in the original
- * formulation. Bruce Schneier described it thus in a posting to the
- * Cypherpunks mailing list on June 21, 1994 (as told to us by Steve Bellovin):
- *
- * This is the fix to the Secure Hash Standard, NIST FIPS PUB 180:
- *
- * In Section 7 of FIPS 180 (page 9), the line which reads
- *
- * "b) For t=16 to 79 let Wt = Wt-3 XOR Wt-8 XOR Wt-14 XOR
- * Wt-16."
- *
- * is to be replaced by
- *
- * "b) For t=16 to 79 let Wt = S1(Wt-3 XOR Wt-8 XOR Wt-14 XOR
- * Wt-16)."
- *
- * where S1 is a left circular shift by one bit as defined in
- * Section 3 of FIPS 180 (page 6):
- *
- * S1(X) = (X<<1) OR (X>>31).
- *
- */
-#define NEW_SHA1
-
-void sha1Init __P((SHA1_INFO *));
-void sha1Transform __P((SHA1_INFO *));
-void sha1Final __P((SHA1_INFO *));
-void sha1Update __P((SHA1_INFO *, unsigned char *, int));
-void sha1ByteReverse __P((u_int32_t *, int));
+ u_int32_t state[5];
+ u_int32_t count[2];
+ u_char buffer[64];
+} SHA1_CTX;
+
+void SHA1Transform __P((u_int32_t state[5], unsigned char buffer[64]));
+void SHA1Init __P((SHA1_CTX* context));
+void SHA1Update __P((SHA1_CTX* context, unsigned char* data, unsigned int len));
+void SHA1Final __P((unsigned char digest[20], SHA1_CTX* context));
#endif /* _SHA1_H */