Changes from testing and review

This CL syncs the AOSP version of the code in common/ with the current
main branch of the development repo, skipping any code that relies
on new dependencies being imported.

Major changes:
- encode curve type (Nist, EdDsa, Xdh) in serialized EC keys
- split Ed25519 keys from X25519 keys from NIST keys
- move ckdf/hkdf into traits with default impls for AesCmac / Hmac
- commonize operation traits
- tweak error behaviour to match what VTS tests expect
- add message for setting attestation ID info (but only if there is
  no trait impl provided for retrieving attestation IDs for the device)
- Tag::UsageCountLimit is a special case - enforced at different levels
  depending on value and secure storage availability

Test: m libkmr_common
Bug: 195310053
Change-Id: I62c9e6583ef2b1f0d43c8030dea550e85d4dede8
15 files changed
tree: 22b66aad0ddc83be643b57fec42b53d62fe6d65f
  1. common/
  2. derive/
  3. scripts/
  4. .gitignore
  5. Android.bp
  6. Cargo.toml
  7. NOTICE
  8. OWNERS
  9. README.md
  10. rustfmt.toml
README.md

KeyMint/Rust

This repo holds work in progress for a Rust implementation of Android's KeyMint HAL.

Repo Structure

The codebase is divided as follows. Only the crates in bold are expected to be used in Android; the remainder are conveniences to allow development outside of Android.

SubdirCrate Namestd?Description
derivekmr-deriveYes (build-only)Proc macros for deriving the AsCborValue trait
commonkmr-commonNoCommon code used throughout KeyMint/Rust
halkmr-halYesHAL service implementation
boringsslkmr-boringsslYesBoring/OpenSSL-based implementations of crypto traits
testskmr-testsTests and test infrastructure
takmr-taNoTA implementation
ta-mainkmr-taYesTA implementation using TCP