]> granicus.if.org Git - openssl/commitdiff
BN_usub: Don't copy when r and a the same
authorPascal Cuoq <cuoq@trust-in-soft.com>
Mon, 19 Oct 2015 20:24:23 +0000 (22:24 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Fri, 20 Nov 2015 21:29:53 +0000 (22:29 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
RT #4100, MR #1264

crypto/bn/bn_add.c

index 0bfc3cc637b17181c387922f99a5252e9adfc203..bbb05842452e6558fead3bc84a1cb9cd1482ebbb 100644 (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;