From c2024f4592bbfa1f2d060a12b92da5bd2162008b Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Thu, 23 Jan 2014 20:38:35 +0100
Subject: [PATCH] Added MPI_CHK around unguarded mpi calls
---
library/bignum.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/library/bignum.c b/library/bignum.c
index 61b21fb688..bbd901e832 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1573,8 +1573,9 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
* W[1] = A * R^2 * R^-1 mod N = A * R mod N
*/
if( mpi_cmp_mpi( A, N ) >= 0 )
- mpi_mod_mpi( &W[1], A, N );
- else mpi_copy( &W[1], A );
+ MPI_CHK( mpi_mod_mpi( &W[1], A, N ) );
+ else
+ MPI_CHK( mpi_copy( &W[1], A ) );
mpi_montmul( &W[1], &RR, N, mm, &T );
@@ -1694,7 +1695,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
if( neg )
{
X->s = -1;
- mpi_add_mpi( X, N, X );
+ MPI_CHK( mpi_add_mpi( X, N, X ) );
}
cleanup: