From 08585fcbae422d59ff8797deb83afbea93b525e3 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 19 Feb 2026 11:12:03 +0100 Subject: [PATCH] unit: Add better check for pkcs8_key_parser availability Check whether the pkcs8_key_parser kernel module is available (whether built-in or as a module) before announcing that we support PKCS#8. --- unit/test-eapol.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unit/test-eapol.c b/unit/test-eapol.c index 58f3e054..144c2d56 100644 --- a/unit/test-eapol.c +++ b/unit/test-eapol.c @@ -3923,6 +3923,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) &&