hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/scripts/extract-cert.c
....@@ -23,6 +23,13 @@
2323 #include <openssl/err.h>
2424 #include <openssl/engine.h>
2525
26
+/*
27
+ * OpenSSL 3.0 deprecates the OpenSSL's ENGINE API.
28
+ *
29
+ * Remove this if/when that API is no longer used
30
+ */
31
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
32
+
2633 #define PKEY_ID_PKCS7 2
2734
2835 static __attribute__((noreturn))
....@@ -49,6 +56,7 @@
4956 }
5057 }
5158
59
+#ifndef OPENSSL_IS_BORINGSSL
5260 static void drain_openssl_errors(void)
5361 {
5462 const char *file;
....@@ -58,6 +66,7 @@
5866 return;
5967 while (ERR_get_error_line(&file, &line)) {}
6068 }
69
+#endif
6170
6271 #define ERR(cond, fmt, ...) \
6372 do { \
....@@ -71,7 +80,7 @@
7180 static const char *key_pass;
7281 static BIO *wb;
7382 static char *cert_dst;
74
-int kbuild_verbose;
83
+static int kbuild_verbose;
7584
7685 static void write_cert(X509 *x509)
7786 {
....@@ -112,6 +121,10 @@
112121 fclose(f);
113122 exit(0);
114123 } else if (!strncmp(cert_src, "pkcs11:", 7)) {
124
+#ifdef OPENSSL_IS_BORINGSSL
125
+ ERR(1, "BoringSSL does not support extracting from PKCS#11");
126
+ exit(1);
127
+#else
115128 ENGINE *e;
116129 struct {
117130 const char *cert_id;
....@@ -134,6 +147,7 @@
134147 ENGINE_ctrl_cmd(e, "LOAD_CERT_CTRL", 0, &parms, NULL, 1);
135148 ERR(!parms.cert, "Get X.509 from PKCS#11");
136149 write_cert(parms.cert);
150
+#endif
137151 } else {
138152 BIO *b;
139153 X509 *x509;