public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: iwd@lists.linux.dev
Cc: Bastien Nocera <hadess@hadess.net>
Subject: [PATCH v2] unit: Add better check for pkcs8_key_parser availability
Date: Thu, 19 Feb 2026 12:20:01 +0100	[thread overview]
Message-ID: <20260219112014.2206170-1-hadess@hadess.net> (raw)

Check whether the pkcs8_key_parser kernel module is available (whether
built-in or as a module) before announcing that we support PKCS#8.
---
Changes since v1:
- Fix missing #include

 unit/test-eapol.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/unit/test-eapol.c b/unit/test-eapol.c
index 58f3e054a5ae..2ffc3e700108 100644
--- a/unit/test-eapol.c
+++ b/unit/test-eapol.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
+#include <sys/stat.h>
 #include <linux/if_ether.h>
 #include <ell/ell.h>
 
@@ -3923,6 +3924,16 @@ static bool aes_precheck(const void *data)
 
 static bool pkcs8_precheck(const void *data)
 {
+	struct stat s;
+
+	/* Despite the path, this directory exists whether the module
+	 * is external or built-in. */
+	if (stat ("/sys/module/pkcs8_key_parser", &s) != 0)
+		return false;
+
+	if (!S_ISDIR (s.st_mode))
+		return false;
+
 	return (IS_ENABLED(HAVE_PKCS8_SUPPORT) &&
 		l_cipher_is_supported(L_CIPHER_AES) &&
 		l_cipher_is_supported(L_CIPHER_AES_CBC) &&
-- 
2.53.0


             reply	other threads:[~2026-02-19 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 11:20 Bastien Nocera [this message]
2026-02-19 11:57 ` [PATCH v2] unit: Add better check for pkcs8_key_parser availability Marcel Holtmann
2026-02-19 12:29   ` Bastien Nocera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260219112014.2206170-1-hadess@hadess.net \
    --to=hadess@hadess.net \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox