summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2016-12-06 16:00:48 -0800
committerDmitry Shmidt <dimitrysh@google.com>2016-12-06 16:00:48 -0800
commit25cfd071169c6481405f5c2c4d91bc6dcd051800 (patch)
tree2e09fcaa99e4fec7f8082b3b1c8b7e9179415c9c /lib
parentfa40ddf73c5d6c5c57fc6e79833ec48eb99cbf52 (diff)
parent87c6c6ef5b17bfed9226f1307435910626817ebb (diff)
Merge tag 'v4.4.36' into android-4.4.y
This is the 4.4.36 stable release Change-Id: I757d3c6e2c6d8722b38160885ec52e177ce0735a
Diffstat (limited to 'lib')
-rw-r--r--lib/mpi/mpi-pow.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c
index 5464c8744ea9..e24388a863a7 100644
--- a/lib/mpi/mpi-pow.c
+++ b/lib/mpi/mpi-pow.c
@@ -64,8 +64,13 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
if (!esize) {
/* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0
* depending on if MOD equals 1. */
- rp[0] = 1;
res->nlimbs = (msize == 1 && mod->d[0] == 1) ? 0 : 1;
+ if (res->nlimbs) {
+ if (mpi_resize(res, 1) < 0)
+ goto enomem;
+ rp = res->d;
+ rp[0] = 1;
+ }
res->sign = 0;
goto leave;
}