BN_usub: Don't copy when r and a the same
[openssl.git] / 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;