summaryrefslogtreecommitdiff
path: root/lib/mpi
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2017-01-27 13:33:25 -0500
committerMike Marshall <hubcap@omnibond.com>2017-01-27 13:33:25 -0500
commita1f817dc8ed79cdff2b76bc51d545fb9465982be (patch)
tree2c92b9b7cdf3b0efb3b9ce33cd6f84ef4d54a1a7 /lib/mpi
parent04102c76a779f1c4cec4f0fb51cacc360117b522 (diff)
parent69973b830859bc6529a7a0468ba0d80ee5117826 (diff)
Merge tag 'v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into for-next
Linux 4.9
Diffstat (limited to 'lib/mpi')
-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;
}