Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.28] mbedtls_mpi_sub_abs: Skip memcpy when redundant (#6701). #7001

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

ucko
Copy link
Contributor

@ucko ucko commented Jan 31, 2023

In some contexts, the output pointer may equal the first input pointer, in which case copying is not only superfluous but results in "Source and destination overlap in memcpy" errors from Valgrind (as I observed in the context of ecp_double_jac) and a diagnostic message from TrustInSoft Analyzer (as Pascal Cuoq reported in the context of other ECP functions called by cert-app with a suitable certificate).

Signed-off-by: Aaron M. Ucko ucko@ncbi.nlm.nih.gov

Description

Backport of #6942.

Gatekeeper checklist

  • changelog provided, or not required
  • backport done, or not required
  • tests provided, or not required

Notes for the submitter

Please refer to the contributing guidelines, especially the
checklist for PR contributors.

In some contexts, the output pointer may equal the first input
pointer, in which case copying is not only superfluous but results in
"Source and destination overlap in memcpy" errors from Valgrind (as I
observed in the context of ecp_double_jac) and a diagnostic message
from TrustInSoft Analyzer (as Pascal Cuoq reported in the context of
other ECP functions called by cert-app with a suitable certificate).

Signed-off-by: Aaron M. Ucko <ucko@ncbi.nlm.nih.gov>
Copy link
Contributor

@tom-cosgrove-arm tom-cosgrove-arm left a comment

Choose a reason for hiding this comment

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

LGTM - faithful backport

@tom-cosgrove-arm tom-cosgrove-arm added component-crypto Crypto primitives and low-level interfaces needs-ci Needs to pass CI tests single-reviewer This PR qualifies for having only one reviewer priority-medium Medium priority - this can be reviewed as time permits labels Jan 31, 2023
@tom-cosgrove-arm tom-cosgrove-arm added the approved Design and code approved - may be waiting for CI or backports label Jan 31, 2023
@gilles-peskine-arm gilles-peskine-arm merged commit 45379cb into Mbed-TLS:mbedtls-2.28 Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports component-crypto Crypto primitives and low-level interfaces needs-ci Needs to pass CI tests priority-medium Medium priority - this can be reviewed as time permits single-reviewer This PR qualifies for having only one reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants