mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Merge pull request #6942 from ucko/2023a-bignum
mbedtls_mpi_sub_abs: Skip memcpy when redundant (#6701).
This commit is contained in:
@@ -1009,7 +1009,7 @@ int mbedtls_mpi_sub_abs(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi
|
||||
/* Set the high limbs of X to match A. Don't touch the lower limbs
|
||||
* because X might be aliased to B, and we must not overwrite the
|
||||
* significant digits of B. */
|
||||
if (A->n > n) {
|
||||
if (A->n > n && A != X) {
|
||||
memcpy(X->p + n, A->p + n, (A->n - n) * ciL);
|
||||
}
|
||||
if (X->n > A->n) {
|
||||
|
Reference in New Issue
Block a user