Skip to content

Conversation

@rusty1968
Copy link
Collaborator

No description provided.

@rusty1968
Copy link
Collaborator Author

The main intent is to have agreement on the driver model

@rusty1968 rusty1968 changed the title Driver model doc Hash Driver Design Aug 20, 2025
@rusty1968 rusty1968 requested a review from ylt2016 August 22, 2025 19:21
rusty1968 and others added 20 commits August 22, 2025 12:50
…entation

- Fix trait bound error in DigestInit doctest by adding missing DigestOp implementation for MyContext
- Add new baremetal mock platform implementation with SHA-2 digest support
- Update workspace to include platform/impls/baremetal/mock crate
- Add zerocopy dependency to hal/blocking for IntoBytes trait support
- Apply code formatting improvements and add missing license headers
- All pre-checkin validation tests now pass
- Add complete MockMacDevice implementation with HMAC-SHA-2 support
- Implement MacInit, MacOp, and MacCtrlReset traits for all SHA-2 variants
- Include deterministic mock MAC generation based on key hash and data length
- Add comprehensive unit tests covering device creation, reset, and MAC operations
- Export mac module from platform mock library
- Support for HmacSha2_256, HmacSha2_384, and HmacSha2_512 algorithms

The mock implementation provides a software-only stub for MAC operations
that can be used for testing when hardware acceleration is not available.
This is to solve a dependency conflict with the hubris workspace.
Fix hardware recovery pattern.
Introduces a dual API structure for OpenPRoT HAL digest traits to support
both simple baremetal use cases and server applications requiring persistent
sessions.

## Changes Made

### New API Structure
- **Scoped API** (`digest::scoped`): Original lifetime-constrained traits for
  backward compatibility and simple use cases
- **Owned API** (`digest::owned`): New move-based resource management for
  servers and persistent sessions

### Core Improvements
- **Move-based safety**: Prevents use-after-finalize through ownership transfer
- **Resource recovery**: Controllers are always recovered via `finalize()` or `cancel()`
- **Session persistence**: Contexts can be stored across function boundaries
- **IPC compatibility**: No lifetime constraints prevent crossing IPC boundaries

### Implementation Updates
- Updated `hal/blocking/src/digest.rs` with dual API structure
- Enhanced mock implementation with both scoped and owned patterns
- Added comprehensive tests demonstrating session storage patterns
- Fixed clippy warnings (mixed attributes style)
rusty1968 and others added 3 commits August 22, 2025 12:50
…raits

- Add FromBytes and Immutable zerocopy trait derives to Digest<N>
- Implement safe conversion methods: into_array(), as_array(), as_bytes()
- Add comprehensive rustdoc explaining integration benefits vs opaque types
- Include comparison table showing concrete vs opaque type advantages
- Add unit tests for conversion methods, size verification, and alignment
- Fix minor clippy warnings in mock implementation

Addresses integration analysis feedback by eliminating need for unsafe
conversions when working with Digest outputs in server applications.
The concrete Digest<N> type provides compile-time type safety and
direct IPC integration without opaque type bridging.
- Implement core::fmt::Display for digest::ErrorKind enum
- Provide user-friendly error messages for digest operation errors
- Follow Rust conventions for error type Display formatting
- Enable better digest error reporting and library integration

Digest error messages are lowercase, human-readable descriptions
suitable for user-facing digest operation error reporting while
maintaining technical accuracy for cryptographic operations.
@rusty1968 rusty1968 requested a review from moidx August 22, 2025 20:52
@wmaroneAMD wmaroneAMD self-requested a review August 22, 2025 21:17
@rusty1968 rusty1968 merged commit fe5ef09 into OpenPRoT:main Aug 22, 2025
6 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.

4 participants