/dev/crypto: Suppress warning when open /dev/crypto fails with ENXIO.
authorTaylor R Campbell <campbell+openssl@mumble.net>
Wed, 29 Mar 2023 13:21:02 +0000 (13:21 +0000)
committerTomas Mraz <tomas@openssl.org>
Fri, 31 Mar 2023 10:23:45 +0000 (12:23 +0200)
On NetBSD the device node is essentially always present, but these
days it's mostly not useful except for testing the kernel crypto
stack since the cost of CPU crypto has gone down much faster than the
cost of I/O to external crypto engines.  So on most systems it is
disabled in a way that makes open fail with ENXIO.  NetBSD has had
this warning for ENXIO patched away for years.

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20636)

engines/e_devcrypto.c

index 49ebe00b63c64eeb49e5960ce4c4d8a335530831..92c8f0e3568fdd98d57db28c042912023d207056 100644 (file)
@@ -1228,7 +1228,7 @@ static int open_devcrypto(void)
 
     if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) {
 #ifndef ENGINE_DEVCRYPTO_DEBUG
-        if (errno != ENOENT)
+        if (errno != ENOENT && errno != ENXIO)
 #endif
             fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno));
         return 0;