From 7e87fbb23bf30aae2a0232a6adc2d09c0e7e156d Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 27 Aug 2003 00:20:56 +0000 Subject: [PATCH] Some const poisoning. --- sys/opencrypto/cryptosoft.c | 8 ++--- sys/opencrypto/cryptosoft.h | 6 ++-- sys/opencrypto/skipjack.c | 6 ++-- sys/opencrypto/skipjack.h | 4 +-- sys/opencrypto/xform.c | 64 ++++++++++++++++++------------------- sys/opencrypto/xform.h | 6 ++-- 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index c711ddcb9c81..7098f76b8333 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1,4 +1,4 @@ -/* $NetBSD: cryptosoft.c,v 1.7 2003/08/26 15:03:26 thorpej Exp $ */ +/* $NetBSD: cryptosoft.c,v 1.8 2003/08/27 00:20:56 thorpej Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */ /* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */ @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.7 2003/08/26 15:03:26 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.8 2003/08/27 00:20:56 thorpej Exp $"); #include #include @@ -37,7 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.7 2003/08/26 15:03:26 thorpej Exp $ #include #include -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, @@ -48,7 +48,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/opencrypto/cryptosoft.h b/sys/opencrypto/cryptosoft.h index 39e695a380c2..f7210c0fdd66 100644 --- a/sys/opencrypto/cryptosoft.h +++ b/sys/opencrypto/cryptosoft.h @@ -1,4 +1,4 @@ -/* $NetBSD: cryptosoft.h,v 1.1 2003/07/25 21:12:45 jonathan Exp $ */ +/* $NetBSD: cryptosoft.h,v 1.2 2003/08/27 00:20:56 thorpej Exp $ */ /* $OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */ /* @@ -58,8 +58,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]; void swcr_init(void); #endif /* _KERNEL */ diff --git a/sys/opencrypto/skipjack.c b/sys/opencrypto/skipjack.c index 93102168cedd..ecafc21a458e 100644 --- a/sys/opencrypto/skipjack.c +++ b/sys/opencrypto/skipjack.c @@ -1,4 +1,4 @@ -/* $NetBSD: skipjack.c,v 1.1 2003/07/25 21:12:48 jonathan Exp $ */ +/* $NetBSD: skipjack.c,v 1.2 2003/08/27 00:20:56 thorpej Exp $ */ /* $OpenBSD: skipjack.c,v 1.3 2001/05/05 00:31:34 angelos Exp $ */ /* @@ -15,7 +15,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: skipjack.c,v 1.1 2003/07/25 21:12:48 jonathan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: skipjack.c,v 1.2 2003/08/27 00:20:56 thorpej Exp $"); #include #include @@ -67,7 +67,7 @@ static const u_int8_t ftable[0x100] = * k0, k1..k9 */ void -subkey_table_gen (u_int8_t *key, u_int8_t **key_tables) +subkey_table_gen (const u_int8_t *key, u_int8_t **key_tables) { int i, k; diff --git a/sys/opencrypto/skipjack.h b/sys/opencrypto/skipjack.h index 4ba143a48cef..f8ccd794801c 100644 --- a/sys/opencrypto/skipjack.h +++ b/sys/opencrypto/skipjack.h @@ -1,4 +1,4 @@ -/* $NetBSD: skipjack.h,v 1.1 2003/07/25 21:12:48 jonathan Exp $ */ +/* $NetBSD: skipjack.h,v 1.2 2003/08/27 00:20:56 thorpej Exp $ */ /* $OpenBSD: skipjack.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */ /* @@ -16,4 +16,4 @@ extern void skipjack_forwards(u_int8_t *plain, u_int8_t *cipher, u_int8_t **key); extern void skipjack_backwards(u_int8_t *cipher, u_int8_t *plain, u_int8_t **key); -extern void subkey_table_gen(u_int8_t *key, u_int8_t **key_tables); +extern void subkey_table_gen(const u_int8_t *key, u_int8_t **key_tables); diff --git a/sys/opencrypto/xform.c b/sys/opencrypto/xform.c index a621ffafb750..bab55941f33c 100644 --- a/sys/opencrypto/xform.c +++ b/sys/opencrypto/xform.c @@ -1,4 +1,4 @@ -/* $NetBSD: xform.c,v 1.8 2003/08/27 00:05:28 thorpej Exp $ */ +/* $NetBSD: xform.c,v 1.9 2003/08/27 00:20:56 thorpej Exp $ */ /* $FreeBSD: src/sys/opencrypto/xform.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */ /* $OpenBSD: xform.c,v 1.19 2002/08/16 22:47:25 dhartmei Exp $ */ @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xform.c,v 1.8 2003/08/27 00:05:28 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform.c,v 1.9 2003/08/27 00:20:56 thorpej Exp $"); #include #include @@ -68,15 +68,15 @@ __KERNEL_RCSID(0, "$NetBSD: xform.c,v 1.8 2003/08/27 00:05:28 thorpej Exp $"); static void null_encrypt(caddr_t, u_int8_t *); static void null_decrypt(caddr_t, u_int8_t *); -static int null_setkey(u_int8_t **, u_int8_t *, int); +static int null_setkey(u_int8_t **, const u_int8_t *, int); static void null_zerokey(u_int8_t **); -static int des1_setkey(u_int8_t **, u_int8_t *, int); -static int des3_setkey(u_int8_t **, u_int8_t *, int); -static int blf_setkey(u_int8_t **, u_int8_t *, int); -static int cast5_setkey(u_int8_t **, u_int8_t *, int); -static int skipjack_setkey(u_int8_t **, u_int8_t *, int); -static int rijndael128_setkey(u_int8_t **, u_int8_t *, int); +static int des1_setkey(u_int8_t **, const u_int8_t *, int); +static int des3_setkey(u_int8_t **, const u_int8_t *, int); +static int blf_setkey(u_int8_t **, const u_int8_t *, int); +static int cast5_setkey(u_int8_t **, const u_int8_t *, int); +static int skipjack_setkey(u_int8_t **, const u_int8_t *, int); +static int rijndael128_setkey(u_int8_t **, const u_int8_t *, int); static void des1_encrypt(caddr_t, u_int8_t *); static void des3_encrypt(caddr_t, u_int8_t *); static void blf_encrypt(caddr_t, u_int8_t *); @@ -97,22 +97,22 @@ static void skipjack_zerokey(u_int8_t **); static void rijndael128_zerokey(u_int8_t **); static void null_init(void *); -static int null_update(void *, u_int8_t *, u_int16_t); +static int null_update(void *, const u_int8_t *, u_int16_t); static void null_final(u_int8_t *, void *); -static int MD5Update_int(void *, u_int8_t *, u_int16_t); +static int MD5Update_int(void *, const u_int8_t *, u_int16_t); static void SHA1Init_int(void *); -static int SHA1Update_int(void *, u_int8_t *, u_int16_t); +static int SHA1Update_int(void *, const u_int8_t *, u_int16_t); static void SHA1Final_int(u_int8_t *, void *); -static int RMD160Update_int(void *, u_int8_t *, u_int16_t); -static int SHA1Update_int(void *, u_int8_t *, u_int16_t); +static int RMD160Update_int(void *, const u_int8_t *, u_int16_t); +static int SHA1Update_int(void *, const u_int8_t *, u_int16_t); static void SHA1Final_int(u_int8_t *, void *); -static int RMD160Update_int(void *, u_int8_t *, u_int16_t); -static int SHA256Update_int(void *, u_int8_t *, u_int16_t); -static int SHA384Update_int(void *, u_int8_t *, u_int16_t); -static int SHA512Update_int(void *, u_int8_t *, u_int16_t); +static int RMD160Update_int(void *, const u_int8_t *, u_int16_t); +static int SHA256Update_int(void *, const u_int8_t *, u_int16_t); +static int SHA384Update_int(void *, const u_int8_t *, u_int16_t); +static int SHA512Update_int(void *, const u_int8_t *, u_int16_t); static u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **); static u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **); @@ -287,7 +287,7 @@ null_decrypt(caddr_t key, u_int8_t *blk) { } static int -null_setkey(u_int8_t **sched, u_int8_t *key, int len) +null_setkey(u_int8_t **sched, const u_int8_t *key, int len) { *sched = NULL; return 0; @@ -317,7 +317,7 @@ des1_decrypt(caddr_t key, u_int8_t *blk) } static int -des1_setkey(u_int8_t **sched, u_int8_t *key, int len) +des1_setkey(u_int8_t **sched, const u_int8_t *key, int len) { des_key_schedule *p; int err; @@ -361,7 +361,7 @@ des3_decrypt(caddr_t key, u_int8_t *blk) } static int -des3_setkey(u_int8_t **sched, u_int8_t *key, int len) +des3_setkey(u_int8_t **sched, const u_int8_t *key, int len) { des_key_schedule *p; int err; @@ -411,7 +411,7 @@ blf_decrypt(caddr_t key, u_int8_t *blk) } static int -blf_setkey(u_int8_t **sched, u_int8_t *key, int len) +blf_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; @@ -457,7 +457,7 @@ cast5_decrypt(caddr_t key, u_int8_t *blk) } static int -cast5_setkey(u_int8_t **sched, u_int8_t *key, int len) +cast5_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; @@ -493,7 +493,7 @@ skipjack_decrypt(caddr_t key, u_int8_t *blk) } static int -skipjack_setkey(u_int8_t **sched, u_int8_t *key, int len) +skipjack_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; @@ -545,7 +545,7 @@ rijndael128_decrypt(caddr_t key, u_int8_t *blk) } static int -rijndael128_setkey(u_int8_t **sched, u_int8_t *key, int len) +rijndael128_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; @@ -580,7 +580,7 @@ null_init(void *ctx) } static int -null_update(void *ctx, u_int8_t *buf, u_int16_t len) +null_update(void *ctx, const u_int8_t *buf, u_int16_t len) { return 0; } @@ -593,14 +593,14 @@ null_final(u_int8_t *buf, void *ctx) } static 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; } static 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; @@ -613,7 +613,7 @@ SHA1Init_int(void *ctx) } static 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; @@ -626,21 +626,21 @@ SHA1Final_int(u_int8_t *blk, void *ctx) } static int -SHA256Update_int(void *ctx, u_int8_t *buf, u_int16_t len) +SHA256Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) { SHA256_Update(ctx, buf, len); return 0; } static int -SHA384Update_int(void *ctx, u_int8_t *buf, u_int16_t len) +SHA384Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) { SHA384_Update(ctx, buf, len); return 0; } static int -SHA512Update_int(void *ctx, u_int8_t *buf, u_int16_t len) +SHA512Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) { SHA512_Update(ctx, buf, len); return 0; diff --git a/sys/opencrypto/xform.h b/sys/opencrypto/xform.h index e27db85b1dc3..7c22d28bef1a 100644 --- a/sys/opencrypto/xform.h +++ b/sys/opencrypto/xform.h @@ -1,4 +1,4 @@ -/* $NetBSD: xform.h,v 1.4 2003/08/26 02:54:11 thorpej Exp $ */ +/* $NetBSD: xform.h,v 1.5 2003/08/27 00:20:57 thorpej Exp $ */ /* $FreeBSD: src/sys/opencrypto/xform.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */ /* $OpenBSD: xform.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */ @@ -40,7 +40,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 *); }; @@ -54,7 +54,7 @@ struct enc_xform { u_int16_t minkey, maxkey; void (*encrypt) (caddr_t, u_int8_t *); void (*decrypt) (caddr_t, u_int8_t *); - int (*setkey) (u_int8_t **, u_int8_t *, int len); + int (*setkey) (u_int8_t **, const u_int8_t *, int len); void (*zerokey) (u_int8_t **); };