aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Cuoq <cuoq@trust-in-soft.com>2015-10-19 22:24:23 +0200
committerKurt Roeckx <kurt@roeckx.be>2015-11-20 22:29:53 +0100
commit9f6795e7d2d1e35668ad70ba0afc480062be4e2e (patch)
treefb50b054a816007e859328affb98d317b17ac5f0
parent1786086b05714c284b337d5211b299e09b9cfad9 (diff)
downloadopenssl-9f6795e7d2d1e35668ad70ba0afc480062be4e2e.zip
openssl-9f6795e7d2d1e35668ad70ba0afc480062be4e2e.tar.gz
openssl-9f6795e7d2d1e35668ad70ba0afc480062be4e2e.tar.bz2
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
-rw-r--r--crypto/bn/bn_add.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bn/bn_add.c b/crypto/bn/bn_add.c
index 0bfc3cc..bbb0584 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;