|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Use this extension to offload BigInt multiplication and Montgomery products to the ESP32-P4 Parallel Instruction Extension (PIE) vector unit. It supplements the RV32IM backend.
xespv2p1 instruction extension and a matching GCC toolchain. The integration scope is chip revision v1.3; compatibility with later revisions must be established before deployment.Keep the normal SharkSSL C sources and compile both SharkSslBigInt_P4.c and ../RISCV_GCC/SharkSslBigInt_RISCV.S. Apply these definitions to C and assembly:
Compile the .S file through GCC with the application's configuration and include paths. Link both objects; the P4 file calls the renamed RV32IM functions for operations outside its supported sizes.
Keep SHARKSSL_OPTIMIZED_BIGINT_WORD_ASM=0. The PIE selectors do not enable curve assembly. Use the RISC-V curve options for P-256 or X25519. Keep the target and ABI options consistent across C and assembly.
The backend uses RV32IM for multiplication below 16 words, squaring below 32 words, operands above 64 words, and operands longer than the modulus in Montgomery products. Consequently, the PIE path does not accelerate every key size or elliptic-curve operation.
Temporary buffers, vector registers and the extended accumulator are cleared before returning. The remaining alignment state depends on public lengths. See the RISC-V timing considerations.
AES-GCM and the AES block API use the bitsliced C AES in SharkSslAesGcmCT.h. Keep SHARKSSL_OPTIMIZED_AES_ASM, SHARKSSL_OPTIMIZED_GCM_ASM and SHARKSSL_OPTIMIZED_GHASH_ASM at 0: the generic crypto implementation rejects these options on this target. This backend does not use the ESP32-P4 AES peripheral.
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.