From 78e819698b80d0c5b0c8114c2521808f308a994d Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 31 Dec 2013 11:16:03 +0100
Subject: [PATCH] Added missing MPI_CHK() around some statements
---
ChangeLog | 2 ++
library/bignum.c | 10 +++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 323663251..3bc8e9b50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@ Bugfix
* SSL now gracefully handles missing RNG
* crypt_and_hash app checks MAC before final decryption
* Fixed x509_crt_parse_path() bug on Windows platforms
+ * Added missing MPI_CHK() around some statements in mpi_div_mpi() (found by
+ TrustInSoft)
= Version 1.2.10 released 2013-10-07
Changes
diff --git a/library/bignum.c b/library/bignum.c
index 504f51bd4..23a3f6832 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1104,9 +1104,9 @@ int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B )
while( mpi_cmp_mpi( &X, &Y ) >= 0 )
{
Z.p[n - t]++;
- mpi_sub_mpi( &X, &X, &Y );
+ MPI_CHK( mpi_sub_mpi( &X, &X, &Y ) );
}
- mpi_shift_r( &Y, biL * (n - t) );
+ MPI_CHK( mpi_shift_r( &Y, biL * (n - t) ) );
for( i = n; i > t ; i-- )
{
@@ -1199,15 +1199,15 @@ int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B )
if( Q != NULL )
{
- mpi_copy( Q, &Z );
+ MPI_CHK( mpi_copy( Q, &Z ) );
Q->s = A->s * B->s;
}
if( R != NULL )
{
- mpi_shift_r( &X, k );
+ MPI_CHK( mpi_shift_r( &X, k ) );
X.s = A->s;
- mpi_copy( R, &X );
+ MPI_CHK( mpi_copy( R, &X ) );
if( mpi_cmp_int( R, 0 ) == 0 )
R->s = 1;