-
+ EAF2827058A07C1502EA5DA210AE7B7662B6B02AC4847D37467FB498DDB84D592CCE814DB4B15588DA8C5349E4FFE4636D267FEDF0ECEB29E63BD8DCF0249BE2
smg_comms/mpi/mpi-scan.c
(0 . 0)(1 . 56)
5342 /* mpi-scan.c - MPI functions
5343 * Modified by No Such Labs. (C) 2015. See README.
5344 * Modified by S.MG 2017 (removed code that is not used by eucrypt and at the same time so ugly it needs rewrite anyway)
5345 *
5346 * This file was originally part of Gnu Privacy Guard (GPG), ver. 1.4.10,
5347 * SHA256(gnupg-1.4.10.tar.gz):
5348 * 0bfd74660a2f6cedcf7d8256db4a63c996ffebbcdc2cf54397bfb72878c5a85a
5349 * (C) 1994-2005 Free Software Foundation, Inc.
5350 *
5351 * This program is free software: you can redistribute it and/or modify
5352 * it under the terms of the GNU General Public License as published by
5353 * the Free Software Foundation, either version 3 of the License, or
5354 * (at your option) any later version.
5355 *
5356 * This program is distributed in the hope that it will be useful,
5357 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5358 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5359 * GNU General Public License for more details.
5360 *
5361 * You should have received a copy of the GNU General Public License
5362 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5363 */
5364
5365 #include <stdio.h>
5366 #include <stdlib.h>
5367
5368 #include "knobs.h"
5369 #include "mpi-internal.h"
5370 #include "longlong.h"
5371
5372
5373 /****************
5374 * Count the number of zerobits at the low end of A
5375 * This is used currently by eucrypt's primality tests.
5376 */
5377 unsigned int
5378 mpi_trailing_zeros( MPI a )
5379 {
5380 unsigned n, count = 0;
5381
5382 for(n=0; n < a->nlimbs; n++ ) {
5383 if( a->d[n] ) {
5384 unsigned nn;
5385 mpi_limb_t alimb = a->d[n];
5386
5387 count_trailing_zeros( nn, alimb );
5388 count += nn;
5389 break;
5390 }
5391 count += BITS_PER_MPI_LIMB;
5392 }
5393 return count;
5394
5395 }
5396
5397