bn_copy() does the right thing if source and target are the same, so
there is no need for an additional check.
Requested by jsing
-/* $OpenBSD: bn_mul.c,v 1.35 2023/03/27 10:22:47 tb Exp $ */
+/* $OpenBSD: bn_mul.c,v 1.36 2023/03/30 14:28:56 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
BN_set_negative(rr, a->neg ^ b->neg);
- if (r != rr) {
- if (!bn_copy(r, rr))
- goto err;
- }
+ if (!bn_copy(r, rr))
+ goto err;
done:
ret = 1;
err:
-/* $OpenBSD: bn_sqr.c,v 1.28 2023/03/27 10:22:47 tb Exp $ */
+/* $OpenBSD: bn_sqr.c,v 1.29 2023/03/30 14:28:56 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
rr->neg = 0;
- if (rr != r) {
- if (!bn_copy(r, rr))
- goto err;
- }
-
+ if (!bn_copy(r, rr))
+ goto err;
done:
ret = 1;
err: