Add TI LAUNCHXL-F28P55X (C2000 C28x) bare-metal wolfCrypt example#576
Draft
dgarske wants to merge 1 commit into
Draft
Add TI LAUNCHXL-F28P55X (C2000 C28x) bare-metal wolfCrypt example#576dgarske wants to merge 1 commit into
dgarske wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new bare-metal wolfCrypt bring-up example targeting the TI LAUNCHXL-F28P55X (TMS320F28P550SJ / C28x, CHAR_BIT==16), with a scoped algorithm set and on-device known-answer tests plus optional ECC SP-math smoke tests.
Changes:
- Introduces a C28x board-support
main()that runs SHA-2/SHA-3/SHAKE KATs, ML-DSA-87 verify (and optional sign), and integrates wolfcrypt test/benchmark harnesses. - Adds build scaffolding for TI CGT + C2000Ware (Makefile, ccxml, linker command files, user_settings.h).
- Adds embedded KAT vector headers for ML-DSA-87 verify and ECDSA P-256 verify.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| embedded/ti-c2000-f28p55x/Source/wolf_main.c | Bare-metal entry point, UART/JTAG logging hooks, timer timebase, KATs, ML-DSA verify/sign demo, optional ECC tests |
| embedded/ti-c2000-f28p55x/Source/mldsa87_kat.h | ML-DSA-87 public key + signature KAT vectors for on-target verification |
| embedded/ti-c2000-f28p55x/Source/ecc_p256_kat.h | RFC 6979-based deterministic ECDSA P-256 verify KAT inputs |
| embedded/ti-c2000-f28p55x/Header/user_settings.h | wolfSSL/wolfCrypt configuration tailored for C28x (CHAR_BIT==16) and scoped algorithm set |
| embedded/ti-c2000-f28p55x/Makefile | Headless cl2000 build for scoped wolfCrypt subset + optional ECC/sign modes |
| embedded/ti-c2000-f28p55x/README.md | Usage/build/run notes, 16-bit-byte pitfalls, memory/layout guidance |
| embedded/ti-c2000-f28p55x/28p55x_wolf_flash_lnk.cmd | Flash build linker layout (stack/heap/RAM region allocations) |
| embedded/ti-c2000-f28p55x/28p55x_wolf_sign_lnk.cmd | Alternate linker layout for ML-DSA sign build with large heap |
| embedded/ti-c2000-f28p55x/ccxml/F28P550SJ.ccxml | CCS target configuration for XDS110 + F28P550SJ |
| embedded/ti-c2000-f28p55x/.gitignore | Ignores build output artifacts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d05386e to
d086a31
Compare
Comment on lines
+399
to
+400
| mp_int r; | ||
| mp_int s; |
Comment on lines
+1064
to
+1085
| byte sh[32], sig[64], ap[32], bp[32]; | ||
| word32 shLen = sizeof(sh), sigLen = sizeof(sig); | ||
| int r, vres = 0, ci; | ||
|
|
||
| /* X25519: shared = X25519(a_priv, b_pub) == X25519(b_priv, a_pub) == K. | ||
| * wolfSSL requires the scalar to be pre-clamped (RFC 7748 sec 5); the | ||
| * raw RFC 6.1 keys are not, so clamp a local copy (X25519 clamps the | ||
| * same bits internally, so the shared secret still equals K). The | ||
| * default C build enables WOLFSSL_CURVE25519_BLINDING, so each private | ||
| * key needs an RNG set (the result is unaffected). */ | ||
| if (wc_InitRng(&rng) != 0) | ||
| printf("X25519: RNG init FAIL\r\n"); | ||
| for (ci = 0; ci < 32; ci++) { ap[ci] = a_priv[ci]; bp[ci] = b_priv[ci]; } | ||
| ap[0] &= 248; ap[31] &= 127; ap[31] |= 64; | ||
| bp[0] &= 248; bp[31] &= 127; bp[31] |= 64; | ||
| wc_curve25519_init(&ca); wc_curve25519_init(&cpb); | ||
| r = wc_curve25519_import_private_ex(ap, 32, &ca, EC25519_LITTLE_ENDIAN); | ||
| if (r == 0) r = wc_curve25519_set_rng(&ca, &rng); | ||
| if (r == 0) r = wc_curve25519_import_public_ex(b_pub, 32, &cpb, | ||
| EC25519_LITTLE_ENDIAN); | ||
| if (r == 0) r = wc_curve25519_shared_secret_ex(&ca, &cpb, sh, &shLen, | ||
| EC25519_LITTLE_ENDIAN); |
Comment on lines
+1091
to
+1092
| r = wc_curve25519_import_private_ex(bp, 32, &cb, EC25519_LITTLE_ENDIAN); | ||
| if (r == 0) r = wc_curve25519_set_rng(&cb, &rng); |
| (r == 0 && shLen == 32 && XMEMCMP(sh, x_K, 32) == 0) ? "PASS":"FAIL"); | ||
| wc_curve25519_free(&ca); wc_curve25519_free(&cpb); | ||
| wc_curve25519_free(&cb); wc_curve25519_free(&cpa); | ||
| wc_FreeRng(&rng); |
Comment on lines
+152
to
+158
| ifeq ($(AESEXTRA),1) | ||
| CFLAGS += --define=WOLF_AES --define=WOLF_AESEXTRA | ||
| WC_SRCS += \ | ||
| $(WOLFROOT)/wolfcrypt/src/aes.c \ | ||
| $(WOLFROOT)/wolfcrypt/src/cmac.c \ | ||
| $(WOLFROOT)/wolfcrypt/src/wc_encrypt.c | ||
| endif |
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
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.
New embedded/ti-c2000-f28p55x/ example for the TMS320F28P550SJ (C28x DSP, CHAR_BIT==16). Scoped bare-metal build (cl2000) demonstrating, validated on hardware: SHA-256/384/512(+512-224/256), SHA-3, SHAKE128/256; ML-DSA-87 verify, keygen and sign (make SIGN=1); and ECDSA + ECDH P-256 via SP math (make ECC=1). ML-DSA verify uses the smallest-mem streaming verifier. Includes BSP/startup, SCIA + JTAG-RAM logging, linker scripts, KAT headers, a wolfcrypt test/benchmark harness, a stack-usage profiler, and a 'make compile-ci' guard. Needs a wolfSSL checkout with the CHAR_BIT!=8 fixes (set WOLFROOT).