summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-06-04 18:38:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-06-04 18:38:13 +0000
commitf865dd3621cdaa5d9c4266ba12affc94f4d2b67f (patch)
treeec8e2d2f459f0cf77a4e89a3366983536e9d0308 /sys
parent3a2ff73ac44848cf8a388fd5ce45404fabc866fa (diff)
use a faster arc4random() for random spi generation; angelos@ ok
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_ipsp.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index fdb28b94d7d..6af2bfd77b4 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.124 2001/06/01 08:18:27 angelos Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.125 2001/06/04 18:38:12 mickey Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -216,10 +216,7 @@ reserve_spi(u_int32_t sspi, u_int32_t tspi, union sockaddr_union *src,
if (sspi == tspi) /* Specific SPI asked */
spi = tspi;
else /* Range specified */
- {
- get_random_bytes((void *) &spi, sizeof(spi));
- spi = sspi + (spi % (tspi - sspi));
- }
+ spi = sspi + (arc4random() % (tspi - sspi));
/* Don't allocate reserved SPIs. */
if (spi >= SPI_RESERVED_MIN && spi <= SPI_RESERVED_MAX)