|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Use this backend for Kinetis K60 cryptography with the Memory-Mapped Cryptographic Acceleration Unit (MMCAU) and Cortex-M assembly.
Use a little-endian K60 target, compatible assembler and the platform MMCAU/RNG support required by SharkSslCrypto_K60.c. Supply the target types, memory, time, mutex and entropy integration for the application.
Compile SharkSslBigInt_M3.s together with SharkSslBigInt.c and enable the assembly backend:
Add these definitions to TargConfig.h:
Compile SharkSslCrypto_K60.c in place of SharkSslCrypto.c. Enable the Memory-Mapped Cryptographic Acceleration Unit (MMCAU):
The hash footprint options apply when the corresponding hash is enabled. For each option, 1 selects smaller, slower code; 0 selects larger, faster code.
| Hash | Enabled by | Footprint option |
|---|---|---|
| MD5 | SHARKSSL_USE_MD5 | SHARKSSL_MD5_SMALL_FOOTPRINT |
| SHA-1 | SHARKSSL_USE_SHA1 | SHARKSSL_SHA1_SMALL_FOOTPRINT |
| SHA-256 | SHARKSSL_USE_SHA_256 | SHARKSSL_SHA256_SMALL_FOOTPRINT |
The K60 implementation uses the native Hash_DRBG random generator. Supply unpredictable entropy through sharkssl_entropyEx before operations that require randomness. Follow the random-generator configuration for seed sizes and initialization order. Provide the target mutex services needed to serialize access to MMCAU.
Compile SharkSslCrypto_M3.s and enable both assembly implementations:
Apply the same algorithm and optimization definitions throughout the build. Select only the hashes and ciphers needed by the application. The hash footprint switches above accept integer 0 or 1; follow the current configuration header for their defaults.
Keep SHARKSSL_OPTIMIZED_AES_ASM, SHARKSSL_OPTIMIZED_GCM_ASM and SHARKSSL_OPTIMIZED_GHASH_ASM at 0. The K60 replacement file does not select those x86/AArch64 backends.
SharkSslCrypto_K60.c replaces SharkSslCrypto.c; do not compile both. The K60 file uses MMCAU for AES rounds and C for GHASH. With the portable SharkSslCrypto.c instead, AES uses the bitsliced C implementation and unsupported assembly selectors are rejected.
The MMCAU selection does not supply application entropy or initialize the target scheduler. Supply the required initialization and locking for the application's runtime.
SHA and HMAC context operations return int: check for 0 on success and a negative result on failure. Use SharkSslHMACCtx_destructor to clear the context after use, including after failed initialization. MMCAU hash operations do not expose a separate hardware-fault status channel. Supply the application clock when using a port that requires baGetUnixTime.
The AES block API, CBC, CTR and CCM use SharkSslAesCtx. These application APIs do not add TLS cipher suites. SharkSSL TLS uses AES-GCM or ChaCha20-Poly1305 for record protection.