diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2013-03-27 16:42:06 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2013-03-27 16:42:06 +0000 |
commit | eabedd8d1f25f5c01cb625778cec758dc8b347aa (patch) | |
tree | 158b3ceeaf1ee72bf25d1370f88f1a9d7e19ca6b /sys | |
parent | c0ef88db78ac0786a1a05b9d4e146eb0ce275648 (diff) |
institute a hard cap on crypto devs instead of a useless wraparound check
ok beck
Diffstat (limited to 'sys')
-rw-r--r-- | sys/crypto/crypto.c | 5 | ||||
-rw-r--r-- | sys/crypto/cryptodev.h | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index 434c70309b2..7df0c435ae1 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.59 2011/01/11 15:42:05 deraadt Exp $ */ +/* $OpenBSD: crypto.c,v 1.60 2013/03/27 16:42:05 tedu Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -245,8 +245,7 @@ crypto_get_driverid(u_int8_t flags) /* Out of entries, allocate some more. */ if (i == crypto_drivers_num) { - /* Be careful about wrap-around. */ - if (2 * crypto_drivers_num <= crypto_drivers_num) { + if (crypto_drivers_num >= CRYPTO_DRIVERS_MAX) { splx(s); return -1; } diff --git a/sys/crypto/cryptodev.h b/sys/crypto/cryptodev.h index b7add969bc4..4f87046ec25 100644 --- a/sys/crypto/cryptodev.h +++ b/sys/crypto/cryptodev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.h,v 1.56 2012/06/29 14:48:04 mikeb Exp $ */ +/* $OpenBSD: cryptodev.h,v 1.57 2013/03/27 16:42:05 tedu Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -57,6 +57,7 @@ /* Some initial values */ #define CRYPTO_DRIVERS_INITIAL 4 +#define CRYPTO_DRIVERS_MAX 128 #define CRYPTO_SW_SESSIONS 32 /* HMAC values */ |