Some const poisoning.

This commit is contained in:
thorpej 2003-08-27 00:20:56 +00:00
parent 538c811bc6
commit 7e87fbb23b
6 changed files with 47 additions and 47 deletions

View File

@ -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 $ */ /* $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 $ */ /* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */
@ -24,7 +24,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -37,7 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.7 2003/08/26 15:03:26 thorpej Exp $
#include <opencrypto/cryptosoft.h> #include <opencrypto/cryptosoft.h>
#include <opencrypto/xform.h> #include <opencrypto/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, 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 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, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,

View File

@ -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 $ */ /* $OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */
/* /*
@ -58,8 +58,8 @@ struct swcr_data {
}; };
#ifdef _KERNEL #ifdef _KERNEL
extern u_int8_t hmac_ipad_buffer[64]; extern const u_int8_t hmac_ipad_buffer[64];
extern u_int8_t hmac_opad_buffer[64]; extern const u_int8_t hmac_opad_buffer[64];
void swcr_init(void); void swcr_init(void);
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -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 $ */ /* $OpenBSD: skipjack.c,v 1.3 2001/05/05 00:31:34 angelos Exp $ */
/* /*
@ -15,7 +15,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <opencrypto/skipjack.h> #include <opencrypto/skipjack.h>
@ -67,7 +67,7 @@ static const u_int8_t ftable[0x100] =
* k0, k1..k9 * k0, k1..k9
*/ */
void 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; int i, k;

View File

@ -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 $ */ /* $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_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 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);

View File

@ -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 $ */ /* $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 $ */ /* $OpenBSD: xform.c,v 1.19 2002/08/16 22:47:25 dhartmei Exp $ */
@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -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_encrypt(caddr_t, u_int8_t *);
static void null_decrypt(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 void null_zerokey(u_int8_t **);
static int des1_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 **, u_int8_t *, int); static int des3_setkey(u_int8_t **, const u_int8_t *, int);
static int blf_setkey(u_int8_t **, u_int8_t *, int); static int blf_setkey(u_int8_t **, const u_int8_t *, int);
static int cast5_setkey(u_int8_t **, u_int8_t *, int); static int cast5_setkey(u_int8_t **, const u_int8_t *, int);
static int skipjack_setkey(u_int8_t **, u_int8_t *, int); static int skipjack_setkey(u_int8_t **, const u_int8_t *, int);
static int rijndael128_setkey(u_int8_t **, 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 des1_encrypt(caddr_t, u_int8_t *);
static void des3_encrypt(caddr_t, u_int8_t *); static void des3_encrypt(caddr_t, u_int8_t *);
static void blf_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 rijndael128_zerokey(u_int8_t **);
static void null_init(void *); 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 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 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 void SHA1Final_int(u_int8_t *, void *);
static int RMD160Update_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 *, 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 void SHA1Final_int(u_int8_t *, void *);
static int RMD160Update_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 *, u_int8_t *, u_int16_t); static int SHA256Update_int(void *, const u_int8_t *, u_int16_t);
static int SHA384Update_int(void *, u_int8_t *, u_int16_t); static int SHA384Update_int(void *, const u_int8_t *, u_int16_t);
static int SHA512Update_int(void *, 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_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 **); 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 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; *sched = NULL;
return 0; return 0;
@ -317,7 +317,7 @@ des1_decrypt(caddr_t key, u_int8_t *blk)
} }
static int 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; des_key_schedule *p;
int err; int err;
@ -361,7 +361,7 @@ des3_decrypt(caddr_t key, u_int8_t *blk)
} }
static int 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; des_key_schedule *p;
int err; int err;
@ -411,7 +411,7 @@ blf_decrypt(caddr_t key, u_int8_t *blk)
} }
static int 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; int err;
@ -457,7 +457,7 @@ cast5_decrypt(caddr_t key, u_int8_t *blk)
} }
static int 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; int err;
@ -493,7 +493,7 @@ skipjack_decrypt(caddr_t key, u_int8_t *blk)
} }
static int 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; int err;
@ -545,7 +545,7 @@ rijndael128_decrypt(caddr_t key, u_int8_t *blk)
} }
static int 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; int err;
@ -580,7 +580,7 @@ null_init(void *ctx)
} }
static int 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; return 0;
} }
@ -593,14 +593,14 @@ null_final(u_int8_t *buf, void *ctx)
} }
static int 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); RMD160Update(ctx, buf, len);
return 0; return 0;
} }
static int 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); MD5Update(ctx, buf, len);
return 0; return 0;
@ -613,7 +613,7 @@ SHA1Init_int(void *ctx)
} }
static int 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); SHA1Update(ctx, buf, len);
return 0; return 0;
@ -626,21 +626,21 @@ SHA1Final_int(u_int8_t *blk, void *ctx)
} }
static int 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); SHA256_Update(ctx, buf, len);
return 0; return 0;
} }
static int 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); SHA384_Update(ctx, buf, len);
return 0; return 0;
} }
static int 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); SHA512_Update(ctx, buf, len);
return 0; return 0;

View File

@ -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 $ */ /* $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 $ */ /* $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 authsize;
u_int16_t ctxsize; u_int16_t ctxsize;
void (*Init) (void *); 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 *); void (*Final) (u_int8_t *, void *);
}; };
@ -54,7 +54,7 @@ struct enc_xform {
u_int16_t minkey, maxkey; u_int16_t minkey, maxkey;
void (*encrypt) (caddr_t, u_int8_t *); void (*encrypt) (caddr_t, u_int8_t *);
void (*decrypt) (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 **); void (*zerokey) (u_int8_t **);
}; };