forked from oxidecomputer/hubris
-
Notifications
You must be signed in to change notification settings - Fork 1
Hace integration #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rusty1968
wants to merge
20
commits into
OpenPRoT:master
Choose a base branch
from
rusty1968:hace-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+4,946
−287
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Build the firmware image:
```
$ cargo xtask dist app/ast1060-starter/app.toml
$ gen_uart_booting_image.sh target/ast1060-starter/dist/default/final.bin \
target/ast1060-starter/dist/default/uart_final.bin
```
2. Using uart_final.bin for boot from UART.
3. Using humility over jtag to verify
```
$ humility -e env.json -t ast1060 tasks
humility: attached via JLink
system time = 114057
ID TASK GEN PRI STATE
0 jefe 0 0 recv, notif: fault timer(T+43)
1 idle 0 5 RUNNING
$ humility -e env.json -t ast1060 stackmargin
humility: attached via JLink
ID TASK STACKBASE STACKSIZE MAXDEPTH MARGIN
0 jefe 0x21000 1536 272 1264
1 idle 0x20c00 256 104 152
```
Note: the humility has some bug in gdb connection.
TODO:
- Adding Secure Boot Header within final.bin
- JTAG halt at main configured by features
Signed-off-by: Troy Lee <[email protected]>
Signed-off-by: Troy Lee <[email protected]>
Initial support of ast1060
- run-qemu-debug.sh : starts QEMU and waits for gdb connection. - run-gdb-debug.sh : connects to QEMU, loads symbols.
helloworld task will send "Hello, world!\n" to uart driver task over IPC. Signed-off-by: Troy Lee <[email protected]> Update TICK speed and correctness UART divisor Signed-off-by: Troy Lee <[email protected]> Tx/rs test with UART Signed-off-by: Troy Lee <[email protected]> Add reply check for uart_recv Signed-off-by: Troy Lee <[email protected]> Using enum instead of hardcoded number Signed-off-by: Troy Lee <[email protected]> Fixes miss aligned buffer size Signed-off-by: Troy Lee <[email protected]> uart_read() with sys_borrow_read() Signed-off-by: Troy Lee <[email protected]> reduce rx data loss Signed-off-by: Troy Lee <[email protected]>
Implements a digest API package (drv-digest-api) for the Hubris microkernel, providing type-safe IPC bindings for cryptographic hash operations. This package bridges OpenProt's digest abstraction with Hubris's Idol interface definition language, enabling secure hash computations across service boundaries. Key features: - Support for SHA-2 (SHA256, SHA384, SHA512) and SHA-3 family algorithms - Session-based hash computation with proper state management - Zero-copy digest output types with const generic sizing - Detailed error handling for hardware and software failures - Generated client stubs for type-safe IPC communication The implementation follows Hubris design patterns for driver APIs and maintains compatibility with OpenProt's digest trait abstraction while leveraging Idol's RON-based interface definitions for robust inter-service communication. Files added: - drv/digest-api/Cargo.toml: Package configuration and dependencies - drv/digest-api/build.rs: Idol client stub generation - drv/digest-api/src/lib.rs: Core types, errors, and API definitions - Updates to Cargo.lock for new dependency integration
This commit integrates the digest-server into the ast1060-starter app and
resolves zerocopy compatibility issues between idol-generated code and
zerocopy 0.8.25.
Key changes:
- Add digest-server task to ast1060-starter app configuration
- Implement zerocopy compatibility fix in digest-server build.rs
- Post-process generated server_stub.rs to replace zerocopy_derive::*
with zerocopy::* for compatibility with zerocopy 0.8.x API
- Fix leased memory API usage in digest-server main.rs
- Replace write_range() calls with write() for fixed-size arrays
- Add proper zerocopy trait imports and ClientError import
- Update helloworld task to use digest server
- Add digest API integration with session-based and one-shot testing
- Fix error handling to use DigestError instead of ClientError
- Add proper dependency on drv-digest-api
- Adjust memory allocations in app.toml
- Increase digest-server RAM from 4096 to 8192 bytes
- Increase digest-server stack from 2048 to 3200 bytes
- Increase helloworld RAM from 2048 to 4096 bytes
The digest server now provides SHA-256/384/512 cryptographic hashing
services with both session-based and one-shot APIs, successfully building
and linking with the ast1060-starter application.
Technical details:
- Resolved idol-runtime zerocopy trait compatibility by post-processing
generated code to use zerocopy:: instead of zerocopy_derive:: prefixes
- Fixed Leased<A, [T; N]> API usage - write_range() only exists for slices,
fixed-size arrays use write(value: T) method
- All compilation errors resolved, stack analysis passed
…atch - Integrate openprot-platform-mock MockDevice as hardware backend - Use static memory allocation for session data to avoid stack overflow - Support SHA-256/384/512 algorithms with session-based and oneshot APIs - Fix API compatibility with generated InOrderDigestImpl trait - Allocate 16KB RAM for digest server to accommodate session storage - Eliminate all runtime polymorphism for optimal performance The digest server now efficiently dispatches cryptographic operations to the MockDevice hardware abstraction layer using only static dispatch, providing a clean separation between server logic and hardware implementation.
…ices - Convert ServerImpl from hardcoded MockDigestDevice to generic ServerImpl<D> - Add trait bounds for DigestInit<Sha2_256/384/512> + DigestCtrlReset - Use associated type constraints to ensure Output = Digest<N> compatibility - Maintain full API compatibility while enabling hardware abstraction - Add comprehensive documentation for custom hardware device usage - Move session storage to static allocation to prevent stack overflow - Increase RAM allocation from 8KB to 16KB for larger session buffers - Successfully builds and passes all compilation checks The digest server can now work with any hardware device that implements the required openprot-hal-blocking traits, not just MockDigestDevice.
This commit introduces a new HMAC (Hash-based Message Authentication Code) API crate that follows Hubris patterns for cryptographic operations: New Components: * task/hmac-api/ - Client API crate with error types and constants * idl/hmac.idol - Idol interface definition with session-based operations * Integration with helloworld task as example usage Key Features: * Support for HMAC-SHA256, HMAC-SHA384, and HMAC-SHA512 algorithms * Session-based API for streaming operations (init/update/finalize) * One-shot operations for simple use cases * Comprehensive error handling with IdolError derive macro * Memory lease-based data transfer following Hubris IPC patterns API Design: * Algorithm-specific init/finalize operations for type safety * Maximum key length of 128 bytes, data chunks up to 1024 bytes * Fixed-size output buffers matching algorithm digest sizes * Session management with unique IDs for concurrent operations Technical Details: * Uses derive-idol-err for proper error type integration * Follows established patterns from digest-api crate * Builds successfully with cargo xtask dist system * Compatible with ARM Cortex-M targets via cross-compilation The API is designed to support both SPDM and PLDM protocol implementations that require HMAC operations for message authentication and integrity.
- Update README.md of ast1060-starter app with instructions and TODOs. - Miscellaneous cleanup.
Refactor to single session.
…tion - Switch aspeed-ddk from 'refactor-hace' to 'hash-owned' branch for owned API support - Enable aspeed-hace feature in ast1060-starter app configuration - Fix HaceController initialization to use AST1060 peripheral instance - Add ast1060-pac dependency to digest-server for hardware access - Increase digest_server stack allocation from 3200 to 10240 bytes to handle stack usage - Add owned API optimization guide for future stack usage improvements This enables hardware-accelerated SHA operations using the ASPEED HACE controller on AST1060 hardware, with the digest server successfully building and linking. The increased stack allocation addresses measured usage of 9248 bytes during cryptographic operations. Future optimization should focus on identifying actual stack consumers beyond the hardware context structures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- app/ast1060-starter/app.toml - Optimized digest_server memory allocations:
- Stack: 4096 → 2048 bytes (-50%)
- Flash: 16384 → 12288 bytes (-25%)
- RAM: 16384 → 8192 bytes (-50%)
Fixed endianness and word order in expected hash comparison. The test was incorrectly using little-endian conversion and wrong word ordering for the known SHA-256 vector of 'abc'. Now properly validates against ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
FerralCoder
approved these changes
Sep 3, 2025
wmaroneAMD
pushed a commit
that referenced
this pull request
Oct 1, 2025
* add mctp serial transport binding Signed-off-by: leongross <[email protected]> * wip * use ast1060 uart lib for uart Signed-off-by: leongross <[email protected]> --------- Signed-off-by: leongross <[email protected]> Signed-off-by: Marvin Gudel <[email protected]> Co-authored-by: leongross <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ASPEED HACE Hardware Acceleration Integration for Digest Server
Overview
This work enables hardware-accelerated cryptographic digest operations on ASPEED AST1060 systems using the HACE (Hash and Crypto Engine) hardware accelerator. The implementation provides both session-based streaming operations and one-shot digest computations through a unified HAL-based architecture.
Architecture
Hardware Abstraction Layer
DigestInit,DigestOp) for hardware abstractionDigest<N>types (N=8,12,16) for compile-time size validationSupported Algorithms
Digest<8>)Digest<12>)Digest<16>)Operation Modes
init→ multipleupdate→finalizepattern for streaming dataHardware Integration
ASPEED HACE Controller
Resource Management
Memory Footprint
Resource Previous Current Reduction
Known Vector Validation
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015adQEMU Testing
Key Technical Achievements
Memory Safety
Hardware Abstraction
Error Handling
Build System Integration
This is the first version of a cryptographic service that leverages ASPEED's hardware acceleration capabilities while maintaining the safety and abstraction principles of the Hubris microkernel architecture, tested and validated in QEMU.