Skip to content

Commit

Permalink
Speed up SPAKE2+ point multiplication on devices with HSE (3)
Browse files Browse the repository at this point in the history
Replace the last instance of mbedtls_ecp_mul with the accelerated operation
  • Loading branch information
stevew817 committed Feb 3, 2023
1 parent 5ede175 commit 8fb6543
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/platform/silabs/EFR32/CHIPCryptoPALPsaEfr32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,8 +1402,16 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le
result = mbedtls_mpi_mod_mpi(&w1_bn, &w1_bn, &context->curve.N);
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);

#if defined(SEMAILBOX_PRESENT)
// Do the point multiplication using hardware acceleration via ECDH primitive
error = PointMul(&Ltemp, &context->curve.G, &w1_bn);
if (error != CHIP_NO_ERROR) {
goto exit;
}
#else /* SEMAILBOX_PRESENT */
result = mbedtls_ecp_mul(&context->curve, &Ltemp, &w1_bn, &context->curve.G, CryptoRNG, nullptr);
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
#endif /* SEMAILBOX_PRESENT */

memset(Lout, 0, *L_len);

Expand Down

0 comments on commit 8fb6543

Please sign in to comment.