-
+ 2FCC124504ADC576636A56BC387F7F6B73C60B263ED01A7DFFA2C2131F89AA6D337399EF9DB92C5423D25BA596A898AD1160AC1EAB5D49768AEAB14D08C29466eucrypt/mpi/mpih-mul1.c(0 . 0)(1 . 56)
6260 /* mpihelp-mul_1.c - MPI helper functions
6261 * Modified by No Such Labs. (C) 2015. See README.
6262 *
6263 * This file was originally part of Gnu Privacy Guard (GPG), ver. 1.4.10,
6264 * SHA256(gnupg-1.4.10.tar.gz):
6265 * 0bfd74660a2f6cedcf7d8256db4a63c996ffebbcdc2cf54397bfb72878c5a85a
6266 * (C) 1994-2005 Free Software Foundation, Inc.
6267 *
6268 * This program is free software: you can redistribute it and/or modify
6269 * it under the terms of the GNU General Public License as published by
6270 * the Free Software Foundation, either version 3 of the License, or
6271 * (at your option) any later version.
6272 *
6273 * This program is distributed in the hope that it will be useful,
6274 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6275 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6276 * GNU General Public License for more details.
6277 *
6278 * You should have received a copy of the GNU General Public License
6279 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6280 */
6281
6282 #include <stdio.h>
6283 #include <stdlib.h>
6284
6285 #include "knobs.h"
6286 #include "mpi-internal.h"
6287 #include "longlong.h"
6288
6289 mpi_limb_t
6290 mpihelp_mul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
6291 mpi_limb_t s2_limb)
6292 {
6293 mpi_limb_t cy_limb;
6294 mpi_size_t j;
6295 mpi_limb_t prod_high, prod_low;
6296
6297 /* The loop counter and index J goes from -S1_SIZE to -1. This way
6298 * the loop becomes faster. */
6299 j = -s1_size;
6300
6301 /* Offset the base pointers to compensate for the negative indices. */
6302 s1_ptr -= j;
6303 res_ptr -= j;
6304
6305 cy_limb = 0;
6306 do {
6307 umul_ppmm( prod_high, prod_low, s1_ptr[j], s2_limb );
6308 prod_low += cy_limb;
6309 cy_limb = (prod_low < cy_limb?1:0) + prod_high;
6310 res_ptr[j] = prod_low;
6311 } while( ++j );
6312
6313 return cy_limb;
6314 }
6315