Skip to content

Feat/tinygo#2

Draft
prasanna-anchorage wants to merge 5 commits intofeat/refactor-to-releasefrom
feat/tinygo
Draft

Feat/tinygo#2
prasanna-anchorage wants to merge 5 commits intofeat/refactor-to-releasefrom
feat/tinygo

Conversation

@prasanna-anchorage
Copy link
Contributor

No description provided.

Add comprehensive TinyGo compilation tests for 32-bit RISC-V targets:
- Basic crypto test (SHA256, ECDSA P-256, elliptic curves)
- Full verification stack test (including x509, CBOR, Borsh)

Key findings:
- All verification code compiles successfully for 32-bit RISC-V
- crypto/x509 works in TinyGo 0.39.0 (previously expected blocker)
- Binary sizes: 4.6MB (basic), 3.1MB (full verification)
- Bare-metal execution (no OS required)

See TINYGO_COMPATIBILITY_REPORT.md for detailed analysis.

Co-Authored-By: Claude <noreply@anthropic.com>
@prasanna-anchorage prasanna-anchorage changed the base branch from main to feat/refactor-to-release November 5, 2025 23:41
prasanna-anchorage and others added 4 commits November 5, 2025 23:47
  Add skeleton implementation for Tropic Square TROPIC01 secure element integration:
  - Hardware-accelerated P-256 ECDSA verification interface
  - Minimal verifier for offline attestation verification
  - Integration plan and documentation
  - Example command-line tool
  - Unit test structure

  This is a skeleton implementation waiting for libtropic SDK publication.
  Once the SDK is available, device.go will be replaced with CGo bindings.

  Key components:
  - pkg/tropicsquare/: Core integration package
  - cmd/tropicsquare-verify/: CLI verification tool
  - TROPIC_SQUARE_INTEGRATION_PLAN.md: Detailed integration roadmap

  Benefits of hardware acceleration:
  - Smaller code size (~100KB vs 3.1MB)
  - Faster verification with hardware crypto
  - Lower power consumption
  - Tamper-proof execution

  See TROPIC_SQUARE_INTEGRATION_PLAN.md for next steps.

Co-Authored-By: Claude <noreply@anthropic.com>
  Implement attestation verification using Go's crypto/ecdsa (no SDK needed):

  - Add device_purego.go: Pure Go ECDSA P-256 verification
  - Remove device.go: Old stub replaced with working implementation
  - Update tropicsquare.go: Handle 64 and 65-byte public keys
  - Update types.go: Add initialized field to Device
  - Add IMPLEMENTATION_NOTES.md: Detailed design rationale

  Key decision: libtropic SDK not needed for verification
  - libtropic's lt_ecc_ecdsa_sig_verify is HOST-SIDE software
  - Uses trezor-crypto under the hood (excellent, but not hardware)
  - Go's crypto/ecdsa provides same security, zero dependencies
  - Simpler build, faster compilation, TinyGo compatible

  When IS libtropic SDK needed?
  - Hardware signing (keys in TROPIC01 secure storage)
  - Hardware RNG
  - Key provisioning
  - Firmware updates
  - See future examples/hardware-wallet/ for SDK integration

Co-Authored-By: Claude <noreply@anthropic.com>
  Hardware wallet architecture example:
  - TROPIC01: Hardware signing with private keys
  - RISC-V: Pure Go verification and UI
  - Communication: SPI/UART protocol

  Components:
  - examples/hardware-wallet/README.md - Architecture overview
  - protocol.md - Binary communication protocol
  - riscv-verifier/ - TinyGo code for RISC-V board

  Demonstrates separation of concerns:
  - Signing (secret) → TROPIC01 + libtropic SDK
  - Verification (public) → RISC-V + pure Go crypto

Co-Authored-By: Claude <noreply@anthropic.com>
Document binary size reduction for RISC-V targets:

Test results (full verification stack):
- Original (with debug): 3.1M
- With -no-debug: 1.5M (52% reduction) ✅
- With strip: FAILED (doesn't recognize bare-metal RISC-V)
- With UPX: FAILED (RISC-V not supported)

Key findings:
- Only -no-debug flag works for RISC-V bare-metal
- System strip fails (wrong ELF format)
- UPX fails (no RISC-V support)
- 52% reduction is achievable and tested

Recommendation: Use -no-debug for production (1.5M final size)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant