TI C2000 example: add CCS projects for the SHA-2 and SHA-3 examples

pull/646/head
David Garske 2026-10-20 15:20:05 -07:00
parent 7f29c50efa
commit 3d2a76621f
8 changed files with 504 additions and 26 deletions

View File

@ -141,28 +141,6 @@ extern "C" {
#undef WOLFSSL_SHAKE256
#define WOLFSSL_SHAKE256
/* Standalone hash examples (make SHA2=1 / SHA3=1): one hash family only, no
* RNG and no ML-DSA. */
#if defined(WOLF_SHA2_EXAMPLE) || defined(WOLF_SHA3_EXAMPLE)
#define WOLF_HASH_EXAMPLE
#undef WC_NO_RNG
#define WC_NO_RNG
#endif
#ifdef WOLF_SHA2_EXAMPLE
#undef WOLFSSL_SHA224
#define WOLFSSL_SHA224
#undef WOLFSSL_SHA3
#undef WOLFSSL_SHAKE128
#undef WOLFSSL_SHAKE256
#endif
#ifdef WOLF_SHA3_EXAMPLE
#undef NO_SHA256
#define NO_SHA256
#undef WOLFSSL_SHA512
#undef WOLFSSL_SHA384
#endif
#ifndef WOLF_HASH_EXAMPLE
/* ------------------------------------------------------------------------- */
/* ML-DSA-87 (Dilithium L5) - VERIFY ONLY */
/* ------------------------------------------------------------------------- */
@ -244,7 +222,6 @@ extern "C" {
* ~10.7 KB total RAM. Left off by default because the caller must keep the
* public-key buffer valid for the key's lifetime. */
#endif
#endif /* !WOLF_HASH_EXAMPLE */
/* ------------------------------------------------------------------------- */
/* Disabled: big-integer / asymmetric (keeps TFM/ECC/integer out of build) */

View File

@ -371,21 +371,25 @@ endif
$(WOLFROOT)/wolfcrypt/src/misc.c \
$(WOLFROOT)/wolfcrypt/src/hash.c
ifeq ($(SHA2),1)
CFLAGS += --define=WOLF_SHA2_EXAMPLE
LFLAGS += --define=WOLF_SHA2_EXAMPLE
WC_SRCS += \
$(WOLFROOT)/wolfcrypt/src/sha256.c \
$(WOLFROOT)/wolfcrypt/src/sha512.c
BSP_SRCS := $(CURDIR)/Source/test_sha2.c
SHA_EXAMPLE_DIR := $(CURDIR)/ccs/sha2
else
CFLAGS += --define=WOLF_SHA3_EXAMPLE
LFLAGS += --define=WOLF_SHA3_EXAMPLE
WC_SRCS += $(WOLFROOT)/wolfcrypt/src/sha3.c
BSP_SRCS := $(CURDIR)/Source/test_sha3.c
SHA_EXAMPLE_DIR := $(CURDIR)/ccs/sha3
endif
BSP_SRCS += \
$(CURDIR)/Source/c2000_board.c \
$(DEV)/common/source/device.c
# The example's own user_settings.h (shared with its CCS project) must be
# found before the full-image one in Header/.
CFLAGS := $(subst -I$(CURDIR)/Header,-I$(SHA_EXAMPLE_DIR) \
-I$(CURDIR)/Header,$(CFLAGS))
CFLAGS += --define=NO_CRYPT_TEST --define=NO_CRYPT_BENCHMARK
HARNESS_SRCS :=
HARNESS_EXTRA :=

View File

@ -34,7 +34,9 @@ make CGT_ROOT=/path/to/ti-cgt-c2000_xx.y.z SHA3=1 # Source/test_sha3.c
Each `main()` calls `c2000_board_init()` (`Source/c2000_board.c`: clocks, SCIA console, CPU Timer 0) and runs one function per variant that shows the complete API sequence, `wc_InitXxx()` -> `wc_XxxUpdate()` -> `wc_XxxFinal()` -> `wc_XxxFree()`, on the FIPS 180-4 / FIPS 202 "abc" vector, printing the digest and `PASS`/`FAIL`. A streaming case then feeds one message through several `Update` calls, and a throughput loop hashes 64 KiB per variant through the generic `wc_HashInit()` / `wc_HashUpdate()` / `wc_HashFinal()` API. Output ends with `SHA-2 example: PASS` (or `SHA-3 ...`) and `=== done ===`.
Only that family's wolfCrypt source is built (`sha256.c` + `sha512.c`, or `sha3.c`), with no RNG, ML-DSA or test/benchmark harness. `Header/user_settings.h` selects the algorithms under `WOLF_SHA2_EXAMPLE` / `WOLF_SHA3_EXAMPLE`. Both toggles build alone: combining one with the other or with any other toggle is a build error. The output image is `out/wolfcrypt_f28p55x.out` as for every other build, flashed the same way (see Flash and run).
Only that family's wolfCrypt source is built (`sha256.c` + `sha512.c`, or `sha3.c`), with no RNG, ML-DSA or test/benchmark harness. Each uses its own small `user_settings.h` from `ccs/sha2/` or `ccs/sha3/`, the same file its CCS project uses. Both toggles build alone: combining one with the other or with any other toggle is a build error. The output image is `out/wolfcrypt_f28p55x.out` as for every other build, flashed the same way (see Flash and run).
The same two examples are also available as Code Composer Studio projects: see [ccs/README.md](ccs/README.md).
## Octet representation at the API boundary (`MLDSA=1`)

View File

@ -0,0 +1,83 @@
# wolfCrypt SHA-2 / SHA-3 CCS projects for the LAUNCHXL-F28P55X
Two Code Composer Studio (CCS) projects for the TI LAUNCHXL-F28P55X (TMS320F28P550SJ, C2000 C28x): one for SHA-2, one for SHA-3. Each project is one small application file plus wolfCrypt, imported from a `.projectspec` in the same way as the C2000Ware examples.
| Project | projectspec | Algorithms |
|---|---|---|
| `wolfssl_sha2` | `ccs/sha2/wolfssl_sha2.projectspec` | SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256 |
| `wolfssl_sha3` | `ccs/sha3/wolfssl_sha3.projectspec` | SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128, SHAKE256 |
## Prerequisites
- Code Composer Studio 20.x. CCS 12.x imports the same `.projectspec` format but has not been tested.
- C2000Ware 26.01 (`C2000Ware_26_01_00_00`), installed where CCS can find it (CCS discovers it under `~/ti` or `C:\ti`).
- TI C2000 code generation tools 22.6.3.LTS. 25.11.0.LTS has also been tested. To use a different installed version, change it under Project Properties > General > Compiler version.
- A clone of the wolfSSL master branch. The C28x has 16-bit bytes (`CHAR_BIT == 16`) and needs the support for that in current wolfSSL.
The projects expect wolfSSL to be cloned next to wolfssl-examples:
```
<dir>/wolfssl git clone https://github.com/wolfSSL/wolfssl.git
<dir>/wolfssl-examples git clone https://github.com/wolfSSL/wolfssl-examples.git
```
## Import and build
1. File > Import Projects, and select `ccs/sha2/wolfssl_sha2.projectspec` or `ccs/sha3/wolfssl_sha3.projectspec`.
2. The application files (`test_sha2.c` or `test_sha3.c`, `c2000_board.c`, `c2000_board.h`, `user_settings.h`, `28p55x_wolf_flash_lnk.cmd`) and the C2000Ware device files are copied into the new project, so you can edit them freely. The wolfCrypt sources in the `wolfcrypt` folder are links into the wolfSSL clone.
3. Pick a build configuration and build:
- `CPU1_LAUNCHXL_FLASH`: optimized (`-O2`).
- `CPU1_LAUNCHXL_FLASH_DEBUG`: no optimization and full symbols, for stepping through the hash calls.
If wolfSSL is somewhere else, `WOLFSSL_ROOT` must be changed in two places in each project (the projectspec records it as both a linked-resource path and a build variable):
- Project Properties > Resource > Linked Resources > Path Variables: `WOLFSSL_ROOT`
- Project Properties > Build > Variables (select "All configurations"): `WOLFSSL_ROOT`
## Flash, run and read the output
1. Use the LaunchPad target configuration copied into the project (`targetConfigs/TMS320F28P550SJ9_LaunchPad.ccxml`) and start a debug session (Run > Debug), which programs flash.
2. Open a serial terminal on the LaunchPad's XDS110 "Application/User UART" port at 115200 8N1.
3. Run. The output is printed on the UART:
```
=== wolfCrypt SHA-2 example on TI C2000 LAUNCHXL-F28P55X ===
--- Known-answer tests ---
SHA-224 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7
SHA-224 KAT: PASS
SHA-256 ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
SHA-256 KAT: PASS
...
--- Throughput (150 MHz) ---
SHA-256 64 KiB in 0.222 s = 288.0 KiB/s
...
SHA-2 example: PASS (0 failure(s))
=== done ===
```
The UART output stays clean only while the debugger is not halting the target, so let it run freely (or disconnect after flashing). To send `printf` to the CCS Console instead of the UART, remove `WOLF_C2000_SCI_STDOUT` under Project Properties > Build > C2000 Compiler > Predefined Symbols. The CCS Console is much slower.
## Code flow
`main()` in `test_sha2.c` / `test_sha3.c`:
1. `c2000_board_init()` (`c2000_board.c`): PLL to 150 MHz, GPIO, SCIA console redirected to `stdout`, and CPU Timer 0 as the time base for `current_time()`.
2. One function per algorithm, e.g. `sha256_example()`, showing the complete wolfCrypt call sequence on the FIPS 180-4 / FIPS 202 "abc" test vector: `wc_InitSha256()` -> `wc_Sha256Update()` -> `wc_Sha256Final()` -> `wc_Sha256Free()`. The digest is printed and compared to the expected value (`PASS` / `FAIL`).
3. A streaming example that feeds one message through several `Update` calls (`sha256_stream_example()` / `shake256_stream_example()`).
4. `hash_bench()`: hashes 64 KiB per algorithm through the generic `wc_HashInit()` / `wc_HashUpdate()` / `wc_HashFinal()` API and prints the throughput.
## Adding wolfCrypt hashing to your own CCS project
1. Clone wolfSSL master.
2. Add these files from `<wolfssl>/wolfcrypt/src/` to the project (Add Files, or link them):
- Always: `error.c`, `wc_port.c`, `memory.c`, `logging.c`, `misc.c`, `hash.c`.
- SHA-2: `sha256.c`, `sha512.c`. SHA-3: `sha3.c`.
3. Copy `ccs/sha2/user_settings.h` or `ccs/sha3/user_settings.h` into your project. The platform section must stay as is: it sets the C28x integer widths and the `CHAR_BIT == 16` handling. Then adjust the algorithm section.
4. Project Properties > Build > C2000 Compiler:
- Include Options: add your project directory (for `user_settings.h`) and the wolfSSL root directory (the one containing the `wolfssl/` folder).
- Predefined Symbols: add `WOLFSSL_USER_SETTINGS`.
5. Include `<wolfssl/wolfcrypt/settings.h>` before any other wolfCrypt header, then `<wolfssl/wolfcrypt/sha256.h>`, `sha512.h` or `sha3.h`.
6. Linker command file: these examples use `28p55x_wolf_flash_lnk.cmd`, which places a 16 KW stack in low RAM (the C28x stack must sit below 0x10000) and runs the SHA-3 core `BlockSha3` from RAM for speed. The hash examples make no heap allocations.
On the C28x a `byte` is 16 bits and holds one octet: every wolfCrypt byte buffer stores one octet per 16-bit cell, and lengths are octet counts. Data that arrives packed (two octets per cell) from flash or a peripheral must be unpacked with `wc_UnpackOctets()` before it is hashed.

View File

@ -0,0 +1,150 @@
/* user_settings.h
*
* Copyright (C) 2006-2026 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* wolfSSL user settings for the SHA-2 (SHA-224/256/384/512, SHA-512/224, SHA-512/256) example on the TI C2000 C28x
* (LAUNCHXL-F28P55X). Selected by defining WOLFSSL_USER_SETTINGS.
*
* The C28x has 16-bit bytes (CHAR_BIT == 16): every wolfCrypt byte buffer
* holds one octet per 16-bit cell. The platform settings below are required
* for that; the last section picks the hash algorithms.
*/
#ifndef WOLFSSL_USER_SETTINGS_C2000_SHA2_H
#define WOLFSSL_USER_SETTINGS_C2000_SHA2_H
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------------- */
/* Platform / C28x toolchain */
/* ------------------------------------------------------------------------- */
#undef SINGLE_THREADED
#define SINGLE_THREADED
#undef WOLFCRYPT_ONLY /* crypto only, no TLS layer */
#define WOLFCRYPT_ONLY
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
#undef NO_WRITEV
#define NO_WRITEV
#undef NO_MAIN_DRIVER /* main() lives in the example source */
#define NO_MAIN_DRIVER
#undef NO_DEV_RANDOM
#define NO_DEV_RANDOM
#undef WOLFSSL_IGNORE_FILE_WARN
#define WOLFSSL_IGNORE_FILE_WARN
/* C28x integer widths: char/short/int = 16-bit, long = 32-bit,
* long long = 64-bit. */
#undef SIZEOF_LONG
#define SIZEOF_LONG 4
#undef SIZEOF_LONG_LONG
#define SIZEOF_LONG_LONG 8
/* Use the toolchain's <limits.h> so CHAR_BIT is the real value (16 on C28x)
* instead of wolfSSL's 8-bit fallback. */
#undef HAVE_LIMITS_H
#define HAVE_LIMITS_H
/* 16-bit int: word16 = unsigned int, word32 = unsigned long. Without this
* wolfSSL assumes a 32-bit int and silently truncates 32-bit math. */
#undef WC_16BIT_CPU
#define WC_16BIT_CPU
/* Portable byte-by-byte paths; a byte buffer must never be cast to a wider
* word when a byte is 16 bits. */
#undef WOLFSSL_GENERAL_ALIGNMENT
#define WOLFSSL_GENERAL_ALIGNMENT 2
/* Portable C cores - no assembly. */
#undef WOLFSSL_NO_ASM
#define WOLFSSL_NO_ASM
/* Build misc.c as its own translation unit. The TI compiler emits no
* out-of-line copy of a plain `inline` definition, so the inline-misc path
* leaves helpers such as xorbuf unresolved at link. */
#undef NO_INLINE
#define NO_INLINE
/* Hashing only: no random number generator. */
#undef WC_NO_RNG
#define WC_NO_RNG
/* ------------------------------------------------------------------------- */
/* SHA-2 */
/* ------------------------------------------------------------------------- */
/* SHA-256 is on by default (NO_SHA256 not defined). */
#undef WOLFSSL_SHA224
#define WOLFSSL_SHA224
#undef WOLFSSL_SHA384
#define WOLFSSL_SHA384
#undef WOLFSSL_SHA512 /* also SHA-512/224 and SHA-512/256 */
#define WOLFSSL_SHA512
/* ------------------------------------------------------------------------- */
/* Everything else off: hashing only */
/* ------------------------------------------------------------------------- */
#undef NO_BIG_INT /* no multi-precision math */
#define NO_BIG_INT
#undef NO_RSA
#define NO_RSA
#undef NO_DH
#define NO_DH
#undef NO_DSA
#define NO_DSA
#undef NO_ASN
#define NO_ASN
#undef NO_CERTS
#define NO_CERTS
#undef NO_PWDBASED
#define NO_PWDBASED
#undef NO_PKCS7
#define NO_PKCS7
#undef NO_PKCS12
#define NO_PKCS12
#undef NO_SIG_WRAPPER
#define NO_SIG_WRAPPER
#undef NO_AES
#define NO_AES
#undef NO_DES3
#define NO_DES3
#undef NO_RC4
#define NO_RC4
#undef NO_MD4
#define NO_MD4
#undef NO_MD5
#define NO_MD5
#undef NO_SHA /* SHA-1 */
#define NO_SHA
#undef NO_HMAC
#define NO_HMAC
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_USER_SETTINGS_C2000_SHA2_H */

View File

@ -0,0 +1,54 @@
<projectSpec>
<project
name="wolfssl_sha2"
device="TMS320F28P550SJ9"
cgtVersion="22.6.3.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="false"
>
<!-- C2000WARE_ROOT comes from the C2000Ware product registered in CCS.
WOLFSSL_ROOT defaults to a wolfssl clone next to wolfssl-examples;
see ccs/README.md to change it. -->
<pathVariable name="C2000WARE_ROOT" path="${COM_TI_C2000WARE_INSTALL_DIR}" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="${COM_TI_C2000WARE_INSTALL_DIR}/driverlib/f28p55x/driverlib/" scope="project" />
<pathVariable name="WOLFSSL_ROOT" path="../../../../../wolfssl" scope="project" />
<configuration name="CPU1_LAUNCHXL_FLASH"
compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${WOLFSSL_ROOT} -I${CG_TOOL_ROOT}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu1 --abi=eabi --define=CPU1 --define=_FLASH --define=_LAUNCHXL_F28P55X --define=WOLFSSL_USER_SETTINGS --define=WOLF_C2000_SCI_STDOUT --gen_func_subsections=on --diag_warning=225 --diag_wrap=off --display_error_number --diag_suppress=10063"
linkerBuildOptions="--entry_point code_start --define=WOLF_SHA2_EXAMPLE --reread_libs --warn_sections -llibc.a" />
<configuration name="CPU1_LAUNCHXL_FLASH_DEBUG"
compilerBuildOptions="--opt_level=off -g -I${PROJECT_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${WOLFSSL_ROOT} -I${CG_TOOL_ROOT}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu1 --abi=eabi --define=CPU1 --define=_FLASH --define=_LAUNCHXL_F28P55X --define=WOLFSSL_USER_SETTINGS --define=WOLF_C2000_SCI_STDOUT --gen_func_subsections=on --diag_warning=225 --diag_wrap=off --display_error_number --diag_suppress=10063"
linkerBuildOptions="--entry_point code_start --define=WOLF_SHA2_EXAMPLE --reread_libs --warn_sections -llibc.a" />
<!-- Example application -->
<file action="copy" path="../../Source/test_sha2.c" targetDirectory="" />
<file action="copy" path="../../Source/c2000_board.c" targetDirectory="" />
<file action="copy" path="../../Header/c2000_board.h" targetDirectory="" />
<file action="copy" path="user_settings.h" targetDirectory="" />
<file action="copy" path="../../28p55x_wolf_flash_lnk.cmd" targetDirectory="" />
<!-- Device support from C2000Ware -->
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/source/device.c" targetDirectory="device" />
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/source/f28p55x_codestartbranch.asm" targetDirectory="device" />
<file action="link" path="${COM_TI_C2000WARE_INSTALL_DIR}/driverlib/f28p55x/driverlib/ccs/Release/driverlib.lib" targetDirectory="device" />
<file action="copy" path="${COM_TI_C2000WARE_INSTALL_DIR}/device_support/f28p55x/common/targetConfigs/TMS320F28P550SJ9_LaunchPad.ccxml" targetDirectory="targetConfigs" />
<!-- wolfCrypt sources, linked from WOLFSSL_ROOT -->
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/error.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/wc_port.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/memory.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/logging.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/misc.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/hash.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/sha256.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/sha512.c" targetDirectory="wolfcrypt" />
</project>
</projectSpec>

View File

@ -0,0 +1,155 @@
/* user_settings.h
*
* Copyright (C) 2006-2026 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* wolfSSL user settings for the SHA-3 (SHA3-224/256/384/512, SHAKE128, SHAKE256) example on the TI C2000 C28x
* (LAUNCHXL-F28P55X). Selected by defining WOLFSSL_USER_SETTINGS.
*
* The C28x has 16-bit bytes (CHAR_BIT == 16): every wolfCrypt byte buffer
* holds one octet per 16-bit cell. The platform settings below are required
* for that; the last section picks the hash algorithms.
*/
#ifndef WOLFSSL_USER_SETTINGS_C2000_SHA3_H
#define WOLFSSL_USER_SETTINGS_C2000_SHA3_H
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------------- */
/* Platform / C28x toolchain */
/* ------------------------------------------------------------------------- */
#undef SINGLE_THREADED
#define SINGLE_THREADED
#undef WOLFCRYPT_ONLY /* crypto only, no TLS layer */
#define WOLFCRYPT_ONLY
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
#undef NO_WRITEV
#define NO_WRITEV
#undef NO_MAIN_DRIVER /* main() lives in the example source */
#define NO_MAIN_DRIVER
#undef NO_DEV_RANDOM
#define NO_DEV_RANDOM
#undef WOLFSSL_IGNORE_FILE_WARN
#define WOLFSSL_IGNORE_FILE_WARN
/* C28x integer widths: char/short/int = 16-bit, long = 32-bit,
* long long = 64-bit. */
#undef SIZEOF_LONG
#define SIZEOF_LONG 4
#undef SIZEOF_LONG_LONG
#define SIZEOF_LONG_LONG 8
/* Use the toolchain's <limits.h> so CHAR_BIT is the real value (16 on C28x)
* instead of wolfSSL's 8-bit fallback. */
#undef HAVE_LIMITS_H
#define HAVE_LIMITS_H
/* 16-bit int: word16 = unsigned int, word32 = unsigned long. Without this
* wolfSSL assumes a 32-bit int and silently truncates 32-bit math. */
#undef WC_16BIT_CPU
#define WC_16BIT_CPU
/* Portable byte-by-byte paths; a byte buffer must never be cast to a wider
* word when a byte is 16 bits. */
#undef WOLFSSL_GENERAL_ALIGNMENT
#define WOLFSSL_GENERAL_ALIGNMENT 2
/* Portable C cores - no assembly. */
#undef WOLFSSL_NO_ASM
#define WOLFSSL_NO_ASM
/* Build misc.c as its own translation unit. The TI compiler emits no
* out-of-line copy of a plain `inline` definition, so the inline-misc path
* leaves helpers such as xorbuf unresolved at link. */
#undef NO_INLINE
#define NO_INLINE
/* Hashing only: no random number generator. */
#undef WC_NO_RNG
#define WC_NO_RNG
/* ------------------------------------------------------------------------- */
/* SHA-3 */
/* ------------------------------------------------------------------------- */
#undef WOLFSSL_SHA3
#define WOLFSSL_SHA3
#undef WOLFSSL_SHAKE128
#define WOLFSSL_SHAKE128
#undef WOLFSSL_SHAKE256
#define WOLFSSL_SHAKE256
#undef WC_SHA3_NO_ASM
#define WC_SHA3_NO_ASM
/* SHA-256 is on by default in wolfSSL; this example does not use it. */
#undef NO_SHA256
#define NO_SHA256
/* ------------------------------------------------------------------------- */
/* Everything else off: hashing only */
/* ------------------------------------------------------------------------- */
#undef NO_BIG_INT /* no multi-precision math */
#define NO_BIG_INT
#undef NO_RSA
#define NO_RSA
#undef NO_DH
#define NO_DH
#undef NO_DSA
#define NO_DSA
#undef NO_ASN
#define NO_ASN
#undef NO_CERTS
#define NO_CERTS
#undef NO_PWDBASED
#define NO_PWDBASED
#undef NO_PKCS7
#define NO_PKCS7
#undef NO_PKCS12
#define NO_PKCS12
#undef NO_SIG_WRAPPER
#define NO_SIG_WRAPPER
#undef NO_AES
#define NO_AES
#undef NO_DES3
#define NO_DES3
#undef NO_RC4
#define NO_RC4
#undef NO_MD4
#define NO_MD4
#undef NO_MD5
#define NO_MD5
#undef NO_SHA /* SHA-1 */
#define NO_SHA
#undef NO_HMAC
#define NO_HMAC
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_USER_SETTINGS_C2000_SHA3_H */

View File

@ -0,0 +1,53 @@
<projectSpec>
<project
name="wolfssl_sha3"
device="TMS320F28P550SJ9"
cgtVersion="22.6.3.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="false"
>
<!-- C2000WARE_ROOT comes from the C2000Ware product registered in CCS.
WOLFSSL_ROOT defaults to a wolfssl clone next to wolfssl-examples;
see ccs/README.md to change it. -->
<pathVariable name="C2000WARE_ROOT" path="${COM_TI_C2000WARE_INSTALL_DIR}" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="${COM_TI_C2000WARE_INSTALL_DIR}/driverlib/f28p55x/driverlib/" scope="project" />
<pathVariable name="WOLFSSL_ROOT" path="../../../../../wolfssl" scope="project" />
<configuration name="CPU1_LAUNCHXL_FLASH"
compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${WOLFSSL_ROOT} -I${CG_TOOL_ROOT}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu1 --abi=eabi --define=CPU1 --define=_FLASH --define=_LAUNCHXL_F28P55X --define=WOLFSSL_USER_SETTINGS --define=WOLF_C2000_SCI_STDOUT --gen_func_subsections=on --diag_warning=225 --diag_wrap=off --display_error_number --diag_suppress=10063"
linkerBuildOptions="--entry_point code_start --define=WOLF_SHA3_EXAMPLE --reread_libs --warn_sections -llibc.a" />
<configuration name="CPU1_LAUNCHXL_FLASH_DEBUG"
compilerBuildOptions="--opt_level=off -g -I${PROJECT_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${WOLFSSL_ROOT} -I${CG_TOOL_ROOT}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu1 --abi=eabi --define=CPU1 --define=_FLASH --define=_LAUNCHXL_F28P55X --define=WOLFSSL_USER_SETTINGS --define=WOLF_C2000_SCI_STDOUT --gen_func_subsections=on --diag_warning=225 --diag_wrap=off --display_error_number --diag_suppress=10063"
linkerBuildOptions="--entry_point code_start --define=WOLF_SHA3_EXAMPLE --reread_libs --warn_sections -llibc.a" />
<!-- Example application -->
<file action="copy" path="../../Source/test_sha3.c" targetDirectory="" />
<file action="copy" path="../../Source/c2000_board.c" targetDirectory="" />
<file action="copy" path="../../Header/c2000_board.h" targetDirectory="" />
<file action="copy" path="user_settings.h" targetDirectory="" />
<file action="copy" path="../../28p55x_wolf_flash_lnk.cmd" targetDirectory="" />
<!-- Device support from C2000Ware -->
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/source/device.c" targetDirectory="device" />
<file action="copy" path="${C2000WARE_ROOT}/device_support/f28p55x/common/source/f28p55x_codestartbranch.asm" targetDirectory="device" />
<file action="link" path="${COM_TI_C2000WARE_INSTALL_DIR}/driverlib/f28p55x/driverlib/ccs/Release/driverlib.lib" targetDirectory="device" />
<file action="copy" path="${COM_TI_C2000WARE_INSTALL_DIR}/device_support/f28p55x/common/targetConfigs/TMS320F28P550SJ9_LaunchPad.ccxml" targetDirectory="targetConfigs" />
<!-- wolfCrypt sources, linked from WOLFSSL_ROOT -->
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/error.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/wc_port.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/memory.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/logging.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/misc.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/hash.c" targetDirectory="wolfcrypt" />
<file action="link" path="WOLFSSL_ROOT/wolfcrypt/src/sha3.c" targetDirectory="wolfcrypt" />
</project>
</projectSpec>