diff options
author | Werner Koch <[email protected]> | 1997-11-26 21:06:44 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1997-11-26 21:06:44 +0000 |
commit | e655f8de8dc5b3926e6fece9a3364ed23854d826 (patch) | |
tree | 1e47616b6a5def5d65e08e5503a75d6171620cbb /mpi/mpih-add.c | |
parent | ElGamal funktioniert und ist default (diff) | |
download | gnupg-e655f8de8dc5b3926e6fece9a3364ed23854d826.tar.gz gnupg-e655f8de8dc5b3926e6fece9a3364ed23854d826.zip |
changed the dir layout
Diffstat (limited to 'mpi/mpih-add.c')
-rw-r--r-- | mpi/mpih-add.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/mpi/mpih-add.c b/mpi/mpih-add.c index 90ce8d76a..c01928d14 100644 --- a/mpi/mpih-add.c +++ b/mpi/mpih-add.c @@ -1,5 +1,6 @@ /* mpihelp-add.c - MPI helper functions * Copyright (c) 1997 by Werner Koch (dd9jn) + * Copyright (C) 1994, 1996 Free Software Foundation, Inc. * * This file is part of G10. * @@ -16,6 +17,14 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * Note: This code is heavily based on the GNU MP Library. + * Actually it's the same code with only minor changes in the + * way the data is stored; this is to support the abstraction + * of an optional secure memory allocation which may be used + * to avoid revealing of sensitive data due to paging etc. + * The GNU MP Library itself is published under the LGPL; + * however I decided to publish this code under the plain GPL. */ #include <config.h> @@ -29,6 +38,7 @@ * store the result in RES_PTR. Return the carry * S1_SIZE must be > 0. */ +#ifndef __GNUC__ /*_EXTERN_INLINE */ mpi_limb_t mpihelp_add_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, @@ -59,37 +69,6 @@ mpihelp_add_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, } -/* FIXME: this should be done in assembly */ -mpi_limb_t -mpihelp_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, - mpi_ptr_t s2_ptr, mpi_size_t size) -{ - mpi_limb_t x, y, cy; - mpi_size_t j; - - /* The loop counter and index J goes from -SIZE to -1. This way - the loop becomes faster. */ - j = -size; - - /* Offset the base pointers to compensate for the negative indices. */ - s1_ptr -= j; - s2_ptr -= j; - res_ptr -= j; - - cy = 0; - do { - y = s2_ptr[j]; - x = s1_ptr[j]; - y += cy; /* add previous carry to one addend */ - cy = y < cy? 1:0; /* get out carry from that addition */ - y += x; /* add other addend */ - cy += y < x? 1:0; /* get out carry from that add, combine */ - res_ptr[j] = y; - } while( ++j ); - - return cy; -} - /*_EXTERN_INLINE*/ mpi_limb_t @@ -106,4 +85,4 @@ mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, s1_size - s2_size, cy); return cy; } - +#endif |