Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Mar 2014 01:45:47 +0000 (UTC)
From:      John-Mark Gurney <jmg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262994 - head/sys/opencrypto
Message-ID:  <201403110145.s2B1jlTv084357@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmg
Date: Tue Mar 11 01:45:46 2014
New Revision: 262994
URL: http://svnweb.freebsd.org/changeset/base/262994

Log:
  allow the kern.cryptodevallowsoft sysctl to enable symetric/hashes too...
  This will allow us to more easily test the software versions of these
  routines...
  
  Considering that we've never had an software asymetric implmentation,
  it's doubtful anyone has this enabled...

Modified:
  head/sys/opencrypto/crypto.c
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/crypto.c
==============================================================================
--- head/sys/opencrypto/crypto.c	Tue Mar 11 01:41:09 2014	(r262993)
+++ head/sys/opencrypto/crypto.c	Tue Mar 11 01:45:46 2014	(r262994)
@@ -161,10 +161,10 @@ int	crypto_userasymcrypto = 1;	/* userla
 SYSCTL_INT(_kern, OID_AUTO, userasymcrypto, CTLFLAG_RW,
 	   &crypto_userasymcrypto, 0,
 	   "Enable/disable user-mode access to asymmetric crypto support");
-int	crypto_devallowsoft = 0;	/* only use hardware crypto for asym */
+int	crypto_devallowsoft = 0;	/* only use hardware crypto */
 SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RW,
 	   &crypto_devallowsoft, 0,
-	   "Enable/disable use of software asym crypto support");
+	   "Enable/disable use of software crypto by /dev/crypto");
 
 MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records");
 

Modified: head/sys/opencrypto/cryptodev.c
==============================================================================
--- head/sys/opencrypto/cryptodev.c	Tue Mar 11 01:41:09 2014	(r262993)
+++ head/sys/opencrypto/cryptodev.c	Tue Mar 11 01:45:46 2014	(r262994)
@@ -351,11 +351,14 @@ cryptof_truncate(
 static int
 checkforsoftware(int crid)
 {
-	if (crid & CRYPTOCAP_F_SOFTWARE)
-		return EINVAL;		/* XXX */
-	if ((crid & CRYPTOCAP_F_HARDWARE) == 0 &&
-	    (crypto_getcaps(crid) & CRYPTOCAP_F_HARDWARE) == 0)
-		return EINVAL;		/* XXX */
+
+	if (!crypto_devallowsoft) {
+		if (crid & CRYPTOCAP_F_SOFTWARE)
+			return EINVAL;		/* XXX */
+		if ((crid & CRYPTOCAP_F_HARDWARE) == 0 &&
+		    (crypto_getcaps(crid) & CRYPTOCAP_F_HARDWARE) == 0)
+			return EINVAL;		/* XXX */
+	}
 	return 0;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403110145.s2B1jlTv084357>