Skip to content

Add MbedTLS signature verification#54

Open
mzella-ll wants to merge 1 commit into
CiscoDevNet:mainfrom
mzella-ll:feature/add-mbedtls-signature-verification
Open

Add MbedTLS signature verification#54
mzella-ll wants to merge 1 commit into
CiscoDevNet:mainfrom
mzella-ll:feature/add-mbedtls-signature-verification

Conversation

@mzella-ll

Copy link
Copy Markdown

Summary

This PR adds an MbedTLS-based implementation of signature_verify().

The existing OpenSSL implementation remains unchanged. When MBEDTLS is defined, the function now performs real ECDSA signature verification instead of falling back to the temporary stub.

Changes

  • Add MbedTLS includes for public-key handling, SHA-256 hashing, and ASN.1 parsing.
  • Add helper logic to parse DER-encoded ECDSA signatures and extract the r and s values.
  • Add an MbedTLS implementation of signature_verify().
  • Validate input data and signature pointers before verification.
  • Hash the input data using SHA-256.
  • Load the secp256r1 ECDSA curve.
  • Load the public key and verify it against the curve.
  • Verify the ECDSA signature using MbedTLS.

Motivation

Some embedded targets use MbedTLS instead of OpenSSL. These targets should be able to perform signature verification without depending on OpenSSL.

This change adds the missing MbedTLS verification backend while preserving the existing OpenSSL path.

Expected behavior

When built with MBEDTLS defined, signature_verify() verifies the provided ECDSA signature using MbedTLS.

When built with OPENSSL defined, the existing OpenSSL implementation is used.

When neither backend is enabled, the existing fallback behavior remains unchanged.

Related issue

Fixes #53

@manojnacsl manojnacsl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good on the proposal.

Could you describe and capture the testing performed for MbedTLS signature verification? Have you tested performing signature verification using MbedTLS along with FND?

@manojnacsl manojnacsl requested a review from woobagooba June 10, 2026 14:18
@manojnacsl manojnacsl added the enhancement New feature or request label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request renesas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MbedTLS support for signature verification

2 participants