Skip to content

HMAC Owned Api#75

Merged
FerralCoder merged 17 commits intoOpenPRoT:mainfrom
rusty1968:hmac-owned
Nov 3, 2025
Merged

HMAC Owned Api#75
FerralCoder merged 17 commits intoOpenPRoT:mainfrom
rusty1968:hmac-owned

Conversation

@rusty1968
Copy link
Collaborator

The owned API is a modern pattern in OpenPRoT HAL that uses Rust's move semantics for safe, zero-cost cryptographic operations. Unlike the reference-based APIs, owned APIs transfer ownership of contexts between operations.

  • Move Semantics
  • Operations consume contexts with self (not &mut self)
  • Prevents accidental reuse of finalized contexts
  • Ensures each context has a single, linear lifecycle

This mirrors the digest owned API pattern but adds key management for MAC operations.

@rusty1968 rusty1968 requested a review from FerralCoder October 30, 2025 07:42
FerralCoder
FerralCoder previously approved these changes Oct 30, 2025
FerralCoder
FerralCoder previously approved these changes Oct 30, 2025
FerralCoder
FerralCoder previously approved these changes Oct 31, 2025
… implementation

- Add RustCryptoController as unified trait implementation for digest and MAC
- Consolidate SHA-256/384/512 digest and HMAC-SHA operations in one type
- Remove redundant digest.rs and hash.rs modules
- Update MAC traits to use generic key handle design for better security
- Update dependencies to support unified trait implementation

The RustCryptoController serves as a stateless Hubris-compatible type that
implements both digest and MAC traits with proper generic key handling.
- Add `HubrisDigestDevice` trait with concrete associated types
- Implement `HubrisCryptoError` for IDL-compatible error handling
- Support SHA-256/384/512 digest operations with move semantics
- Add HMAC-SHA256/384/512 support with secure key management
- Include one-shot operation convenience methods

### RustCrypto Controller Integration
- Implement `HubrisDigestDevice` for `RustCryptoController`
- Add `SecureOwnedKey` with stack-allocated 128-byte buffer
- Fix unsafe indexing operations with bounds-checked alternatives
- Suppress deprecation warnings for ecosystem compatibility
@FerralCoder FerralCoder merged commit de085da into OpenPRoT:main Nov 3, 2025
7 checks passed
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