Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Nov 2014 00:14:12 GMT
From:      John-Mark Gurney <jmg@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 1202585 for review
Message-ID:  <201411070014.sA70ECLA008897@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1202585?ac=10

Change 1202585 by jmg@jmg_carbon2 on 2014/11/07 00:13:16

	improve the selection of the device...  If you ask for both
	_HARDWARE and _SOFTWARE devices, but software is disallowed
	per sysctl, silently remove _SOFTWARE... We'll still get an
	error if the _HARDWARE doesn't support it...
	
	This makes testing of both the hardware drivers and software
	drivers easier...  Most software will just set _HARDWARE and
	will continue to work...
	
	Sponsored by:	FreeBSD Foundation
	Sponsored by:	Netgate

Affected files ...

.. //depot/projects/opencrypto/sys/opencrypto/cryptodev.c#10 edit

Differences ...

==== //depot/projects/opencrypto/sys/opencrypto/cryptodev.c#10 (text+ko) ====

@@ -338,15 +338,23 @@
  * by device name/class or through search constraints.
  */
 static int
-checkforsoftware(int crid)
+checkforsoftware(int *cridp)
 {
+	int crid;
+
+	crid = *cridp;
 
 	if (!crypto_devallowsoft) {
-		if (crid & CRYPTOCAP_F_SOFTWARE)
-			return EINVAL;		/* XXX */
+		if (crid & CRYPTOCAP_F_SOFTWARE) {
+			if (crid & CRYPTOCAP_F_HARDWARE) {
+				*cridp = CRYPTOCAP_F_HARDWARE;
+				return 0;
+			}
+			return EINVAL;
+		}
 		if ((crid & CRYPTOCAP_F_HARDWARE) == 0 &&
 		    (crypto_getcaps(crid) & CRYPTOCAP_F_HARDWARE) == 0)
-			return EINVAL;		/* XXX */
+			return EINVAL;
 	}
 	return 0;
 }
@@ -537,7 +545,7 @@
 #endif
 			) {
 			crid = SES2(sop)->crid;
-			error = checkforsoftware(crid);
+			error = checkforsoftware(&crid);
 			if (error) {
 				CRYPTDEB("checkforsoftware");
 				goto bail;



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