Skip to content

Customer/openvmm static baseline - #113

Draft
Khang (nnmkhang) wants to merge 14 commits into
mainfrom
customer/openvmm-static-baseline
Draft

Customer/openvmm static baseline#113
Khang (nnmkhang) wants to merge 14 commits into
mainfrom
customer/openvmm-static-baseline

Conversation

@nnmkhang

@nnmkhang Khang (nnmkhang) commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description of Changes:

Save state for Underhill team

Breaking Changes if any:

✅ Admin Checklist

  • Review the PR description and ensure all necessary details are included.
  • Update/add unit tests for changed code.
  • Update/add documentation for new or changed APIs.
  • Run cargo test --all-features on Windows and WSL.

Check the Developer Guidelines in DEVELOPER.md for more info.

Khang (nnmkhang) and others added 14 commits April 7, 2026 15:35
Static linking is moved to the experimental/static-linking branch.
Dynamic linking is now the only (unconditional) build path.

- Delete build/static_link.rs, build/triple.rs, static C files, buildInfo.h
- Simplify build/main.rs -> build.rs (dynamic-only)
- Remove `dynamic` feature from symcrypt-sys and symcrypt Cargo.toml
- Remove cfg(dynamic) branches from lib.rs (unconditional SymCryptModuleInit)
- Restore pre-PR#81 bindings (remove cfg_attr guards)
- Revert symcrypt-bindgen cfg_attr injection
- Add permissions: contents: read to all workflows (CodeQL finding)
- Remove static linking test steps from build_linux.yml, build_windows.yml
- Fix doc_lazy_continuation clippy lint in README
- Fix missing trailing newlines (linelint)
- Add .gitattributes for LF line ending enforcement
- Create CONTRIBUTING.md with branch model, PR process, and all developer
  workflows (bindings generation, submodule updates, publishing)
- Delete DEVELOPER.md (content absorbed into CONTRIBUTING.md)
- Delete SUPPORT.md (consolidated into CONTRIBUTING.md)
- Trim root README.md, remove stale "cannot accept contributions" text
- Fix PR template: link to CONTRIBUTING.md, add release branch targeting
- Clean up README/INSTALL.md version references
- MSRV 1.64.0 -> 1.84.0 (enables raw-dylib, LazyLock, OnceLock)
- Replace lazy_static with std::sync::LazyLock in ecc/mod.rs
- Centralize shared dependencies (libc, hex, symcrypt-sys) in workspace root
- Add categories/keywords to symcrypt and symcrypt-sys for crates.io
- Add .editorconfig (LF, UTF-8, consistent indentation)
- symcrypt 0.5.1 -> 0.6.0
- Update Cargo.lock
Submodule, VERSION.md, CI download URLs, INSTALL.md, and README.md
all now point to SymCrypt v103.11.0 (748c20f1). Bindings will be
regenerated via the publish_new_bindings CI workflow.
The runner images have an older symcrypt.dll in System32 that causes
SymCryptModuleInit to crash. DLL staging workarounds did not resolve
the issue. Commenting out the workflow until the host images are updated.
Co-authored-by: Copilot <copilot@github.com>
* part 1

Co-authored-by: Copilot <copilot@github.com>

* rename

* docs

* cleanup

* fix newline

---------

Co-authored-by: Copilot <copilot@github.com>
Implement std::error::Error for SymCryptError
* publish to get bindings

* Revert accidental submodule pointer change

The previous commit drifted the SymCrypt submodule pointer from 748c20f1
(matches symcrypt-sys/VERSION.md) to 53be637. Reset it back so the
check-submodule CI workflow passes and bindings are regenerated against
the correct SymCrypt version.

* update bindings, add cleanup sp800

* cargo fmt

* adding symcrypt_init
* publish to get bindings

* Revert accidental submodule pointer change

The previous commit drifted the SymCrypt submodule pointer from 748c20f1
(matches symcrypt-sys/VERSION.md) to 53be637. Reset it back so the
check-submodule CI workflow passes and bindings are regenerated against
the correct SymCrypt version.

* update bindings, add cleanup sp800

* cargo fmt

* adding symcrypt_init

* add xts-aes and aes-kw(p) to bindgen allowlist

Adds allowlist patterns for XTS-AES, AES-KW (RFC 3394), and AES-KWP
(RFC 5649) functions so they get exposed by symcrypt-sys.

Bindings will be regenerated via the generate_pr_label workflow.

* trigger bindings regen

* regenerate bindings for xts-aes and aes-kw(p)

Adds the XTS-AES (SYMCRYPT_XTS_AES_EXPANDED_KEY plus the seven XtsAes
functions) and AES-KW / AES-KWP encrypt/decrypt symbols to all four
arch-specific bindings files. Reverts the spacing-only tweak in the
bindgen comment that was used to retrigger the regen workflow.

* cipher: expose AesInnerKey to crate and wipe on drop

Makes AesInnerKey pub(crate) so other modules can reuse it for AES-based
modes that share SYMCRYPT_AES_EXPANDED_KEY (AES-KW, AES-KWP). Adds a Drop
impl that calls SymCryptWipe on the inner state, matching the pattern
GcmInnerKey uses.

* add XTS-AES-256, AES-KW, AES-KWP modules

Three new modules backed by SymCrypt's native primitives:

- xts: XtsAes256Key with encrypt_in_place / decrypt_in_place using a
  64-bit tweak. Uses SymCryptXtsAesExpandKeyEx (FIPS-approved variant,
  enforcing the equality check on the two key halves).

- aes_kw: AesKwKey for RFC 3394 (8-byte-aligned plaintext, output =
  input + 8) and AesKwpKey for RFC 5649 (any non-zero length, output
  rounded up to a multiple of 8 plus 8). Both reuse the AES expanded
  key from cipher/mod.rs.

All entry points call crate::symcrypt_init() first, mirroring every
other primitive in the crate. KAT tests use vectors from SymCrypt's
own kat_xts.dat (IEEE 1619-2018 e/pi key) and kat_keywrap.dat
(NIST ACVP test vectors).

README documents the new APIs and notes that AES-KW(P) has no
general-purpose Windows BCrypt equivalent today; a future BCrypt-backed
variant will return a NotSupported runtime error on Windows for
AES-KW(P) until the BCrypt gap is filled upstream.

* move xts and aes_kw under cipher/, add KAT, align docs and API

- xts.rs and aes_kw.rs move from the crate root into cipher/, joining
  cbc alongside the shared AES expanded-key infrastructure. Public
  paths become symcrypt::cipher::xts and symcrypt::cipher::aes_kw.

- AES-KW(P) methods renamed wrap/unwrap -> encrypt/decrypt to match
  the rest of the crate's cipher API (gcm, cbc) and avoid collision
  with Result::unwrap. The underlying algorithm is still described
  as wrap/unwrap in doc prose where the standards terminology applies.

- aes_kw internal import uses crate::cipher::AesInnerKey to match
  cbc.rs's existing style.

- xts.rs gains a byte-for-byte KAT test using the IEEE 1619-2018
  vector at symcrypt/unittest/kat_xts.dat:178 (e||pi key, tweak 0xff,
  512-byte plaintext as a single data unit). cbDataUnit == cbPlaintext
  for this KAT per katXtsSingle in testXts.cpp:519.

- xts.rs top-of-file docs are reorganized to mirror gcm.rs: an
  ## Encrypt in place and ## Decrypt in place sub-section under
  # Examples, each a self-contained runnable doctest.

gcm.rs and chacha.rs remain at the crate root for backwards
compatibility; they will move under cipher/ at the next intentional
breaking release.

* xts: add out-of-place encrypt/decrypt alongside the in-place pair

Mirrors the cbc.rs pattern (which offers both aes_cbc_encrypt and
aes_cbc_encrypt_in_place). The new methods take separate plaintext
and ciphertext slices of equal length, useful when the caller wants
to preserve the plaintext for retry, verification, or logging.

In-place remains the natural shape for disk-sector use cases; the
out-of-place variant is purely additive.

AES-KW(P) deliberately does not get a corresponding pair because
its output size differs from input size, making 'in place' a misnomer
and the Vec-return shape match what HKDF, SP800-108, and RSA encrypt
already do for variable-size outputs.

* aes_kw: spell KWP output length formula in terms of plaintext.len()

The earlier draft used the symcrypt.h header's cbSrc shorthand. Spelling
it as plaintext.len() reads more naturally for Rust callers and the
file's top-of-module comment already directs readers to symcrypt.h for
deeper context.

Also drops two stale comments that named the kat_keywrap.dat section
the test vectors came from; the test bodies already cite the source.

* fix comments

* fix readme

* Addressing Mitch's comments regarding AES-KW(P)

* Addressing Mitch's comments, adding XTS128bit

* Cargo fmt

* Addressing Mitch's comments

* Removing zeroize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants