Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys pullup (approved by releng-1-5)
details: https://anonhg.NetBSD.org/src/rev/b7f68fef90f3
branches: netbsd-1-5
changeset: 489326:b7f68fef90f3
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Aug 31 14:50:22 2000 +0000
description:
pullup (approved by releng-1-5)
> repair DES on LP64. past code did not interoperate with non-LP64, due to
> incorrect computed results.
> remove unnecessary #ifdef/#define. sync with kame.
> cvs rdiff -r1.1 -r1.2 syssrc/sys/crypto/des/des.h \
> syssrc/sys/crypto/des/des_3cbc.c syssrc/sys/crypto/des/des_cbc.c \
> syssrc/sys/crypto/des/des_ecb.c syssrc/sys/crypto/des/des_locl.h \
> syssrc/sys/crypto/des/des_setkey.c
> cvs rdiff -r1.6 -r1.7 syssrc/sys/netinet6/esp_core.c (equivalent change)
diffstat:
sys/crypto/des/des.h | 212 ++++---------------------------------------
sys/crypto/des/des_3cbc.c | 9 +-
sys/crypto/des/des_cbc.c | 8 +-
sys/crypto/des/des_ecb.c | 7 +-
sys/crypto/des/des_locl.h | 105 +---------------------
sys/crypto/des/des_setkey.c | 13 +-
sys/netinet6/esp_core.c | 22 ++--
7 files changed, 58 insertions(+), 318 deletions(-)
diffs (truncated from 565 to 300 lines):
diff -r c0d31cbf5ad4 -r b7f68fef90f3 sys/crypto/des/des.h
--- a/sys/crypto/des/des.h Thu Aug 31 14:49:46 2000 +0000
+++ b/sys/crypto/des/des.h Thu Aug 31 14:50:22 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: des.h,v 1.1.1.1 2000/06/14 19:45:35 thorpej Exp $ */
-/* $KAME: des.h,v 1.4 2000/06/14 10:41:17 itojun Exp $ */
+/* $NetBSD: des.h,v 1.1.1.1.2.1 2000/08/31 14:50:22 itojun Exp $ */
+/* $KAME: des.h,v 1.5 2000/08/31 07:27:26 itojun Exp $ */
/* lib/des/des.h */
/* Copyright (C) 1995-1996 Eric Young (eay%mincom.oz.au@localhost)
@@ -55,11 +55,8 @@
extern "C" {
#endif
-/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
- * %20 speed up (longs are 8 bytes, int's are 4). */
-#ifndef DES_LONG
-#define DES_LONG unsigned long
-#endif
+/* must be 32bit quantity */
+#define DES_LONG u_int32_t
typedef unsigned char des_cblock[8];
typedef struct des_ks_struct
@@ -83,196 +80,29 @@
#define DES_CBC_MODE 0
#define DES_PCBC_MODE 1
-#define des_ecb2_encrypt(i,o,k1,k2,e) \
- des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
-
-#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
- des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
-
-#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
- des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
-
-#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
- des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
-
-#define C_Block des_cblock
-#define Key_schedule des_key_schedule
-#ifdef KERBEROS
-#define ENCRYPT DES_ENCRYPT
-#define DECRYPT DES_DECRYPT
-#endif
-#define KEY_SZ DES_KEY_SZ
-#define string_to_key des_string_to_key
-#define read_pw_string des_read_pw_string
-#define random_key des_random_key
-#define pcbc_encrypt des_pcbc_encrypt
-#define set_key des_set_key
-#define key_sched des_key_sched
-#define ecb_encrypt des_ecb_encrypt
-#define cbc_encrypt des_cbc_encrypt
-#define ncbc_encrypt des_ncbc_encrypt
-#define xcbc_encrypt des_xcbc_encrypt
-#define cbc_cksum des_cbc_cksum
-#define quad_cksum des_quad_cksum
-
-/* For compatibility with the MIT lib - eay 20/05/92 */
-typedef des_key_schedule bit_64;
-#define des_fixup_key_parity des_set_odd_parity
-#define des_check_key_parity check_parity
-
extern int des_check_key; /* defaults to false */
-extern int des_rw_mode; /* defaults to DES_PCBC_MODE */
/* The next line is used to disable full ANSI prototypes, if your
* compiler has problems with the prototypes, make sure this line always
* evaluates to true :-) */
-#if defined(MSDOS) || defined(__STDC__)
-#undef NOPROTO
-#endif
-#ifndef NOPROTO
-char *des_options(void);
-void des_ecb3_encrypt(des_cblock *input,des_cblock *output,
- des_key_schedule ks1,des_key_schedule ks2,
- des_key_schedule ks3, int enc);
-DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output,
- long length,des_key_schedule schedule,des_cblock *ivec);
-/*
-void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length,
- des_key_schedule schedule,des_cblock *ivec,int enc);
-*/
-int des_cbc_encrypt(struct mbuf *, size_t, size_t,
- des_key_schedule schedule,des_cblock *ivec, int enc);
-void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length,
- des_key_schedule schedule,des_cblock *ivec,int enc);
-void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length,
- des_key_schedule schedule,des_cblock *ivec,
- des_cblock *inw,des_cblock *outw,int enc);
-void des_3cbc_encrypt(des_cblock *input,des_cblock *output,long length,
- des_key_schedule sk1,des_key_schedule sk2,
- des_cblock *ivec1,des_cblock *ivec2,int enc);
-extern int des_3cbc_process(struct mbuf *, size_t, size_t,
- des_key_schedule *schedule, des_cblock *ivec, int mode);
-void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
- long length,des_key_schedule schedule,des_cblock *ivec,int enc);
-void des_ecb_encrypt(des_cblock *input,des_cblock *output,
- des_key_schedule ks,int enc);
-void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc);
-void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc);
-void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output,
- long length, des_key_schedule ks1, des_key_schedule ks2,
- des_key_schedule ks3, des_cblock *ivec, int enc);
-void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
- long length, des_key_schedule ks1, des_key_schedule ks2,
- des_key_schedule ks3, des_cblock *ivec, int *num, int encrypt);
-void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
- long length, des_key_schedule ks1, des_key_schedule ks2,
- des_key_schedule ks3, des_cblock *ivec, int *num);
+char *des_options __P((void));
+struct mbuf;
+int des_cbc_encrypt __P((struct mbuf *, size_t, size_t,
+ des_key_schedule, des_cblock *, int));
+void des_3cbc_encrypt __P((des_cblock *, des_cblock *, long,
+ des_key_schedule, des_key_schedule,
+ des_cblock *, des_cblock *, int));
+extern int des_3cbc_process __P((struct mbuf *, size_t, size_t,
+ des_key_schedule *, des_cblock *, int));
+void des_ecb_encrypt __P((des_cblock *, des_cblock *,
+ des_key_schedule, int));
+void des_encrypt __P((DES_LONG *, des_key_schedule, int));
+void des_encrypt2 __P((DES_LONG *, des_key_schedule, int));
-int des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
- des_cblock *iv);
-int des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
- des_cblock *iv);
-#ifdef PERL5
-char *des_crypt(const char *buf,const char *salt);
-#else
-/* some stupid compilers complain because I have declared char instead
- * of const char */
-#if 1
-char *crypt(const char *buf,const char *salt);
-#else
-char *crypt();
-#endif
-#endif
-void des_ofb_encrypt(unsigned char *in,unsigned char *out,
- int numbits,long length,des_key_schedule schedule,des_cblock *ivec);
-void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length,
- des_key_schedule schedule,des_cblock *ivec,int enc);
-DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output,
- long length,int out_count,des_cblock *seed);
-void des_random_seed(des_cblock key);
-void des_random_key(des_cblock ret);
-int des_read_password(des_cblock *key,char *prompt,int verify);
-int des_read_2passwords(des_cblock *key1,des_cblock *key2,
- char *prompt,int verify);
-int des_read_pw_string(char *buf,int length,char *prompt,int verify);
-void des_set_odd_parity(des_cblock *key);
-int des_is_weak_key(des_cblock *key);
-int des_set_key(des_cblock *key,des_key_schedule schedule);
-int des_key_sched(des_cblock *key,des_key_schedule schedule);
-void des_string_to_key(char *str,des_cblock *key);
-void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2);
-void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
- des_key_schedule schedule, des_cblock *ivec, int *num, int enc);
-void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
- des_key_schedule schedule, des_cblock *ivec, int *num);
-
-/* Extra functions from Mark Murray <mark%grondar.za@localhost> */
-/*
-void des_cblock_print_file(des_cblock *cb, FILE *fp);
-*/
-/* The following functions are not in the normal unix build or the
- * SSLeay build. When using the SSLeay build, use RAND_seed()
- * and RAND_bytes() instead. */
-int des_new_random_key(des_cblock *key);
-void des_init_random_number_generator(des_cblock *key);
-void des_set_random_generator_seed(des_cblock *key);
-void des_set_sequence_number(des_cblock new_sequence_number);
-void des_generate_random_block(des_cblock *block);
-
-#else
-
-char *des_options();
-void des_ecb3_encrypt();
-DES_LONG des_cbc_cksum();
-void des_cbc_encrypt();
-void des_ncbc_encrypt();
-void des_xcbc_encrypt();
-void des_3cbc_encrypt();
-void des_cfb_encrypt();
-void des_ede3_cfb64_encrypt();
-void des_ede3_ofb64_encrypt();
-void des_ecb_encrypt();
-void des_encrypt();
-void des_encrypt2();
-void des_ede3_cbc_encrypt();
-int des_enc_read();
-int des_enc_write();
-#ifdef PERL5
-char *des_crypt();
-#else
-char *crypt();
-#endif
-void des_ofb_encrypt();
-void des_pcbc_encrypt();
-DES_LONG des_quad_cksum();
-void des_random_seed();
-void des_random_key();
-int des_read_password();
-int des_read_2passwords();
-int des_read_pw_string();
-void des_set_odd_parity();
-int des_is_weak_key();
-int des_set_key();
-int des_key_sched();
-void des_string_to_key();
-void des_string_to_2keys();
-void des_cfb64_encrypt();
-void des_ofb64_encrypt();
-
-/* Extra functions from Mark Murray <mark%grondar.za@localhost> */
-void des_cblock_print_file();
-/* The following functions are not in the normal unix build or the
- * SSLeay build. When using the SSLeay build, use RAND_seed()
- * and RAND_bytes() instead. */
-#ifdef FreeBSD
-int des_new_random_key();
-void des_init_random_number_generator();
-void des_set_random_generator_seed();
-void des_set_sequence_number();
-void des_generate_random_block();
-#endif
-
-#endif
+void des_set_odd_parity __P((des_cblock *));
+int des_is_weak_key __P((des_cblock *));
+int des_set_key __P((des_cblock *, des_key_schedule));
+int des_key_sched __P((des_cblock *, des_key_schedule));
#ifdef __cplusplus
}
diff -r c0d31cbf5ad4 -r b7f68fef90f3 sys/crypto/des/des_3cbc.c
--- a/sys/crypto/des/des_3cbc.c Thu Aug 31 14:49:46 2000 +0000
+++ b/sys/crypto/des/des_3cbc.c Thu Aug 31 14:50:22 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: des_3cbc.c,v 1.1.1.1 2000/06/14 19:45:35 thorpej Exp $ */
-/* $KAME: des_3cbc.c,v 1.4 2000/06/14 10:41:17 itojun Exp $ */
+/* $NetBSD: des_3cbc.c,v 1.1.1.1.2.1 2000/08/31 14:50:22 itojun Exp $ */
+/* $KAME: des_3cbc.c,v 1.5 2000/08/31 07:27:26 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -32,6 +32,11 @@
/*
* based on sys/crypto/des/des_cbc.c, rewrote by Tomomi Suzuki
*/
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
#include <crypto/des/des_locl.h>
#define panic(x) do { printf(x); return EINVAL; } while (0)
diff -r c0d31cbf5ad4 -r b7f68fef90f3 sys/crypto/des/des_cbc.c
--- a/sys/crypto/des/des_cbc.c Thu Aug 31 14:49:46 2000 +0000
+++ b/sys/crypto/des/des_cbc.c Thu Aug 31 14:50:22 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: des_cbc.c,v 1.1.1.1 2000/06/14 19:45:35 thorpej Exp $ */
-/* $KAME: des_cbc.c,v 1.4 2000/06/14 10:41:17 itojun Exp $ */
+/* $NetBSD: des_cbc.c,v 1.1.1.1.2.1 2000/08/31 14:50:23 itojun Exp $ */
+/* $KAME: des_cbc.c,v 1.5 2000/08/31 07:27:27 itojun Exp $ */
/*
* heavily modified by Yoshifumi Nishida <nishida%sfc.wide.ad.jp@localhost>.
@@ -53,6 +53,10 @@
* [including the GNU Public Licence.]
*/
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
#include <crypto/des/des_locl.h>
#define panic(x) do {printf(x); return EINVAL;} while (0)
diff -r c0d31cbf5ad4 -r b7f68fef90f3 sys/crypto/des/des_ecb.c
--- a/sys/crypto/des/des_ecb.c Thu Aug 31 14:49:46 2000 +0000
+++ b/sys/crypto/des/des_ecb.c Thu Aug 31 14:50:22 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: des_ecb.c,v 1.1.1.1 2000/06/14 19:45:35 thorpej Exp $ */
-/* $KAME: des_ecb.c,v 1.3 2000/03/27 04:36:33 sumikawa Exp $ */
+/* $NetBSD: des_ecb.c,v 1.1.1.1.2.1 2000/08/31 14:50:23 itojun Exp $ */
+/* $KAME: des_ecb.c,v 1.4 2000/08/31 07:27:27 itojun Exp $ */
/* crypto/des/ecb_enc.c */
/* Copyright (C) 1995-1996 Eric Young (eay%mincom.oz.au@localhost)
@@ -48,6 +48,9 @@
* [including the GNU Public Licence.]
*/
+#include <sys/param.h>
Home |
Main Index |
Thread Index |
Old Index