eBPF-based security platform
crypto: stop presenting a certificate expiry nothing enforces
Daniel Borkmann4c917a94cf2c
diff --git a/Documentation/concepts/background/pqc.rst b/Documentation/concepts/background/pqc.rstindex c050bff6..f40e6fb6 100644--- a/Documentation/concepts/background/pqc.rst+++ b/Documentation/concepts/background/pqc.rst@@ -192,8 +192,9 @@ certificate.Certificate validity periods are not enforced. shirudo's own checksskip them, and its signatures carry no signing time for the kernel to-compare. A key stops being trusted when a signed config revokes it, not-when its certificate expires.+compare, and ``shirudo genkey`` writes certificates without an+expiration date. A key stops being trusted when a signed config revokes+it, not at a date in its certificate.``BPM_OCI_SCHEME=http`` turns TLS off for registry access, and``map_export.otel_insecure`` turns off certificate verification for thediff --git a/Documentation/operate/maintain/keys.rst b/Documentation/operate/maintain/keys.rstindex 075b7ba3..ec554fc1 100644--- a/Documentation/operate/maintain/keys.rst+++ b/Documentation/operate/maintain/keys.rst@@ -172,9 +172,7 @@ Check what a target trustsPublic-key: ML-DSA-87Fingerprint: SHA256:75171e034357238625311a1c810f7466835ac1dfbc73e9fbd383523439b24125SPKI fingerprint: SHA256:7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69- Valid from: 2026-10-29T21:50:28Z- Valid until: 2036-10-26T21:50:28Z- Expires in: 9y 364d+ Issued: 2026-10-29T21:50:28ZSigning key (/run/shirudo/runtime/keys/signing_key.pem):Present: no (target host -- private key lives on the operator)@@ -220,10 +218,10 @@ Check what a target trustsFrozen serial: 854623986 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyring7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69 (primary)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 209590502 shirudo: 08967f45330deb21bf31301e56bdf154283e2e58 (frozen)4e4d8da3b0d1a69205a3767baca002c052e90af92bc9815d245f9b25dc1b7d9a- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 646964383 shirudo: 8e781f2c1c0e9bccbba9d1d286129128e830e81f (frozen)...diff --git a/Documentation/operate/run/read-status.rst b/Documentation/operate/run/read-status.rstindex 91f239cf..8220b02e 100644--- a/Documentation/operate/run/read-status.rst+++ b/Documentation/operate/run/read-status.rst@@ -81,10 +81,10 @@ loaded, captured from the test VM:Frozen serial: 130847582 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyringd1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (primary)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 199275792 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)c1c30b07f86808e81ae1c0458c926f00b85bcc815d371d23d7683903f2d3266e- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 106884895 shirudo: c350bd270c426c5760b202062e15e274ea30f45d (frozen)Keyring (.dm-verity):@@ -92,7 +92,7 @@ loaded, captured from the test VM:Frozen serial: 962472513 (matches)Certificates: 1 trusted, 1 in the dm-verity keyringd1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (config)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 200951639 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)upatches loaded (1):@@ -223,13 +223,15 @@ roots, read the same way.Each certificate follows with its public key fingerprint, theruntime image's ``.bpf`` certificate marked ``(primary)``, and twolines below it. The first gives the subject, the key algorithm and- the validity dates, which the kernel does not compare with the- clock. The second is the key that holds the certificate in the- keyring, by serial and the kernel's description, ``(frozen)`` when- ``init`` recorded it. ``not in the keyring (enrolled at the next- boot)`` marks a ``.bpf`` certificate a config update added after the- boot; ``not in the keyring (MISSING)`` under ``.dm-verity`` means the- config key is gone.+ the date the certificate was issued, the start of its validity+ period. The end of that period is not shown: neither the kernel nor+ shirudo compares it with the clock, and a certificate stays trusted+ until a signed config revokes it. The second is the key that holds+ the certificate in the keyring, by serial and the kernel's+ description, ``(frozen)`` when ``init`` recorded it. ``not in the+ keyring (enrolled at the next boot)`` marks a ``.bpf`` certificate a+ config update added after the boot; ``not in the keyring (MISSING)``+ under ``.dm-verity`` means the config key is gone.``Other links``Shown only when the keyring holds a link that is no certificate'sdiff --git a/Documentation/reference/cli/genkey.rst b/Documentation/reference/cli/genkey.rstindex 1dbe59f7..2c4f1db2 100644--- a/Documentation/reference/cli/genkey.rst+++ b/Documentation/reference/cli/genkey.rst@@ -37,7 +37,9 @@ Description- ``<dir>/signing_key.pem``: the private key, PEM, mode 0600- ``<dir>/cert.der``: a self-signed X.509 certificate, DER, mode 0600,- subject and issuer ``CN=shirudo``, valid for 3650 days+ subject and issuer ``CN=shirudo``, valid from its creation and+ without an expiration date (``notAfter`` ``99991231235959Z``, the+ value RFC 5280 gives a certificate without one)#. It logs ``genkey: created shirudo ML-DSA-87 signing material at<dir>`` at audit priority.diff --git a/Documentation/reference/cli/keys.rst b/Documentation/reference/cli/keys.rstindex 3e8c2c52..c5b0e680 100644--- a/Documentation/reference/cli/keys.rst+++ b/Documentation/reference/cli/keys.rst@@ -40,7 +40,7 @@ Display- the certificate ``cert.der`` and the signing key ``signing_key.pem`` inthe keys directory: subject, issuer, algorithm, both fingerprints and- validity+ the date the certificate was issued- the trusted set, when it has more than the primary certificate orholds revoked or unvouched entries: each member's SPKI fingerprint, theSHA-256 of its certificate and the certificate that vouched for it@@ -192,9 +192,7 @@ Show the key material on a target:Public-key: ML-DSA-87Fingerprint: SHA256:75171e034357238625311a1c810f7466835ac1dfbc73e9fbd383523439b24125SPKI fingerprint: SHA256:7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69- Valid from: 2026-10-29T21:50:28Z- Valid until: 2036-10-26T21:50:28Z- Expires in: 9y 364d+ Issued: 2026-10-29T21:50:28ZSigning key (/run/shirudo/runtime/keys/signing_key.pem):Present: no (target host -- private key lives on the operator)diff --git a/Documentation/reference/cli/status.rst b/Documentation/reference/cli/status.rstindex 3d24adc3..6dc804e8 100644--- a/Documentation/reference/cli/status.rst+++ b/Documentation/reference/cli/status.rst@@ -194,10 +194,10 @@ Show the state of a target:Frozen serial: 130847582 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyringd1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (primary)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 199275792 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)c1c30b07f86808e81ae1c0458c926f00b85bcc815d371d23d7683903f2d3266e- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 106884895 shirudo: c350bd270c426c5760b202062e15e274ea30f45d (frozen)Keyring (.dm-verity):@@ -205,7 +205,7 @@ Show the state of a target:Frozen serial: 962472513 (matches)Certificates: 1 trusted, 1 in the dm-verity keyringd1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (config)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 200951639 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)upatches loaded (1):diff --git a/Documentation/reference/formats/status-json.rst b/Documentation/reference/formats/status-json.rstindex 8411595d..5b25145b 100644--- a/Documentation/reference/formats/status-json.rst+++ b/Documentation/reference/formats/status-json.rst@@ -337,10 +337,11 @@ Each entry of ``certs``:* - ``algorithm``- string or ``null``- The public key algorithm, for example ``ML-DSA-87``.- * - ``not_before``, ``not_after``+ * - ``not_before``- string or ``null``- - The validity dates, ``YYYY-MM-DD`` in UTC. The kernel does not- compare them with the clock.+ - The date the certificate was issued, the start of its validity+ period, ``YYYY-MM-DD`` in UTC. Nothing compares it with the+ clock, and the end of the period is not reported.* - ``key_serial``- integer or ``null``- Serial of the key in the keyring that holds the certificate.@@ -748,7 +749,6 @@ indented here:"subject": "CN=shirudo","algorithm": "ML-DSA-87","not_before": "2026-10-29",- "not_after": "2036-10-26","key_serial": 199275792,"key_description": "shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c","frozen": true@@ -760,7 +760,6 @@ indented here:"subject": "CN=shirudo","algorithm": "ML-DSA-87","not_before": "2026-10-29",- "not_after": "2036-10-26","key_serial": 106884895,"key_description": "shirudo: c350bd270c426c5760b202062e15e274ea30f45d","frozen": true@@ -781,7 +780,6 @@ indented here:"subject": "CN=shirudo","algorithm": "ML-DSA-87","not_before": "2026-10-29",- "not_after": "2036-10-26","key_serial": 200951639,"key_description": "shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c","frozen": truediff --git a/Documentation/security/cryptography.rst b/Documentation/security/cryptography.rstindex 63bd7572..7b2be025 100644--- a/Documentation/security/cryptography.rst+++ b/Documentation/security/cryptography.rst@@ -111,9 +111,12 @@ No verifier enforces a certificate's validity period. shirudo's ownCMS and chain checks for signatures set ``X509_V_FLAG_NO_CHECK_TIME``.The kernel compares a signature's signing time with the signer'svalidity only when the signature carries a signing time, and shirudo's-signatures carry none. ``shirudo genkey`` writes a validity of ten years-into the certificate, which is informational. Retire a key by revoking-it (residual risks R13 and R16).+signatures carry none: every one is made with OpenSSL's+``CMS_NO_SIGNING_TIME``. ``shirudo genkey`` writes no expiration date;+the certificate's ``notAfter`` is ``99991231235959Z``, the value RFC 5280+gives a certificate with no well-defined expiration. ``shirudo status``+and ``shirudo keys`` show only the date a certificate was issued. Retire+a key by revoking it (residual risks R13 and R16).Digests-------diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rstindex b04bb4fe..9d9a052a 100644--- a/Documentation/start/quickstart.rst+++ b/Documentation/start/quickstart.rst@@ -173,10 +173,10 @@ Check enforcementFrozen serial: 130847582 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyringd1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (primary)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 199275792 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)c1c30b07f86808e81ae1c0458c926f00b85bcc815d371d23d7683903f2d3266e- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 106884895 shirudo: c350bd270c426c5760b202062e15e274ea30f45d (frozen)Keyring (.dm-verity):@@ -184,7 +184,7 @@ Check enforcementFrozen serial: 962472513 (matches)Certificates: 1 trusted, 1 in the dm-verity keyringd1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (config)- CN=shirudo, ML-DSA-87, valid 2026-10-29 to 2036-10-26+ CN=shirudo, ML-DSA-87, issued 2026-10-29key 200951639 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)upatches loaded (0):diff --git a/builtin-genkey.c b/builtin-genkey.cindex e5655d84..e2bdae5a 100644--- a/builtin-genkey.c+++ b/builtin-genkey.c@@ -33,8 +33,8 @@#include "util/paths.h"#include "util/seal.h"-#define VALIDITY_DAYS (10L * 365L)#define CERT_CN "shirudo"+#define CERT_NO_EXPIRY "99991231235959Z"/** ML-DSA-87 (FIPS 204, NIST category 5) is the only key type: the@@ -197,15 +197,21 @@ static int build_serial(X509 *c)return 0;}+/*+ * Neither shirudo nor the kernel compares a certificate's validity with+ * the clock; a key is retired by revoking it. notAfter therefore holds+ * the value RFC 5280 4.1.2.5 gives a certificate with no well-defined+ * expiration, not a date that reads as the end of the key's trust.+ */static int build_validity(X509 *c){if (!X509_gmtime_adj(X509_getm_notBefore(c), 0)) {openssl_complain("X509_gmtime_adj notBefore");return -1;}- if (!X509_gmtime_adj(X509_getm_notAfter(c),- VALIDITY_DAYS * 24L * 60L * 60L)) {- openssl_complain("X509_gmtime_adj notAfter");+ if (ASN1_TIME_set_string_X509(X509_getm_notAfter(c),+ CERT_NO_EXPIRY) != 1) {+ openssl_complain("ASN1_TIME_set_string_X509 notAfter");return -1;}return 0;@@ -507,8 +513,8 @@ int cmd_genkey(int argc, const char **argv)}pr_info("wrote %s (%s, mode 0600)", pkey_path, GENKEY_ALG);- pr_info("wrote %s (X.509 self-signed, %ld-day validity)",- cert_path, VALIDITY_DAYS);+ pr_info("wrote %s (X.509 self-signed, no expiration date)",+ cert_path);pr_audit("genkey: created shirudo %s signing material at %s",GENKEY_ALG, keys_dir);ret = 0;diff --git a/builtin-keys.c b/builtin-keys.cindex e9bef9b1..176165a0 100644--- a/builtin-keys.c+++ b/builtin-keys.c@@ -118,25 +118,6 @@ static void asn1_time_to_iso(const ASN1_TIME *t, char *out, size_t out_sz)strscpy(out, "(format error)", out_sz);}-static long days_remaining(const ASN1_TIME *not_after)-{- int days, secs;-- if (!ASN1_TIME_diff(&days, &secs, NULL, not_after))- return -1;- return days;-}--static int format_expires_in(long days, char *out, size_t out_sz)-{- if (days < 0)- return strsprintf(out, out_sz, "EXPIRED %ld days ago", -days);- if (days >= 365)- return strsprintf(out, out_sz, "%ldy %ldd", days / 365,- days % 365);- return strsprintf(out, out_sz, "%ldd", days);-}-static int compute_cert_fpr(X509 *c, __u8 fpr[SHA256_DIGEST_LENGTH]){__u32 n = SHA256_DIGEST_LENGTH;@@ -205,20 +186,15 @@ static int dump_operator_cert(X509 *cert, const char *cert_path,const X509_NAME *subj = X509_get_subject_name(cert);const X509_NAME *iss = X509_get_issuer_name(cert);const ASN1_TIME *nb = X509_get0_notBefore(cert);- const ASN1_TIME *na = X509_get0_notAfter(cert);+ char subj_s[256], iss_s[256], nb_s[32];EVP_PKEY *pub = X509_get0_pubkey(cert);- char subj_s[256], iss_s[256], nb_s[32], na_s[32], exp_s[48];__u8 fpr[SHA256_DIGEST_LENGTH];- char alg_s[64];int self_signed;- long left;+ char alg_s[64];name_to_str(subj, subj_s, sizeof(subj_s));name_to_str(iss, iss_s, sizeof(iss_s));asn1_time_to_iso(nb, nb_s, sizeof(nb_s));- asn1_time_to_iso(na, na_s, sizeof(na_s));- left = days_remaining(na);- format_expires_in(left, exp_s, sizeof(exp_s));self_signed = (X509_NAME_cmp(subj, iss) == 0);printf("Cert (%s):\n", cert_path);@@ -232,9 +208,7 @@ static int dump_operator_cert(X509 *cert, const char *cert_path,if (compute_cert_fpr(cert, fpr) == 0)print_fpr("Fingerprint:", fpr);print_fpr("SPKI fingerprint:", cert_spki_fpr);- printf(" %-22s %s\n", "Valid from:", nb_s);- printf(" %-22s %s\n", "Valid until:", na_s);- printf(" %-22s %s\n", "Expires in:", exp_s);+ printf(" %-22s %s\n", "Issued:", nb_s);return 0;}diff --git a/builtin-status.c b/builtin-status.cindex e03e9fc4..aca4e2e2 100644--- a/builtin-status.c+++ b/builtin-status.c@@ -502,7 +502,6 @@ struct status_cert {char subject[STATUS_SUBJECT_MAX];char algorithm[32];char not_before[11];- char not_after[11];long link; /* into the keyring's links, or -1 */};@@ -583,8 +582,7 @@ static void keyring_view_cert(struct status_keyring *k, struct status_cert *c,c->info_rc = cert_key_algorithm(&cert, c->algorithm,sizeof(c->algorithm));if (!c->info_rc)- c->info_rc = cert_validity(&cert, c->not_before,- c->not_after);+ c->info_rc = cert_not_before(&cert, c->not_before);cert_free(&cert);}if (k->links_rc || keyring_cert_description(der, len, desc))@@ -713,12 +711,10 @@ static void keyring_emit_json(struct json_emit *e, const char *key,json_kv_null(e, "subject");json_kv_null(e, "algorithm");json_kv_null(e, "not_before");- json_kv_null(e, "not_after");} else {json_kv_string(e, "subject", c->subject);json_kv_string(e, "algorithm", c->algorithm);json_kv_string(e, "not_before", c->not_before);- json_kv_string(e, "not_after", c->not_after);}if (l) {json_kv_int(e, "key_serial", l->serial);@@ -794,8 +790,8 @@ static void print_keyring_certs(const struct status_keyring *k,printf(" (details unreadable: %s)\n",strerror(-c->info_rc));else- printf(" %s, %s, valid %s to %s\n", c->subject,- c->algorithm, c->not_before, c->not_after);+ printf(" %s, %s, issued %s\n", c->subject,+ c->algorithm, c->not_before);if (c->link >= 0)print_link(k, (size_t)c->link, " ");else if (!k->links_rc)diff --git a/testing/functional/signing/t2001-genkey.sh b/testing/functional/signing/t2001-genkey.shindex 3a25fc08..4e2774a1 100755--- a/testing/functional/signing/t2001-genkey.sh+++ b/testing/functional/signing/t2001-genkey.sh@@ -3,10 +3,11 @@# Copyright (c) 2026 Authors of shirudo## t2001 -- `shirudo genkey`: the only key type is ML-DSA-87 (FIPS 204),-# the certificate is self-signed with the same key and carries matching-# subject/authority key identifiers, and there is no algorithm option-# at all. The ML-DSA cases need an OpenSSL (>= 3.5) that knows the-# algorithm; on older toolchains genkey must refuse with an upgrade hint.+# the certificate is self-signed with the same key, carries matching+# subject/authority key identifiers and no expiration date, and there is+# no algorithm option at all. The ML-DSA cases need an OpenSSL (>= 3.5)+# that knows the algorithm; on older toolchains genkey must refuse with+# an upgrade hint.# A --force that cannot put the new pair in place leaves the old one.cd "$(dirname "$0")/../.."@@ -49,6 +50,11 @@ if [ "$have_mldsa" = 1 ]; then-noout -ext authorityKeyIdentifier | grep -Eq "([0-9A-F]{2}:){19}[0-9A-F]{2}"'+ test_expect_success 'certificate has no expiration date' '+ openssl asn1parse -inform DER -in "$tmp/keys/cert.der" |+ grep -q "GENERALIZEDTIME *:99991231235959Z"+ '+test_expect_success 'subject and authority key identifiers match' 'subject=$(openssl x509 -inform DER -in "$tmp/keys/cert.der" \-noout -ext subjectKeyIdentifier | tail -1 | tr -d "[:space:]") &&@@ -66,6 +72,8 @@ if [ "$have_mldsa" = 1 ]; then"$SHIRUDO" keys --keys-dir "$tmp/keys" >"$tmp/keys.out" 2>&1 &&grep -q "Public-key: *ML-DSA-87" "$tmp/keys.out" &&grep -q "Algorithm: *ML-DSA-87" "$tmp/keys.out" &&+ grep -q "Issued: *20[0-9][0-9]-" "$tmp/keys.out" &&+ ! grep -Eq "Valid until|Expires in" "$tmp/keys.out" &&grep -q "signing key matches cert" "$tmp/keys.out"'diff --git a/testing/functional/tamperproof/t6140-status-keyrings.sh b/testing/functional/tamperproof/t6140-status-keyrings.shindex 147d33a9..05d089ac 100644--- a/testing/functional/tamperproof/t6140-status-keyrings.sh+++ b/testing/functional/tamperproof/t6140-status-keyrings.sh@@ -60,7 +60,7 @@ assert any(c["primary"] and c["key_serial"] for c in bpf["certs"]), bpfassert d["certs_enrolled"] == len(held), d["certs_enrolled"]for c in bpf["certs"]:assert c["frozen"] is (True if c["key_serial"] else None), c- assert c["subject"] and c["algorithm"] and c["not_after"], c+ assert c["subject"] and c["algorithm"] and c["not_before"], cdmv = d["dm_verity_keyring"]assert len(dmv["certs"]) == 1, dmv["certs"]c = dmv["certs"][0]diff --git a/util/crypto.h b/util/crypto.hindex 5c96a668..c01b2c74 100644--- a/util/crypto.h+++ b/util/crypto.h@@ -54,9 +54,8 @@ int cert_key_algorithm(const struct cert *cert,/* The subject on one line, "O=Example, CN=fleet", control bytes escaped. */int cert_subject(const struct cert *cert, char *out, size_t out_sz)__must_check;-/* The validity window as UTC dates, YYYY-MM-DD. */-int cert_validity(const struct cert *cert, char not_before[11],- char not_after[11]) __must_check;+/* The start of the validity period as a UTC date, YYYY-MM-DD. */+int cert_not_before(const struct cert *cert, char out[11]) __must_check;int verify_detached(const __u8 *payload, size_t payload_len,const __u8 *signature, size_t signature_len,const struct cert *cert) __must_check;diff --git a/util/crypto_openssl.c b/util/crypto_openssl.cindex 0052229a..fc17319d 100644--- a/util/crypto_openssl.c+++ b/util/crypto_openssl.c@@ -349,17 +349,11 @@ static int asn1_date(const ASN1_TIME *t, char out[11])return strftime(out, 11, "%Y-%m-%d", &tm) == 10 ? 0 : -EINVAL;}-int cert_validity(const struct cert *cert, char not_before[11],- char not_after[11])+int cert_not_before(const struct cert *cert, char out[11]){- int ret;-if (!cert || !cert->impl)return -EINVAL;- ret = asn1_date(X509_get0_notBefore(cert->impl), not_before);- if (!ret)- ret = asn1_date(X509_get0_notAfter(cert->impl), not_after);- return ret;+ return asn1_date(X509_get0_notBefore(cert->impl), out);}static CMS_ContentInfo *read_cms(const __u8 *signature, size_t len)diff --git a/util/sign.c b/util/sign.cindex ce836a66..0ad58cc4 100644--- a/util/sign.c+++ b/util/sign.c@@ -163,14 +163,19 @@ static bool pkey_is_mldsa87(const EVP_PKEY *pkey)return EVP_PKEY_is_a(pkey, "ML-DSA-87");}+/*+ * Never a signing time: the kernel refuses a signature whose signing+ * time falls outside the signer's validity period+ * (crypto/asymmetric_keys/pkcs7_verify.c), which would let a+ * certificate's dates decide what loads. Every OpenSSL shirudo builds+ * with has the flag, so it is not guarded.+ */int cms_sign(struct sign_io *io,const char *pkey_path, const char *cert_path){unsigned int signer_flags = CMS_NOCERTS | CMS_BINARY | CMS_NOSMIMECAP |-#ifdef CMS_NO_SIGNING_TIME- CMS_NO_SIGNING_TIME |-#endif- CMS_USE_KEYID | CMS_NOATTR;+ CMS_NO_SIGNING_TIME | CMS_USE_KEYID |+ CMS_NOATTR;unsigned int hash_len = SHA256_LEN;const EVP_MD *cms_digest = EVP_sha256();BIO *bd_in = NULL, *bd_out = NULL;