Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: nss/lib/freebl/ecl/ec_naf.c

Issue 1843333003: Update NSPR to 4.12 and NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 4
5 #include "ecl-priv.h" 5 #include "ecl-priv.h"
6 6
7 /* Returns 2^e as an integer. This is meant to be used for small powers of 7 /* Returns 2^e as an integer. This is meant to be used for small powers of
8 * two. */ 8 * two. */
9 int 9 int
10 ec_twoTo(int e) 10 ec_twoTo(int e)
(...skipping 30 matching lines...) Expand all
41 /* Compute wNAF form */ 41 /* Compute wNAF form */
42 while (mp_cmp_z(&k) > 0) { 42 while (mp_cmp_z(&k) > 0) {
43 if (mp_isodd(&k)) { 43 if (mp_isodd(&k)) {
44 out[i] = MP_DIGIT(&k, 0) & mask; 44 out[i] = MP_DIGIT(&k, 0) & mask;
45 if (out[i] >= twowm1) 45 if (out[i] >= twowm1)
46 out[i] -= 2 * twowm1; 46 out[i] -= 2 * twowm1;
47 47
48 /* Subtract off out[i]. Note mp_sub_d only works with 48 /* Subtract off out[i]. Note mp_sub_d only works with
49 * unsigned digits */ 49 * unsigned digits */
50 if (out[i] >= 0) { 50 if (out[i] >= 0) {
51 » » » » mp_sub_d(&k, out[i], &k); 51 » » » » MP_CHECKOK(mp_sub_d(&k, out[i], &k));
52 } else { 52 } else {
53 » » » » mp_add_d(&k, -(out[i]), &k); 53 » » » » MP_CHECKOK(mp_add_d(&k, -(out[i]), &k));
54 } 54 }
55 } else { 55 } else {
56 out[i] = 0; 56 out[i] = 0;
57 } 57 }
58 » » mp_div_2(&k, &k); 58 » » MP_CHECKOK(mp_div_2(&k, &k));
59 i++; 59 i++;
60 } 60 }
61 /* Zero out the remaining elements of the out array. */ 61 /* Zero out the remaining elements of the out array. */
62 for (; i < bitsize + 1; i++) { 62 for (; i < bitsize + 1; i++) {
63 out[i] = 0; 63 out[i] = 0;
64 } 64 }
65 CLEANUP: 65 CLEANUP:
66 mp_clear(&k); 66 mp_clear(&k);
67 return res; 67 return res;
68 68
69 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698