Skip to content

[PQC] Feature ECIT - #279

Draft
Doug Flick (Flickdm) wants to merge 11 commits into
microsoft:feat/v2-onecryptofrom
Flickdm:feat/v2-onecrypto-ecit
Draft

Doug Flick (Flickdm) wants to merge 11 commits into
microsoft:feat/v2-onecryptofrom
Flickdm:feat/v2-onecrypto-ecit

Conversation

@Flickdm

@Flickdm Doug Flick (Flickdm) commented Aug 13, 2026

Copy link
Copy Markdown
Member

Description

This pull request introduces a new extensible capability reporting mechanism (ECIT) for cryptographic operations in BaseCryptLib, allowing consumers to query supported algorithms at runtime via operation-specific GUIDs. It adds a dispatcher and per-operation handlers, integrates new CMS and Authenticode capability queries, and updates the protocol interface to expose these features. Additionally, some internal data structures are updated to include OID information.

Capability Reporting (ECIT) Mechanism:

  • Implemented a public dispatcher (GetCryptoOpCapability) in Info/CryptInfo.c that maps operation GUIDs to per-op handler functions, enabling runtime queries of supported cryptographic algorithms for CMS and Authenticode operations. The dispatcher and its handlers are documented and structured for easy extensibility. [1] [2]
  • Added new per-op handler files (Pk/CryptOpCapabilityCommon.c, Pk/CryptCmsOpCapability.c, Pk/CryptAuthenticodeOpCapability.c) to enumerate supported signature and digest OIDs directly from the linked OpenSSL provider, ensuring no static allowlists are used.

Protocol and Interface Updates:

  • Registered new operation GUIDs in the INF file (BaseCryptLib.inf) and exposed them via the protocol interface, allowing external consumers to discover supported CMS and Authenticode algorithms. [1] [2]
  • Updated the protocol initialization in OneCryptoBin.c to wire up the new CmsVerify and GetCryptoOpCapability functions, and re-grouped function assignments by version for clarity.

CMS and Authenticode Handler Additions:

  • Added CmsVerify implementations for both MbedTLS and Null backends, with the MbedTLS backend explicitly rejecting requests for signer chains (not supported), and the Null backend returning FALSE for all calls. [1] [2]

Internal Data Structure Enhancements:

  • Extended the AUTH_HASH_INFO structure in CryptAuthenticodeHash.c to include the dotted-decimal OID for each supported hash algorithm, enabling accurate OID reporting in capability payloads. [1] [2]

Code Organization and Documentation:

  • Added a private header (CryptOpCapability.h) to declare internal interfaces and document the architecture, design rules, and handler prototypes for capability reporting.
  • Improved documentation throughout the dispatcher and handler code, clarifying the payload format, extensibility model, and integration steps for new operations. [1] [2]

These changes collectively enable dynamic, provider-driven reporting of supported cryptographic algorithms, improving maintainability and future-proofing the BaseCryptLib cryptographic interface.

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

<Describe the test(s) that were run to verify the changes.>

Integration Instructions

<Describe how these changes should be integrated. Use N/A if nothing is required.>

@mu-automation mu-automation Bot added impact:non-functional Does not have a functional impact language:python Pull requests that update Python code labels Aug 13, 2026
@Flickdm
Doug Flick (Flickdm) force-pushed the feat/v2-onecrypto branch 2 times, most recently from 4218191 to 0f4dc69 Compare September 4, 2026 23:43
@mu-automation mu-automation Bot removed the language:python Pull requests that update Python code label Sep 17, 2026
@Flickdm Doug Flick (Flickdm) changed the title Feat/v2 onecrypto ecit [PQC] Feature ECIT Sep 18, 2026
Signed-off-by: Doug Flick <dougflick@microsoft.com>
Remove the obsolete GetAuthenticodeHash() protocol registration so the provider ABI matches the corresponding MU_BASECORE CryptoPkg API removal.

Squash with the corresponding MU_BASECORE CryptoPkg API removal.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Return the gEfiHashAlgorithmSha*Guid value described by GetAuthenticodeHashAlgorithm() instead of the corresponding certificate signature GUID.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
@mu-automation mu-automation Bot added the language:python Pull requests that update Python code label Sep 21, 2026
Introduce the Extensible Crypto Information Table (ECIT) capability
reporting framework in BaseCryptLib. The framework enumerates the
signature algorithm OIDs supported by the linked OpenSSL provider
for PKCS#7 verify and Authenticode verify operations.

Architecture:
- CryptOpCapability.h declares the engine entry point, the per-op
  signature-acceptance predicate typedef, and shared handler protos.
- Pk/CryptOpCapabilityCommon.c hosts the engine: state tracking
  (Written vs Committed for ASan-clean two-pass sizing), Pass A
  (legacy RSA/ECDSA OID enumeration) and Pass B (provider signature
  enumeration with dedupe), and predicate-driven filtering.
- Pk/CryptPkcs7OpCapability.c contributes the PKCS#7 policy
  (accept-all signature algorithms exposed by the provider).
- Pk/CryptAuthenticodeOpCapability.c contributes the Authenticode
  policy (accept only digests in {sha1, sha256, sha384, sha512}).
- Info/CryptInfo.c routes GetCryptoOpCapability calls through a
  slim dispatch table keyed on the operation GUID.

Live capability sets:
  PKCS#7 verify   (14 OIDs): RSA+MD5/SHA1/SHA224/SHA256/SHA384/SHA512,
                             ECDSA+SHA1/SHA224/SHA256/SHA384/SHA512,
                             ML-DSA-44/65/87
  Authenticode    ( 8 OIDs): RSA+SHA1/SHA256/SHA384/SHA512,
                             ECDSA+SHA1/SHA256/SHA384/SHA512

Adding a new operation requires a single new Pk/Crypt<Op>OpCapability.c
predicate+handler plus a one-line dispatch row.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Rename the ECIT capability-reporting operation and its handler from the
PKCS#7-specific name to the CMS-oriented name that matches the new
public CmsVerify() interface. The set of accepted algorithms is
unchanged; this is a naming and dispatch update only.

  - Rename Pk/CryptPkcs7OpCapability.c to Pk/CryptCmsOpCapability.c,
    the handler Pkcs7VerifyOpCapability() to CmsVerifyOpCapability(),
    and the predicate Pkcs7Accept() to CmsAccept().
  - Info/CryptInfo.c: dispatch gCryptoOpCmsVerifyGuid to the renamed
    handler; include <Guid/CryptoOpId.h> after InternalCryptLib.h so
    EFI_GUID is defined first.
  - CryptAuthenticodeOpCapability.c: delegate to CmsVerifyOpCapability().
  - BaseCryptLib.inf, UnitTestHostBaseCryptLib.inf: update the [Sources]
    entry and the [Guids] reference to gCryptoOpCmsVerifyGuid.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Add a CmsVerify() stub to the OpensslPkg BaseCryptLib Null instance now
that CmsVerify() is part of the public BaseCryptLib class.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Provide CmsVerify() for the MbedTlsPkg BaseCryptLib backend now that
CmsVerify() is part of the public class. It forwards to Pkcs7Verify()
when no signer chain is requested; MbedTLS cannot return the verified
signer chain, so a chain request returns FALSE. Also add a CmsVerify()
stub to the Null instance.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Assign CmsVerify to the v1.2 OneCrypto protocol in OneCryptoBin so the
shipped provider exposes the newly public CmsVerify() implementation.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Assign the GetCryptoOpCapability service (v1.3) in the OneCrypto binary's
protocol population so the built provider exposes the ECIT capability
query to consumers, matching the CryptoPkg ONE_CRYPTO_PROTOCOL 1.3
definition.

Reflects the in-discussion UEFI Code First item tianocore/edk2#12408 and
is subject to change until ratified.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Add AuthenticodeHashOpCapability(), dispatched for
gCryptoOpAuthenticodeHashGuid, which reports the PE/COFF Authenticode
image-hash (digest) algorithms the library supports as a CSV of dotted
OIDs (SHA-1/256/384/512). The list is derived from the same mAuthHashInfo
table used by GetAuthenticodeHash() by probing each digest's availability,
and cached on first use.

This lets a feature owner (e.g. image verification) report the digest
algorithms it can compute alongside the signature algorithms it verifies.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Add the gCryptoOpCmsContentDigestGuid capability handler so the ECIT
collector can report the digest (content pre-hash) OIDs usable in CMS
SignedData -- the message-digest algorithms an ML-DSA (or any) signer
relies on. The set is enumerated live from the linked OpenSSL provider
via EVP_MD_do_all_provided, so UEFI carries no static digest allowlist;
extendable-output functions are excluded because the CMS content-digest
path cannot finalize them to a fixed length.

Also keep the shared signature enumerator a faithful mirror of the
provider: Pass A now skips XOF digests and only emits legacy (digest,
key) composite OIDs for key types the provider actually implements,
since OBJ_find_sigid_by_algs consults a static table that does not know
what the build ships.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:non-functional Does not have a functional impact language:python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant