BN_usub: Don't copy when r and a the same

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>

RT #4100, MR #1264
This commit is contained in:
Pascal Cuoq 2015-10-19 22:24:23 +02:00 committed by Kurt Roeckx
parent 1786086b05
commit 9f6795e7d2

View File

@ -222,7 +222,7 @@ int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
break;
}
}
if (dif)
if (dif && ap != rp)
memcpy(rp, ap, sizeof(*rp) * dif);
r->top = max;