diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2002-03-01 02:52:52 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2002-03-01 02:52:52 +0000 |
commit | 5e69b34008a2ba0fb009781c1aa5d04e65e27147 (patch) | |
tree | df6a27852a6763e475b6ac15843424e98407d801 /sys | |
parent | 618d6f2d4a17203d404c76d4e1faef2f2e8a022c (diff) |
sysctl for cryptodevallowsoft - /dev/crypto will allow the software engine
to be used if there are no hardware cards. mostly for debugging and
regression.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/crypto/cryptodev.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 6 | ||||
-rw-r--r-- | sys/sys/sysctl.h | 6 |
3 files changed, 13 insertions, 5 deletions
diff --git a/sys/crypto/cryptodev.c b/sys/crypto/cryptodev.c index ee1073fb375..9ff8334d5d7 100644 --- a/sys/crypto/cryptodev.c +++ b/sys/crypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.c,v 1.30 2002/02/23 08:07:59 deraadt Exp $ */ +/* $OpenBSD: cryptodev.c,v 1.31 2002/03/01 02:52:51 provos Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -113,6 +113,7 @@ int csefree(struct csession *); int crypto_op(struct csession *, struct crypt_op *, struct proc *); int usercrypto = 1; /* userland may do crypto requests */ +int cryptodevallowsoft = 0; /* only use hardware crypto */ /* ARGSUSED */ int @@ -244,7 +245,8 @@ cryptof_ioctl(fp, cmd, data, p) goto bail; } - error = crypto_newsession(&sid, (txform ? &crie : &cria), 1); + error = crypto_newsession(&sid, (txform ? &crie : &cria), + !cryptodevallowsoft); bail: if (error) { diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index edf544e207e..8bb61b8c666 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.61 2002/02/23 08:11:05 deraadt Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.62 2002/03/01 02:52:51 provos Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -248,6 +248,7 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) extern int stackgap_random; #ifdef CRYPTO extern int usercrypto; + extern int cryptodevallowsoft; #endif /* all sysctl names at this level are terminal */ @@ -429,6 +430,9 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) #ifdef CRYPTO case KERN_USERCRYPTO: return (sysctl_int(oldp, oldlenp, newp, newlen, &usercrypto)); + case KERN_CRYPTODEVALLOWSOFT: + return (sysctl_int(oldp, oldlenp, newp, newlen, + &cryptodevallowsoft)); #endif default: return (EOPNOTSUPP); diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 901cc156ebc..3726626401a 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.h,v 1.45 2002/02/23 08:07:59 deraadt Exp $ */ +/* $OpenBSD: sysctl.h,v 1.46 2002/03/01 02:52:51 provos Exp $ */ /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */ /* @@ -166,7 +166,8 @@ struct ctlname { #define KERN_STACKGAPRANDOM 50 /* int: stackgap_random */ #define KERN_SYSVIPC_INFO 51 /* struct: SysV sem/shm/msg info */ #define KERN_USERCRYPTO 52 /* int: usercrypto */ -#define KERN_MAXID 53 /* number of valid kern ids */ +#define KERN_CRYPTODEVALLOWSOFT 53 /* int: cryptodevallowsoft */ +#define KERN_MAXID 54 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ @@ -222,6 +223,7 @@ struct ctlname { { "stackgap_random", CTLTYPE_INT }, \ { "sysvipc_info", CTLTYPE_INT }, \ { "usercrypto", CTLTYPE_INT }, \ + { "cryptodevallowsoft", CTLTYPE_INT }, \ } /* |