summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-05-05 17:09:47 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-05-05 17:09:47 +0000
commit2c9dc2a64bca671d0102cd84583f7fb5f8523ab4 (patch)
tree2a34f5e3720e9642228f23dd887cb3a8b4f44d6f /lib/libc
parentfd3abbb3bdb96f3e3963c13797f50280a93eecc9 (diff)
Make the 2nd arg to SHA1Transform const again and unifdef SHA1HANDSOFF.
It was defined before and there is no need to for this knob...
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/hash/sha1.34
-rw-r--r--lib/libc/hash/sha1.c17
2 files changed, 7 insertions, 14 deletions
diff --git a/lib/libc/hash/sha1.3 b/lib/libc/hash/sha1.3
index 9028bbdbe91..6fae362f2f0 100644
--- a/lib/libc/hash/sha1.3
+++ b/lib/libc/hash/sha1.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sha1.3,v 1.31 2004/05/03 18:10:07 millert Exp $
+.\" $OpenBSD: sha1.3,v 1.32 2004/05/05 17:09:46 millert Exp $
.\"
.\" Copyright (c) 1997, 2004 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@@ -43,7 +43,7 @@
.Ft void
.Fn SHA1Final "u_int8_t digest[SHA1_DIGEST_LENGTH]" "SHA1_CTX *context"
.Ft void
-.Fn SHA1Transform "u_int32_t state[5]" "u_int8_t buffer[SHA1_BLOCK_LENGTH]"
+.Fn SHA1Transform "u_int32_t state[5]" "const u_int8_t buffer[SHA1_BLOCK_LENGTH]"
.Ft "char *"
.Fn SHA1End "SHA1_CTX *context" "char *buf"
.Ft "char *"
diff --git a/lib/libc/hash/sha1.c b/lib/libc/hash/sha1.c
index 81c04a76f8e..bb901ff4df7 100644
--- a/lib/libc/hash/sha1.c
+++ b/lib/libc/hash/sha1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha1.c,v 1.17 2004/05/03 18:05:08 millert Exp $ */
+/* $OpenBSD: sha1.c,v 1.18 2004/05/05 17:09:46 millert Exp $ */
/*
* SHA-1 in C
@@ -15,11 +15,9 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: sha1.c,v 1.17 2004/05/03 18:05:08 millert Exp $";
+static const char rcsid[] = "$OpenBSD: sha1.c,v 1.18 2004/05/05 17:09:46 millert Exp $";
#endif /* LIBC_SCCS and not lint */
-#define SHA1HANDSOFF /* Copies data before messing with it. */
-
#include <sys/param.h>
#include <string.h>
#include <sha1.h>
@@ -52,22 +50,17 @@ static char rcsid[] = "$OpenBSD: sha1.c,v 1.17 2004/05/03 18:05:08 millert Exp $
* Hash a single 512-bit block. This is the core of the algorithm.
*/
void
-SHA1Transform(u_int32_t state[5], u_int8_t buffer[SHA1_BLOCK_LENGTH])
+SHA1Transform(u_int32_t state[5], const u_int8_t buffer[SHA1_BLOCK_LENGTH])
{
u_int32_t a, b, c, d, e;
+ u_int8_t workspace[SHA1_BLOCK_LENGTH];
typedef union {
u_int8_t c[64];
u_int32_t l[16];
} CHAR64LONG16;
- CHAR64LONG16 *block;
+ CHAR64LONG16 *block = (CHAR64LONG16 *)workspace;
-#ifdef SHA1HANDSOFF
- u_int8_t workspace[SHA1_BLOCK_LENGTH];
- block = (CHAR64LONG16 *)workspace;
(void)memcpy(block, buffer, SHA1_BLOCK_LENGTH);
-#else
- block = (CHAR64LONG16 *)buffer;
-#endif
/* Copy context->state[] to working vars */
a = state[0];