Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netkey as we use arc4random(9) for random number, we no ...



details:   https://anonhg.NetBSD.org/src/rev/e7117043b721
branches:  trunk
changeset: 569644:e7117043b721
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Aug 27 04:56:16 2004 +0000

description:
as we use arc4random(9) for random number, we no longer need to reseed random
number.  noted by rwatson@freebsd

diffstat:

 sys/netkey/key.c     |  25 ++-----------------------
 sys/netkey/key_var.h |   6 +++---
 2 files changed, 5 insertions(+), 26 deletions(-)

diffs (106 lines):

diff -r 6a7cc4ebc978 -r e7117043b721 sys/netkey/key.c
--- a/sys/netkey/key.c  Fri Aug 27 03:51:34 2004 +0000
+++ b/sys/netkey/key.c  Fri Aug 27 04:56:16 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.122 2004/08/03 15:53:03 itojun Exp $ */
+/*     $NetBSD: key.c,v 1.123 2004/08/27 04:56:16 itojun Exp $ */
 /*     $KAME: key.c,v 1.310 2003/09/08 02:23:44 itojun Exp $   */
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.122 2004/08/03 15:53:03 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.123 2004/08/27 04:56:16 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -129,13 +129,11 @@
 static u_int key_spi_trycnt = 1000;
 static u_int32_t key_spi_minval = 0x100;
 static u_int32_t key_spi_maxval = 0x0fffffff;  /* XXX */
-static u_int key_int_random = 60;      /*interval to initialize randseed,1(m)*/
 static u_int key_larval_lifetime = 30; /* interval to expire acquiring, 30(s)*/
 static int key_blockacq_count = 10;    /* counter for blocking SADB_ACQUIRE.*/
 static int key_blockacq_lifetime = 20; /* lifetime for blocking SADB_ACQUIRE.*/
 
 static u_int32_t acq_seq = 0;
-static int key_tick_init_random = 0;
 
 struct _satailq satailq;               /* list of all SAD entry */
 struct _sptailq sptailq;               /* SPD table + pcb */
@@ -388,7 +386,6 @@
        __P((struct secasindex *, struct secasindex *));
 static int key_sockaddrcmp __P((struct sockaddr *, struct sockaddr *, int));
 static int key_bbcmp __P((caddr_t, caddr_t, u_int));
-static void key_srandom __P((void));
 static u_long key_random __P((void));
 static u_int16_t key_satype2proto __P((u_int8_t));
 static u_int8_t key_proto2satype __P((u_int16_t));
@@ -4582,12 +4579,6 @@
        }
     }
 
-       /* initialize random seed */
-       if (key_tick_init_random++ > key_int_random) {
-               key_tick_init_random = 0;
-               key_srandom();
-       }
-
        callout_reset(&key_timehandler_ch, hz, key_timehandler, (void *)0);
 
        splx(s);
@@ -4597,13 +4588,6 @@
 /*
  * to initialize a seed for random()
  */
-static void
-key_srandom()
-{
-
-       return;
-}
-
 static u_long
 key_random()
 {
@@ -7947,11 +7931,6 @@
                       CTL_NET, PF_KEY, KEYCTL_SPI_MAX_VALUE, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                      CTLTYPE_INT, "random_int", NULL,
-                      NULL, 0, &key_int_random, 0,
-                      CTL_NET, PF_KEY, KEYCTL_RANDOM_INT, CTL_EOL);
-       sysctl_createv(clog, 0, NULL, NULL,
-                      CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_INT, "larval_lifetime", NULL,
                       NULL, 0, &key_larval_lifetime, 0,
                       CTL_NET, PF_KEY, KEYCTL_LARVAL_LIFETIME, CTL_EOL);
diff -r 6a7cc4ebc978 -r e7117043b721 sys/netkey/key_var.h
--- a/sys/netkey/key_var.h      Fri Aug 27 03:51:34 2004 +0000
+++ b/sys/netkey/key_var.h      Fri Aug 27 04:56:16 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key_var.h,v 1.14 2003/09/12 07:38:11 itojun Exp $      */
+/*     $NetBSD: key_var.h,v 1.15 2004/08/27 04:56:16 itojun Exp $      */
 /*     $KAME: key_var.h,v 1.12 2001/11/06 03:48:29 itojun Exp $        */
 
 /*
@@ -44,7 +44,7 @@
 #define KEYCTL_SPI_TRY                 2
 #define KEYCTL_SPI_MIN_VALUE           3
 #define KEYCTL_SPI_MAX_VALUE           4
-#define KEYCTL_RANDOM_INT              5
+/*#define KEYCTL_RANDOM_INT            5*/
 #define KEYCTL_LARVAL_LIFETIME         6
 #define KEYCTL_BLOCKACQ_COUNT          7
 #define KEYCTL_BLOCKACQ_LIFETIME       8
@@ -62,7 +62,7 @@
        { "spi_try", CTLTYPE_INT }, \
        { "spi_min_value", CTLTYPE_INT }, \
        { "spi_max_value", CTLTYPE_INT }, \
-       { "random_int", CTLTYPE_INT }, \
+       { 0, 0 /* "random_int", CTLTYPE_INT */ }, \
        { "larval_lifetime", CTLTYPE_INT }, \
        { "blockacq_count", CTLTYPE_INT }, \
        { "blockacq_lifetime", CTLTYPE_INT }, \



Home | Main Index | Thread Index | Old Index