Skip to content

TI am64x port - #11121

Open
twcook86 wants to merge 10 commits into
wolfSSL:masterfrom
twcook86:ti-am64x_port
Open

twcook86 wants to merge 10 commits into
wolfSSL:masterfrom
twcook86:ti-am64x_port

Conversation

@twcook86

@twcook86 twcook86 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds support for TI am64x hardware acceleration, based on api's from the TI MCU Plus SDK.

  • trng ctr-drbg
  • aes-ecb-128/256
  • aes-cbc-128/256
  • aes-gcm-128/256
  • sha256/512
  • hmac-sha256/512
  • cmac-aes-128/256

Testing

Tested with a new wolfBoot port and wolfssl test/benchmark code.

Corresponding wolfBoot support: wolfSSL/wolfBoot#849

Checklist

  • [na] added tests
  • [na] updated/added doxygen
  • [tbd] updated appropriate READMEs
  • Updated manual and documentation

@twcook86 twcook86 self-assigned this Aug 10, 2026
@wolfSSL-Bot

Copy link
Copy Markdown

Looks like you've got some work to do.
No test results found.

@twcook86
twcook86 requested a review from dgarske August 31, 2026 02:23
@twcook86 twcook86 assigned wolfSSL-Bot and unassigned twcook86 Aug 31, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #11121

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

Findings: 13
13 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

@twcook86 twcook86 removed their assignment Sep 1, 2026
@philljj

philljj commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Retest this please.

(no logs)

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #11121

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfssl-src, wolfssl-bugs
Coverage: 9 of 14 in-scope changed file(s) opened by the reviewer; not opened: wolfcrypt/src/aes.c, wolfcrypt/test/test.c, wolfssl/wolfcrypt/aes.h, wolfssl/wolfcrypt/port/ti/ti-sa2ul_r5_port.h, wolfssl/wolfcrypt/sha256.h

Findings: 5
5 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

Comment thread wolfcrypt/src/sha256.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Comment thread wolfcrypt/src/sha256.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Copilot AI balanced review requested due to automatic review settings September 30, 2026 19:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The implementation has deterministic DRBG seeding, hash-state correctness issues, and inaccurate benchmark output.

Review effort: Balanced
Findings: 3 High severity · 6 Medium severity

Open (9)
What changed in this PR

Adds TI AM64x R5 SA2UL hardware acceleration for MCU Plus SDK and wolfBoot integrations.

Changes:

  • Adds accelerated RNG, AES, SHA-2, HMAC, and CMAC support.
  • Integrates initialization, crypto callbacks, configuration, tests, and benchmarks.
  • Documents supported hardware features and build switches.
File Description
.wolfssl_known_macro_extras Registers TI port macros.
wolfssl/​wolfcrypt/​types.h Adjusts TI compiler pragma handling.
wolfssl/​wolfcrypt/​sha512.h Adds TI SHA-512 context state.
wolfssl/​wolfcrypt/​sha256.h Adds TI SHA-256 context state.
wolfssl/​wolfcrypt/​settings.h Configures AM64x features.
wolfssl/​wolfcrypt/​port/​ti/​ti-sa2ul_r5_port.h Declares the SA2UL port API.
wolfssl/​wolfcrypt/​include.am Distributes the port header.
wolfcrypt/​test/​test.c Integrates TI output and device definitions.
wolfcrypt/​src/​wc_port.c Initializes the SA2UL backend.
wolfcrypt/​src/​sha512.c Manages TI SHA-512 contexts.
wolfcrypt/​src/​sha256.c Manages TI SHA-256 contexts.
wolfcrypt/​src/​random.c Integrates the TI RNG provider.
wolfcrypt/​src/​port/​ti/​ti-sa2ul_r5_port.c Implements SA2UL acceleration.
wolfcrypt/​src/​port/​ti/​README_sa2ul.md Documents the port.
wolfcrypt/​src/​include.am Distributes the port source.
wolfcrypt/​src/​ecc.c Adds the TI string compatibility include.
wolfcrypt/​src/​aes.c Routes AES direct operations through callbacks.
wolfcrypt/​benchmark/​benchmark.c Adds embedded and CSV benchmark support.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wolfcrypt/benchmark/benchmark.c
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/benchmark/benchmark.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/src/sha256.c Outdated
Comment thread wolfcrypt/src/sha512.c Outdated
Comment thread wolfssl/wolfcrypt/settings.h Outdated

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #11121

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfssl-src, wolfssl-bugs
Coverage: 6 of 13 in-scope changed file(s) opened by the reviewer; not opened: wolfcrypt/src/aes.c, wolfcrypt/src/ecc.c, wolfcrypt/src/random.c, wolfssl/wolfcrypt/port/ti/ti-sa2ul_r5_port.h, wolfssl/wolfcrypt/settings.h, wolfssl/wolfcrypt/sha256.h, wolfssl/wolfcrypt/sha512.h

Findings: 5
5 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/test/test.c
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
@twcook86
twcook86 requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot October 1, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

DRBG initialization, hash failure cleanup, resource lifecycle, and portable benchmark formatting have unresolved correctness issues.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (9)
Previously missed (4)

In code that hasn't changed since last review

Medium severity Cast word64 arguments for portable %llu formatting

wolfcrypt/​benchmark/​benchmark.c:3227

word64 is typedef'd as unsigned long when SIZEOF_LONG == 8 (types.h:390-400), so passing these values directly to %llu is a variadic type mismatch on LP64 targets and can produce undefined output. Cast both arguments to unsigned long long (or use a project-wide portable 64-bit format macro).

Medium severity Fix variadic type mismatch in %llu conversion

wolfcrypt/​benchmark/​benchmark.c:3232

This %llu conversion also receives word64 directly; on LP64 builds word64 is unsigned long, not unsigned long long, making the variadic call undefined. Use an explicit matching cast or a portable format macro.

Medium severity Release SA2UL context and mutex on hardware failure

wolfcrypt/​src/​port/​ti/​ti-sa2ul_r5_port.c:867

On a hardware-processing failure this returns while scObj still owns the SA2UL context and the global hardware mutex remains locked. Subsequent accelerated operations will therefore remain unavailable (and the context leaks) until this hash object happens to be freed. Release the context before propagating the error.

This issue also appears in the following locations of the same file:

  • line 881
  • line 1010
  • line 1028
Medium severity Add TI RNG and Crypto handle cleanup

wolfcrypt/​src/​port/​ti/​ti-sa2ul_r5_port.c:1225

The RNG and Crypto handles opened by this initializer have no matching TI cleanup hook in wolfCrypt_Cleanup(); wc_CryptoCb_Cleanup() only unregisters callbacks (cryptocb.c:545-552). A cleanup/re-init cycle therefore leaves the SDK resources open and attempts to open them again. Add a TI port cleanup that closes both handles and invoke it from the final wolfCrypt cleanup path.

Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #11121

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfssl-src, wolfssl-bugs
Coverage: 6 of 12 in-scope changed file(s) opened by the reviewer; not opened: wolfcrypt/src/aes.c, wolfcrypt/src/ecc.c, wolfcrypt/src/sha512.c, wolfcrypt/test/test.c, wolfssl/wolfcrypt/settings.h, wolfssl/wolfcrypt/sha512.h

Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
Comment thread wolfssl/wolfcrypt/settings.h
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c Outdated
Comment thread wolfcrypt/src/port/ti/ti-sa2ul_r5_port.c
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.

6 participants