The unified diff between revisions [0dc5b2d6..] and [b14c94b9..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'bn_mp_neg.c'
#
#
# patch "bn_mp_neg.c"
# from [afc6d203cc58d956e118f218c440bca91f94adce]
# to [02cb8735d235feb2f3016b581f23d6da582f8765]
#
============================================================
--- bn_mp_neg.c afc6d203cc58d956e118f218c440bca91f94adce
+++ bn_mp_neg.c 02cb8735d235feb2f3016b581f23d6da582f8765
@@ -19,12 +19,18 @@ int mp_neg (mp_int * a, mp_int * b)
int mp_neg (mp_int * a, mp_int * b)
{
int res;
- if ((res = mp_copy (a, b)) != MP_OKAY) {
- return res;
+ if (a != b) {
+ if ((res = mp_copy (a, b)) != MP_OKAY) {
+ return res;
+ }
}
+
if (mp_iszero(b) != MP_YES) {
b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS;
+ } else {
+ b->sign = MP_ZPOS;
}
+
return MP_OKAY;
}
#endif