From: Pascal Cuoq Date: Mon, 19 Oct 2015 20:24:23 +0000 (+0200) Subject: BN_usub: Don't copy when r and a the same X-Git-Tag: OpenSSL_1_1_0-pre1~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f6795e7d2d1e35668ad70ba0afc480062be4e2e;p=openssl BN_usub: Don't copy when r and a the same Signed-off-by: Kurt Roeckx Reviewed-by: Rich Salz RT #4100, MR #1264 --- diff --git a/crypto/bn/bn_add.c b/crypto/bn/bn_add.c index 0bfc3cc637..bbb0584245 100644 --- a/crypto/bn/bn_add.c +++ b/crypto/bn/bn_add.c @@ -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;