< prev index next >
src/jdk.crypto.ec/share/native/libsunec/impl/mpi.c
Print this page
rev 52893 : 8225603: Enhancement for big integers
Reviewed-by: darcy, ahgross, rhalade
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -32,11 +32,11 @@
*
* Contributor(s):
* Netscape Communications Corporation
* Douglas Stebila <douglas@stebila.ca> of Sun Laboratories.
*
- * Last Modified Date from the Original Code: Nov 2016
+ * Last Modified Date from the Original Code: Nov 2019
*********************************************************************** */
/* Arbitrary precision integer arithmetic library */
#include "mpi-priv.h"
@@ -2134,11 +2134,14 @@
MP_CHECKOK( mp_add(&f, &g, &f) ); /* f = f + g */
MP_CHECKOK( mp_add(c, &d, c) ); /* c = c + d */
}
}
if (res >= 0) {
- while (MP_SIGN(c) != MP_ZPOS) {
+ if (s_mp_cmp(c, p) >= 0) {
+ MP_CHECKOK( mp_div(c, p, NULL, c));
+ }
+ if (MP_SIGN(c) != MP_ZPOS) {
MP_CHECKOK( mp_add(c, p, c) );
}
res = k;
}
< prev index next >