summaryrefslogtreecommitdiff
path: root/sys/crypto
diff options
context:
space:
mode:
authorHenric Jungheim <henric@cvs.openbsd.org>2007-09-10 22:19:43 +0000
committerHenric Jungheim <henric@cvs.openbsd.org>2007-09-10 22:19:43 +0000
commit744ccd1f3c568ba9fe2b0e7ed2f4276f452f3d03 (patch)
tree6e9b618a45a8669cbbe47c04bd8dc760a64cdf75 /sys/crypto
parent3b428e6c73860ae6c1adb47ca0a84a733f516c2c (diff)
Make the hmac ipad/opad globals "const" and fixup the crypto functions
to match. ok deraadt@
Diffstat (limited to 'sys/crypto')
-rw-r--r--sys/crypto/cryptosoft.c6
-rw-r--r--sys/crypto/cryptosoft.h6
-rw-r--r--sys/crypto/sha1.c6
-rw-r--r--sys/crypto/sha1.h6
-rw-r--r--sys/crypto/xform.c26
-rw-r--r--sys/crypto/xform.h4
6 files changed, 27 insertions, 27 deletions
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c
index 470d2c73ca0..0a42e570d6c 100644
--- a/sys/crypto/cryptosoft.c
+++ b/sys/crypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.c,v 1.46 2006/12/29 13:04:37 pedro Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.47 2007/09/10 22:19:42 henric Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -38,7 +38,7 @@
#include <crypto/cryptosoft.h>
#include <crypto/xform.h>
-u_int8_t hmac_ipad_buffer[64] = {
+const u_int8_t hmac_ipad_buffer[64] = {
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
@@ -49,7 +49,7 @@ u_int8_t hmac_ipad_buffer[64] = {
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36
};
-u_int8_t hmac_opad_buffer[64] = {
+const u_int8_t hmac_opad_buffer[64] = {
0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
diff --git a/sys/crypto/cryptosoft.h b/sys/crypto/cryptosoft.h
index 7a98cbb9e5e..b5764fc8830 100644
--- a/sys/crypto/cryptosoft.h
+++ b/sys/crypto/cryptosoft.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */
+/* $OpenBSD: cryptosoft.h,v 1.11 2007/09/10 22:19:42 henric Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -57,8 +57,8 @@ struct swcr_data {
};
#ifdef _KERNEL
-extern u_int8_t hmac_ipad_buffer[64];
-extern u_int8_t hmac_opad_buffer[64];
+extern const u_int8_t hmac_ipad_buffer[64];
+extern const u_int8_t hmac_opad_buffer[64];
int swcr_encdec(struct cryptodesc *, struct swcr_data *, caddr_t, int);
int swcr_authcompute(struct cryptop *, struct cryptodesc *, struct swcr_data *,
diff --git a/sys/crypto/sha1.c b/sys/crypto/sha1.c
index 211d804c45c..d50ecf6d30e 100644
--- a/sys/crypto/sha1.c
+++ b/sys/crypto/sha1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha1.c,v 1.7 2007/07/20 19:54:01 otto Exp $ */
+/* $OpenBSD: sha1.c,v 1.8 2007/09/10 22:19:42 henric Exp $ */
/*
* SHA-1 in C
@@ -47,7 +47,7 @@
/* Hash a single 512-bit block. This is the core of the algorithm. */
void
-SHA1Transform(u_int32_t state[5], unsigned char buffer[SHA1_BLOCK_LENGTH])
+SHA1Transform(u_int32_t state[5], const unsigned char buffer[SHA1_BLOCK_LENGTH])
{
u_int32_t a, b, c, d, e;
typedef union {
@@ -121,7 +121,7 @@ SHA1Init(SHA1_CTX *context)
/* Run your data through this. */
void
-SHA1Update(SHA1_CTX *context, unsigned char *data, unsigned int len)
+SHA1Update(SHA1_CTX *context, const unsigned char *data, unsigned int len)
{
unsigned int i;
unsigned int j;
diff --git a/sys/crypto/sha1.h b/sys/crypto/sha1.h
index b4a489f74fc..ee31467cc7a 100644
--- a/sys/crypto/sha1.h
+++ b/sys/crypto/sha1.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha1.h,v 1.4 2004/04/28 20:39:35 hshoexer Exp $ */
+/* $OpenBSD: sha1.h,v 1.5 2007/09/10 22:19:42 henric Exp $ */
/*
* SHA-1 in C
@@ -19,8 +19,8 @@ typedef struct {
} SHA1_CTX;
void SHA1Init(SHA1_CTX * context);
-void SHA1Transform(u_int32_t state[5], unsigned char buffer[SHA1_BLOCK_LENGTH]);
-void SHA1Update(SHA1_CTX *context, unsigned char *data, unsigned int len);
+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 SHA1Final(unsigned char digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context);
#endif /* _SHA1_H_ */
diff --git a/sys/crypto/xform.c b/sys/crypto/xform.c
index 080fe302720..6970fb030c2 100644
--- a/sys/crypto/xform.c
+++ b/sys/crypto/xform.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xform.c,v 1.31 2007/05/27 05:43:17 tedu Exp $ */
+/* $OpenBSD: xform.c,v 1.32 2007/09/10 22:19:42 henric Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -95,12 +95,12 @@ void null_decrypt(caddr_t, u_int8_t *);
void aes_ctr_reinit(caddr_t, u_int8_t *);
void aes_ctr_crypt(caddr_t, u_int8_t *);
-int MD5Update_int(void *, u_int8_t *, u_int16_t);
-int SHA1Update_int(void *, u_int8_t *, u_int16_t);
-int RMD160Update_int(void *, u_int8_t *, u_int16_t);
-int SHA256_Update_int(void *, u_int8_t *, u_int16_t);
-int SHA384_Update_int(void *, u_int8_t *, u_int16_t);
-int SHA512_Update_int(void *, u_int8_t *, u_int16_t);
+int MD5Update_int(void *, const u_int8_t *, u_int16_t);
+int SHA1Update_int(void *, const u_int8_t *, u_int16_t);
+int RMD160Update_int(void *, const u_int8_t *, u_int16_t);
+int SHA256_Update_int(void *, const u_int8_t *, u_int16_t);
+int SHA384_Update_int(void *, const u_int8_t *, u_int16_t);
+int SHA512_Update_int(void *, const u_int8_t *, u_int16_t);
u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **);
u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **);
@@ -584,42 +584,42 @@ aes_ctr_zerokey(u_int8_t **sched)
*/
int
-RMD160Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
+RMD160Update_int(void *ctx, const u_int8_t *buf, u_int16_t len)
{
RMD160Update(ctx, buf, len);
return 0;
}
int
-MD5Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
+MD5Update_int(void *ctx, const u_int8_t *buf, u_int16_t len)
{
MD5Update(ctx, buf, len);
return 0;
}
int
-SHA1Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
+SHA1Update_int(void *ctx, const u_int8_t *buf, u_int16_t len)
{
SHA1Update(ctx, buf, len);
return 0;
}
int
-SHA256_Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
+SHA256_Update_int(void *ctx, const u_int8_t *buf, u_int16_t len)
{
SHA256_Update(ctx, buf, len);
return 0;
}
int
-SHA384_Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
+SHA384_Update_int(void *ctx, const u_int8_t *buf, u_int16_t len)
{
SHA384_Update(ctx, buf, len);
return 0;
}
int
-SHA512_Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
+SHA512_Update_int(void *ctx, const u_int8_t *buf, u_int16_t len)
{
SHA512_Update(ctx, buf, len);
return 0;
diff --git a/sys/crypto/xform.h b/sys/crypto/xform.h
index b2e19c99ed2..5a665cd1e9b 100644
--- a/sys/crypto/xform.h
+++ b/sys/crypto/xform.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xform.h,v 1.16 2005/05/25 05:47:53 markus Exp $ */
+/* $OpenBSD: xform.h,v 1.17 2007/09/10 22:19:42 henric Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -38,7 +38,7 @@ struct auth_hash {
u_int16_t authsize;
u_int16_t ctxsize;
void (*Init) (void *);
- int (*Update) (void *, u_int8_t *, u_int16_t);
+ int (*Update) (void *, const u_int8_t *, u_int16_t);
void (*Final) (u_int8_t *, void *);
};