From 026f555df39824d9382fc3a43f200709f6ade108 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 5 Jun 2020 10:48:25 +0200 Subject: [PATCH] Explicitly cast down from mbedtls_mpi_uint to unsigned char Let code analyzers know that this is deliberate. For example MSVC warns about the conversion if it's implicit. Signed-off-by: Gilles Peskine --- library/bignum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/bignum.c b/library/bignum.c index aecd461b2..487f1ef9c 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -2051,7 +2051,7 @@ static void mpi_montmul( mbedtls_mpi *A, const mbedtls_mpi *B, const mbedtls_mpi /* Now d - (2^biL)^n = A - N so d >= (2^biL)^n iff A >= N. * So we want to copy the result of the subtraction iff d->p[n] != 0. * Note that d->p[n] is either 0 or 1 since A - N <= N <= (2^biL)^n. */ - mpi_safe_cond_assign( n + 1, A->p, d, d[n] ); + mpi_safe_cond_assign( n + 1, A->p, d, (unsigned char) d[n] ); A->p[n] = 0; }