diff options
| author | Alex Shi <alex.shi@linaro.org> | 2016-12-05 12:01:22 +0800 |
|---|---|---|
| committer | Alex Shi <alex.shi@linaro.org> | 2016-12-05 12:01:22 +0800 |
| commit | 3ba1692e7239293d7bc5a596ca9b0707f5bc07d5 (patch) | |
| tree | e0a4ceba15a5ba39da4b3decc2e78a6754afc5ad /lib/mpi/mpi-pow.c | |
| parent | 072c0f9ee4023f380774186c8cb95c0118d2f8dc (diff) | |
| parent | 87c6c6ef5b17bfed9226f1307435910626817ebb (diff) | |
Merge tag 'v4.4.36' into linux-linaro-lsk-v4.4
This is the 4.4.36 stable release
Diffstat (limited to 'lib/mpi/mpi-pow.c')
| -rw-r--r-- | lib/mpi/mpi-pow.c | 7 |
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; } |
