Commit 33d4e690 authored by Bodo Möller's avatar Bodo Möller
Browse files

fix bn_expand2

parent 848c8495
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -425,7 +425,7 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, int words)

/* This is an internal function that should not be used in applications.
 * It ensures that 'b' has enough room for a 'words' word number
 * and initialises the unused part of b->d with leading zeros.
 * and initialises any unused part of b->d with leading zeros.
 * It is mostly used by the various BIGNUM routines. If there is an error,
 * NULL is returned. If not, 'b' is returned. */

@@ -450,6 +450,8 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
		}
	
	/* NB: bn_wexpand() calls this only if the BIGNUM really has to grow */
	if ((b != NULL) && (b->top < b->dmax))
		{
		A = &(b->d[b->top]);
		for (i=(words - b->top)>>3; i>0; i--,A+=8)
			{
@@ -458,6 +460,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
			}
		for (i=(words - b->top)&7; i>0; i--,A++)
			A[0]=0;
		}
		
	return b;
	}