summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/crypto/md5.c5
-rw-r--r--sys/crypto/md5.h4
-rw-r--r--sys/crypto/sha1.c9
-rw-r--r--sys/crypto/sha1.h4
-rw-r--r--sys/crypto/sha2.c12
-rw-r--r--sys/crypto/sha2.h8
6 files changed, 23 insertions, 19 deletions
diff --git a/sys/crypto/md5.c b/sys/crypto/md5.c
index ac90af873e4..1b85f1badbb 100644
--- a/sys/crypto/md5.c
+++ b/sys/crypto/md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.c,v 1.2 2011/01/11 15:42:05 deraadt Exp $ */
+/* $OpenBSD: md5.c,v 1.3 2014/11/16 17:39:09 tedu Exp $ */
/*
* This code implements the MD5 message-digest algorithm.
@@ -62,8 +62,9 @@ MD5Init(MD5_CTX *ctx)
* of bytes.
*/
void
-MD5Update(MD5_CTX *ctx, const unsigned char *input, size_t len)
+MD5Update(MD5_CTX *ctx, const void *inputptr, size_t len)
{
+ const uint8_t *input = inputptr;
size_t have, need;
/* Check how many bytes we already have and how many more we need. */
diff --git a/sys/crypto/md5.h b/sys/crypto/md5.h
index 99d60316ea5..24f5c4e0d53 100644
--- a/sys/crypto/md5.h
+++ b/sys/crypto/md5.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.h,v 1.2 2012/12/05 23:20:15 deraadt Exp $ */
+/* $OpenBSD: md5.h,v 1.3 2014/11/16 17:39:09 tedu Exp $ */
/*
* This code implements the MD5 message-digest algorithm.
@@ -26,7 +26,7 @@ typedef struct MD5Context {
__BEGIN_DECLS
void MD5Init(MD5_CTX *);
-void MD5Update(MD5_CTX *, const u_int8_t *, size_t)
+void MD5Update(MD5_CTX *, const void *, size_t)
__attribute__((__bounded__(__string__,2,3)));
void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
__attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));
diff --git a/sys/crypto/sha1.c b/sys/crypto/sha1.c
index c555bed77dc..8e624aeaf82 100644
--- a/sys/crypto/sha1.c
+++ b/sys/crypto/sha1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha1.c,v 1.9 2011/01/11 15:50:40 deraadt Exp $ */
+/* $OpenBSD: sha1.c,v 1.10 2014/11/16 17:39:09 tedu Exp $ */
/*
* SHA-1 in C
@@ -121,8 +121,9 @@ SHA1Init(SHA1_CTX *context)
/* Run your data through this. */
void
-SHA1Update(SHA1_CTX *context, const unsigned char *data, unsigned int len)
+SHA1Update(SHA1_CTX *context, const void *dataptr, unsigned int len)
{
+ const uint8_t *data = dataptr;
unsigned int i;
unsigned int j;
@@ -153,9 +154,9 @@ SHA1Final(unsigned char digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context)
finalcount[i] = (unsigned char)((context->count >>
((7 - (i & 7)) * 8)) & 255); /* Endian independent */
}
- SHA1Update(context, (unsigned char *)"\200", 1);
+ SHA1Update(context, "\200", 1);
while ((context->count & 504) != 448) {
- SHA1Update(context, (unsigned char *)"\0", 1);
+ SHA1Update(context, "\0", 1);
}
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
diff --git a/sys/crypto/sha1.h b/sys/crypto/sha1.h
index ee31467cc7a..66171aba5d5 100644
--- a/sys/crypto/sha1.h
+++ b/sys/crypto/sha1.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha1.h,v 1.5 2007/09/10 22:19:42 henric Exp $ */
+/* $OpenBSD: sha1.h,v 1.6 2014/11/16 17:39:09 tedu Exp $ */
/*
* SHA-1 in C
@@ -20,7 +20,7 @@ typedef struct {
void SHA1Init(SHA1_CTX * context);
void SHA1Transform(u_int32_t state[5], const unsigned char buffer[SHA1_BLOCK_LENGTH]);
-void SHA1Update(SHA1_CTX *context, const unsigned char *data, unsigned int len);
+void SHA1Update(SHA1_CTX *context, const void *data, unsigned int len);
void SHA1Final(unsigned char digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context);
#endif /* _SHA1_H_ */
diff --git a/sys/crypto/sha2.c b/sys/crypto/sha2.c
index 01a8e4d1bfe..9648c308a1f 100644
--- a/sys/crypto/sha2.c
+++ b/sys/crypto/sha2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha2.c,v 1.8 2011/01/11 15:42:05 deraadt Exp $ */
+/* $OpenBSD: sha2.c,v 1.9 2014/11/16 17:39:09 tedu Exp $ */
/*
* FILE: sha2.c
@@ -444,8 +444,9 @@ SHA256Transform(SHA2_CTX *context, const u_int8_t *data)
#endif /* SHA2_UNROLL_TRANSFORM */
void
-SHA256Update(SHA2_CTX *context, const u_int8_t *data, size_t len)
+SHA256Update(SHA2_CTX *context, const void *dataptr, size_t len)
{
+ const uint8_t *data = dataptr;
size_t freespace, usedspace;
/* Calling with no data is valid (we do nothing) */
@@ -730,8 +731,9 @@ SHA512Transform(SHA2_CTX *context, const u_int8_t *data)
#endif /* SHA2_UNROLL_TRANSFORM */
void
-SHA512Update(SHA2_CTX *context, const u_int8_t *data, size_t len)
+SHA512Update(SHA2_CTX *context, const void *dataptr, size_t len)
{
+ const uint8_t *data = dataptr;
size_t freespace, usedspace;
/* Calling with no data is valid (we do nothing) */
@@ -861,9 +863,9 @@ SHA384Init(SHA2_CTX *context)
}
void
-SHA384Update(SHA2_CTX *context, const u_int8_t *data, size_t len)
+SHA384Update(SHA2_CTX *context, const void *data, size_t len)
{
- SHA512Update((SHA2_CTX *)context, data, len);
+ SHA512Update(context, data, len);
}
void
diff --git a/sys/crypto/sha2.h b/sys/crypto/sha2.h
index 6bbdb80b79e..461b49b9810 100644
--- a/sys/crypto/sha2.h
+++ b/sys/crypto/sha2.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha2.h,v 1.4 2012/12/05 23:20:15 deraadt Exp $ */
+/* $OpenBSD: sha2.h,v 1.5 2014/11/16 17:39:09 tedu Exp $ */
/*
* FILE: sha2.h
@@ -62,19 +62,19 @@ typedef struct _SHA2_CTX {
__BEGIN_DECLS
void SHA256Init(SHA2_CTX *);
-void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t)
+void SHA256Update(SHA2_CTX *, const void *, size_t)
__attribute__((__bounded__(__string__,2,3)));
void SHA256Final(u_int8_t[SHA256_DIGEST_LENGTH], SHA2_CTX *)
__attribute__((__bounded__(__minbytes__,1,SHA256_DIGEST_LENGTH)));
void SHA384Init(SHA2_CTX *);
-void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t)
+void SHA384Update(SHA2_CTX *, const void *, size_t)
__attribute__((__bounded__(__string__,2,3)));
void SHA384Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA2_CTX *)
__attribute__((__bounded__(__minbytes__,1,SHA384_DIGEST_LENGTH)));
void SHA512Init(SHA2_CTX *);
-void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t)
+void SHA512Update(SHA2_CTX *, const void *, size_t)
__attribute__((__bounded__(__string__,2,3)));
void SHA512Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA2_CTX *)
__attribute__((__bounded__(__minbytes__,1,SHA512_DIGEST_LENGTH)));