diff options
author | Moritz Schulte <mo@g10code.com> | 2003-06-09 13:44:12 +0000 |
---|---|---|
committer | Moritz Schulte <mo@g10code.com> | 2003-06-09 13:44:12 +0000 |
commit | 9a06555b17e1bec8f13bf21473b24e6029f380a8 (patch) | |
tree | 59a2112345fe749c94a7cf93cc3f03009d2d5b4f | |
parent | 2ed6eec3359bbf04e819a260d6011d613151b5fd (diff) | |
download | libgcrypt-9a06555b17e1bec8f13bf21473b24e6029f380a8.tar.gz |
2003-06-09 Moritz Schulte <moritz@g10code.com>
* mpicoder.c (gcry_mpi_scan): Adjust for libgpg-error.
(gcry_mpi_print): Likewise.
(gcry_mpi_aprint): Likewise.
2003-06-07 Moritz Schulte <moritz@g10code.com>
* longlong.h, mpi-add.c, mpi-bit.c, mpi-cmp.c, mpi-div.c,
mpi-gcd.c, mpi-inline.c, mpi-inline.h, mpi-internal.h, mpi-inv.c,
mpi-mpow.c, mpi-mul.c, mpi-pow.c, mpi-scan.c, mpicoder.c,
mpih-div.c, mpih-mul.c, mpiutil.c, generic/mpi-asm-defs.h,
generic/mpih-add1.c, generic/mpih-lshift.c, generic/mpih-mul1.c,
generic/mpih-mul2.c, generic/mpih-mul3.c, generic/mpih-rshift.c,
generic/mpih-sub1.c, generic/udiv-w-sdiv.c, i386/syntax.h,
m68k/syntax.h, mips3/mpi-asm-defs.h, powerpc32/syntax.h: Edited
all preprocessor instructions to remove whitespace before the '#'.
This is not required by C89, but there are some compilers out
there that don't like it. Replaced any occurence of the now
deprecated type names with the new ones.
-rw-r--r-- | mpi/ChangeLog | 21 | ||||
-rw-r--r-- | mpi/mpi-inline.h | 2 | ||||
-rw-r--r-- | mpi/mpi-internal.h | 18 | ||||
-rw-r--r-- | mpi/mpi-inv.c | 8 | ||||
-rw-r--r-- | mpi/mpi-mpow.c | 12 | ||||
-rw-r--r-- | mpi/mpicoder.c | 102 | ||||
-rw-r--r-- | mpi/mpih-div.c | 4 | ||||
-rw-r--r-- | mpi/mpiutil.c | 30 | ||||
-rw-r--r-- | mpi/powerpc32/syntax.h | 8 |
9 files changed, 112 insertions, 93 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 96085c9a..d97846c1 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,24 @@ +2003-06-09 Moritz Schulte <moritz@g10code.com> + + * mpicoder.c (gcry_mpi_scan): Adjust for libgpg-error. + (gcry_mpi_print): Likewise. + (gcry_mpi_aprint): Likewise. + +2003-06-07 Moritz Schulte <moritz@g10code.com> + + * longlong.h, mpi-add.c, mpi-bit.c, mpi-cmp.c, mpi-div.c, + mpi-gcd.c, mpi-inline.c, mpi-inline.h, mpi-internal.h, mpi-inv.c, + mpi-mpow.c, mpi-mul.c, mpi-pow.c, mpi-scan.c, mpicoder.c, + mpih-div.c, mpih-mul.c, mpiutil.c, generic/mpi-asm-defs.h, + generic/mpih-add1.c, generic/mpih-lshift.c, generic/mpih-mul1.c, + generic/mpih-mul2.c, generic/mpih-mul3.c, generic/mpih-rshift.c, + generic/mpih-sub1.c, generic/udiv-w-sdiv.c, i386/syntax.h, + m68k/syntax.h, mips3/mpi-asm-defs.h, powerpc32/syntax.h: Edited + all preprocessor instructions to remove whitespace before the '#'. + This is not required by C89, but there are some compilers out + there that don't like it. Replaced any occurence of the now + deprecated type names with the new ones. + 2003-05-21 Moritz Schulte <moritz@g10code.com> * mpiutil.c (_gcry_mpi_alloc_limb_space): Only try to allocate diff --git a/mpi/mpi-inline.h b/mpi/mpi-inline.h index 939dcd68..88d9f56c 100644 --- a/mpi/mpi-inline.h +++ b/mpi/mpi-inline.h @@ -29,7 +29,7 @@ #define G10_MPI_INLINE_H #ifndef G10_MPI_INLINE_DECL - #define G10_MPI_INLINE_DECL extern __inline__ +#define G10_MPI_INLINE_DECL extern __inline__ #endif G10_MPI_INLINE_DECL mpi_limb_t diff --git a/mpi/mpi-internal.h b/mpi/mpi-internal.h index 1eacc704..4fbd8e51 100644 --- a/mpi/mpi-internal.h +++ b/mpi/mpi-internal.h @@ -44,7 +44,7 @@ typedef unsigned short int mpi_limb_t; typedef signed short int mpi_limb_signed_t; #else - #error BYTES_PER_MPI_LIMB does not match any C type +#error BYTES_PER_MPI_LIMB does not match any C type #endif #define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB) #endif /*BITS_PER_MPI_LIMB*/ @@ -58,13 +58,13 @@ * checking a 768 and a 1024 bit ElGamal signature. * (wk 22.12.97) */ #ifndef KARATSUBA_THRESHOLD - #define KARATSUBA_THRESHOLD 16 +#define KARATSUBA_THRESHOLD 16 #endif /* The code can't handle KARATSUBA_THRESHOLD smaller than 2. */ #if KARATSUBA_THRESHOLD < 2 - #undef KARATSUBA_THRESHOLD - #define KARATSUBA_THRESHOLD 2 +#undef KARATSUBA_THRESHOLD +#define KARATSUBA_THRESHOLD 2 #endif @@ -170,13 +170,13 @@ typedef int mpi_size_t; /* (must be a signed type) */ /*-- mpiutil.c --*/ #ifdef M_DEBUG - #define mpi_alloc_limb_space(n,f) _gcry_mpi_debug_alloc_limb_space((n),(f), M_DBGINFO( __LINE__ ) ) - #define mpi_free_limb_space(n) _gcry_mpi_debug_free_limb_space((n), M_DBGINFO( __LINE__ ) ) +#define mpi_alloc_limb_space(n,f) _gcry_mpi_debug_alloc_limb_space((n),(f), M_DBGINFO( __LINE__ ) ) +#define mpi_free_limb_space(n) _gcry_mpi_debug_free_limb_space((n), M_DBGINFO( __LINE__ ) ) mpi_ptr_t _gcry_mpi_debug_alloc_limb_space( unsigned nlimbs, int sec, const char *info ); void _gcry_mpi_debug_free_limb_space( mpi_ptr_t a, const char *info ); #else - #define mpi_alloc_limb_space(n,f) _gcry_mpi_alloc_limb_space((n),(f)) - #define mpi_free_limb_space(n) _gcry_mpi_free_limb_space((n)) +#define mpi_alloc_limb_space(n,f) _gcry_mpi_alloc_limb_space((n),(f)) +#define mpi_free_limb_space(n) _gcry_mpi_free_limb_space((n)) mpi_ptr_t _gcry_mpi_alloc_limb_space( unsigned nlimbs, int sec ); void _gcry_mpi_free_limb_space( mpi_ptr_t a ); #endif @@ -274,7 +274,7 @@ mpi_limb_t _gcry_mpih_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, #endif #ifdef __GNUC__ - #include "mpi-inline.h" +#include "mpi-inline.h" #endif #endif /*G10_MPI_INTERNAL_H*/ diff --git a/mpi/mpi-inv.c b/mpi/mpi-inv.c index 80efd62d..b44cb676 100644 --- a/mpi/mpi-inv.c +++ b/mpi/mpi-inv.c @@ -32,7 +32,7 @@ void _gcry_mpi_invm( MPI x, MPI a, MPI n ) { - #if 0 +#if 0 MPI u, v, u1, u2, u3, v1, v2, v3, q, t1, t2, t3; MPI ta, tb, tc; @@ -76,7 +76,7 @@ _gcry_mpi_invm( MPI x, MPI a, MPI n ) mpi_free(t3); mpi_free(u); mpi_free(v); - #elif 0 +#elif 0 /* Extended Euclid's algorithm (See TAOCP Vol II, 4.5.2, Alg X) * modified according to Michael Penk's solution for Exercise 35 */ @@ -157,7 +157,7 @@ _gcry_mpi_invm( MPI x, MPI a, MPI n ) mpi_free(t1); mpi_free(t2); mpi_free(t3); - #else +#else /* Extended Euclid's algorithm (See TAOCP Vol II, 4.5.2, Alg X) * modified according to Michael Penk's solution for Exercise 35 * with further enhancement */ @@ -263,7 +263,7 @@ _gcry_mpi_invm( MPI x, MPI a, MPI n ) mpi_free(u); mpi_free(v); - #endif +#endif } diff --git a/mpi/mpi-mpow.c b/mpi/mpi-mpow.c index 0eef51f1..e8f43d1a 100644 --- a/mpi/mpi-mpow.c +++ b/mpi/mpi-mpow.c @@ -70,10 +70,10 @@ _gcry_mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) int i, j, idx; MPI *G; /* table with precomputed values of size 2^k */ MPI tmp; - #ifdef USE_BARRETT +#ifdef USE_BARRETT MPI barrett_y, barrett_r1, barrett_r2; int barrett_k; - #endif +#endif for(k=0; basearray[k]; k++ ) ; @@ -90,9 +90,9 @@ _gcry_mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) assert( k < 10 ); G = gcry_xcalloc( (1<<k) , sizeof *G ); - #ifdef USE_BARRETT +#ifdef USE_BARRETT barrett_y = init_barrett( m, &barrett_k, &barrett_r1, &barrett_r2 ); - #endif +#endif /* and calculate */ tmp = mpi_alloc( mpi_get_nlimbs(m)+1 ); mpi_set_ui( res, 1 ); @@ -123,11 +123,11 @@ _gcry_mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) /* cleanup */ mpi_free(tmp); - #ifdef USE_BARRETT +#ifdef USE_BARRETT mpi_free(barrett_y); mpi_free(barrett_r1); mpi_free(barrett_r2); - #endif +#endif for(i=0; i < (1<<k); i++ ) mpi_free(G[i]); gcry_free(G); diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c index 7e2c9f21..ad5a5ce7 100644 --- a/mpi/mpicoder.c +++ b/mpi/mpicoder.c @@ -1,5 +1,5 @@ /* mpicoder.c - Coder for the external representation of MPIs - * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -173,18 +173,18 @@ mpi_print( FILE *fp, MPI a, int mode ) else { if( a->sign ) putc('-', fp); - #if BYTES_PER_MPI_LIMB == 2 +#if BYTES_PER_MPI_LIMB == 2 #define X "4" - #elif BYTES_PER_MPI_LIMB == 4 +#elif BYTES_PER_MPI_LIMB == 4 #define X "8" - #elif BYTES_PER_MPI_LIMB == 8 +#elif BYTES_PER_MPI_LIMB == 8 #define X "16" - #else +#else #error please define the format here - #endif +#endif for(i=a->nlimbs; i > 0 ; i-- ) { n += fprintf(fp, i!=a->nlimbs? "%0" X "lX":"%lX", (ulong)a->d[i-1]); - #undef X +#undef X } if( !a->nlimbs ) putc('0', fp ); @@ -232,12 +232,12 @@ do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure ) for(i=a->nlimbs-1; i >= 0; i-- ) { alimb = a->d[i]; - #if BYTES_PER_MPI_LIMB == 4 +#if BYTES_PER_MPI_LIMB == 4 *p++ = alimb >> 24; *p++ = alimb >> 16; *p++ = alimb >> 8; *p++ = alimb ; - #elif BYTES_PER_MPI_LIMB == 8 +#elif BYTES_PER_MPI_LIMB == 8 *p++ = alimb >> 56; *p++ = alimb >> 48; *p++ = alimb >> 40; @@ -246,9 +246,9 @@ do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure ) *p++ = alimb >> 16; *p++ = alimb >> 8; *p++ = alimb ; - #else +#else #error please implement for this limb size. - #endif +#endif } /* this is sub-optimal but we need to do the shift oepration because @@ -289,12 +289,12 @@ _gcry_mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign ) a->sign = sign; for(i=0, p = buffer+nbytes-1; p >= buffer+BYTES_PER_MPI_LIMB; ) { - #if BYTES_PER_MPI_LIMB == 4 +#if BYTES_PER_MPI_LIMB == 4 alimb = *p-- ; alimb |= *p-- << 8 ; alimb |= *p-- << 16 ; alimb |= *p-- << 24 ; - #elif BYTES_PER_MPI_LIMB == 8 +#elif BYTES_PER_MPI_LIMB == 8 alimb = (mpi_limb_t)*p-- ; alimb |= (mpi_limb_t)*p-- << 8 ; alimb |= (mpi_limb_t)*p-- << 16 ; @@ -303,18 +303,18 @@ _gcry_mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign ) alimb |= (mpi_limb_t)*p-- << 40 ; alimb |= (mpi_limb_t)*p-- << 48 ; alimb |= (mpi_limb_t)*p-- << 56 ; - #else +#else #error please implement for this limb size. - #endif +#endif a->d[i++] = alimb; } if( p >= buffer ) { - #if BYTES_PER_MPI_LIMB == 4 +#if BYTES_PER_MPI_LIMB == 4 alimb = *p-- ; if( p >= buffer ) alimb |= *p-- << 8 ; if( p >= buffer ) alimb |= *p-- << 16 ; if( p >= buffer ) alimb |= *p-- << 24 ; - #elif BYTES_PER_MPI_LIMB == 8 +#elif BYTES_PER_MPI_LIMB == 8 alimb = (mpi_limb_t)*p-- ; if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 8 ; if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 16 ; @@ -323,9 +323,9 @@ _gcry_mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign ) if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 40 ; if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 48 ; if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 56 ; - #else +#else #error please implement for this limb size. - #endif +#endif a->d[i++] = alimb; } a->nlimbs = i; @@ -334,7 +334,7 @@ _gcry_mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign ) -int +gpg_error_t gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, const char *buffer, size_t *nbytes ) { @@ -359,7 +359,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, if( a->sign ) { /* FIXME: we have to convert from 2compl to magnitude format */ mpi_free(a); - return GCRYERR_INTERNAL; + return gpg_error (GPG_ERR_INTERNAL); } else _gcry_mpi_set_buffer( a, s, len, 0 ); @@ -370,7 +370,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, } else mpi_free(a); - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_USG ) { a = mpi_alloc( (len+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB ); @@ -382,7 +382,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, } else mpi_free(a); - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_PGP ) { a = mpi_read_from_buffer( (char*)buffer, &len, 0 ); @@ -394,20 +394,20 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, } else mpi_free(a); - return a? 0 : GCRYERR_INV_OBJ; + return gpg_error (a ? GPG_ERR_NO_ERROR : GPG_ERR_INV_OBJ); } else if( format == GCRYMPI_FMT_SSH ) { const byte *s = buffer; size_t n; if( len && len < 4 ) - return GCRYERR_TOO_SHORT; + return gpg_error (GPG_ERR_TOO_SHORT); n = s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]; s += 4; if (len) len -= 4; if( len && n > len ) - return GCRYERR_TOO_LARGE; /* or should it be too_short */ + return gpg_error (GPG_ERR_TOO_LARGE); /* or should it be too_short */ a = mpi_alloc( (n+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB ); if( n ) { /* not zero */ @@ -415,7 +415,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, if( a->sign ) { /* FIXME: we have to convert from 2compl to magnitude format */ mpi_free(a); - return GCRYERR_INTERNAL; + return gpg_error (GPG_ERR_INTERNAL); } else _gcry_mpi_set_buffer( a, s, n, 0 ); @@ -428,24 +428,24 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, } else mpi_free(a); - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_HEX ) { if( nbytes ) - return GCRYERR_INV_ARG; /* can only handle C strings for now */ + return gpg_error (GPG_ERR_INV_ARG); /* can only handle C strings for now */ a = mpi_alloc(0); if( mpi_fromstr( a, buffer ) ) - return GCRYERR_INV_OBJ; + return gpg_error (GPG_ERR_INV_OBJ); if( ret_mpi ) { mpi_normalize ( a ); *ret_mpi = a; } else mpi_free(a); - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else - return GCRYERR_INV_ARG; + return gpg_error (GPG_ERR_INV_ARG); } /**************** @@ -453,7 +453,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, * Returns the number of bytes actually written in nbytes. * Buffer maybe NULL to query the required length of the buffer */ -int +gpg_error_t gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, struct gcry_mpi *a ) { @@ -461,7 +461,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, size_t len; if( !nbytes ) - return GCRYERR_INV_ARG; + return gpg_error (GPG_ERR_INV_ARG); len = *nbytes; *nbytes = 0; @@ -471,7 +471,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, unsigned int n; if( a->sign ) - return GCRYERR_INTERNAL; /* can't handle it yet */ + return gpg_error (GPG_ERR_INTERNAL); /* can't handle it yet */ tmp = _gcry_mpi_get_buffer( a, &n, NULL ); if( n && (*tmp & 0x80) ) { @@ -481,7 +481,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, if (buffer && n > len) { gcry_free(tmp); - return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ + return gpg_error (GPG_ERR_TOO_SHORT); /* the provided buffer is too short */ } if( buffer ) { byte *s = buffer; @@ -492,7 +492,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, } gcry_free(tmp); *nbytes = n; - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_USG ) { unsigned int n = (nbits + 7)/8; @@ -501,7 +501,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, /* FIXME: for performance reasons we should put this into * mpi_aprint becuase we can then use the buffer directly */ if (buffer && n > len) - return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ + return gpg_error (GPG_ERR_TOO_SHORT); /* the provided buffer is too short */ if( buffer ) { char *tmp; tmp = _gcry_mpi_get_buffer( a, &n, NULL ); @@ -509,16 +509,16 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, gcry_free(tmp); } *nbytes = n; - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_PGP ) { unsigned int n = (nbits + 7)/8; if( a->sign ) - return GCRYERR_INV_ARG; /* pgp format can only handle unsigned */ + return gpg_error (GPG_ERR_INV_ARG); /* pgp format can only handle unsigned */ if (buffer && n+2 > len) - return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ + return gpg_error (GPG_ERR_TOO_SHORT); /* the provided buffer is too short */ if( buffer ) { char *tmp; byte *s = buffer; @@ -530,7 +530,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, gcry_free(tmp); } *nbytes = n+2; - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_SSH ) { char *tmp; @@ -538,7 +538,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, unsigned int n; if( a->sign ) - return GCRYERR_INTERNAL; /* can't handle it yet */ + return gpg_error (GPG_ERR_INTERNAL); /* can't handle it yet */ tmp = _gcry_mpi_get_buffer( a, &n, NULL ); if( n && (*tmp & 0x80) ) { @@ -548,7 +548,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, if (buffer && n+4 > len) { gcry_free(tmp); - return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ + return gpg_error (GPG_ERR_TOO_SHORT); /* the provided buffer is too short */ } if( buffer ) { byte *s = buffer; @@ -563,7 +563,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, } gcry_free(tmp); *nbytes = 4+n; - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else if( format == GCRYMPI_FMT_HEX ) { byte *tmp; @@ -577,7 +577,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, if(buffer && 2*n + extra + !!a->sign + 1 > len) { gcry_free(tmp); - return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ + return gpg_error (GPG_ERR_TOO_SHORT); /* the provided buffer is too short */ } if( buffer ) { byte *s = buffer; @@ -601,10 +601,10 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, *nbytes = 2*n + extra + !!a->sign + 1; } gcry_free(tmp); - return 0; + return gpg_error (GPG_ERR_NO_ERROR); } else - return GCRYERR_INV_ARG; + return gpg_error (GPG_ERR_INV_ARG); } /**************** @@ -612,12 +612,12 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, * The caller has to supply the address of a pointer. nbytes may be * NULL. */ -int +gpg_error_t gcry_mpi_aprint( enum gcry_mpi_format format, void **buffer, size_t *nbytes, struct gcry_mpi *a ) { size_t n; - int rc; + gpg_error_t rc; *buffer = NULL; rc = gcry_mpi_print( format, NULL, &n, a ); @@ -633,5 +633,3 @@ gcry_mpi_aprint( enum gcry_mpi_format format, void **buffer, size_t *nbytes, *nbytes = n; return rc; } - - diff --git a/mpi/mpih-div.c b/mpi/mpih-div.c index 227f9953..e41e205e 100644 --- a/mpi/mpih-div.c +++ b/mpi/mpih-div.c @@ -32,10 +32,10 @@ #include "longlong.h" #ifndef UMUL_TIME - #define UMUL_TIME 1 +#define UMUL_TIME 1 #endif #ifndef UDIV_TIME - #define UDIV_TIME UMUL_TIME +#define UDIV_TIME UMUL_TIME #endif /* FIXME: We should be using invert_limb (or invert_normalized_limb) diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index 072c95f0..89631d3b 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -318,42 +318,42 @@ gcry_mpi_swap( MPI a, MPI b) } -GCRY_MPI +gcry_mpi_t gcry_mpi_new( unsigned int nbits ) { return _gcry_mpi_alloc( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB ); } -GCRY_MPI +gcry_mpi_t gcry_mpi_snew( unsigned int nbits ) { return _gcry_mpi_alloc_secure( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB ); } void -gcry_mpi_release( GCRY_MPI a ) +gcry_mpi_release( gcry_mpi_t a ) { _gcry_mpi_free( a ); } -GCRY_MPI -gcry_mpi_copy( const GCRY_MPI a ) +gcry_mpi_t +gcry_mpi_copy( const gcry_mpi_t a ) { - return _gcry_mpi_copy( (GCRY_MPI)a ); + return _gcry_mpi_copy( (gcry_mpi_t)a ); } -GCRY_MPI -gcry_mpi_set( GCRY_MPI w, const GCRY_MPI u ) +gcry_mpi_t +gcry_mpi_set( gcry_mpi_t w, const gcry_mpi_t u ) { if( !w ) w = _gcry_mpi_alloc( mpi_get_nlimbs(u) ); - _gcry_mpi_set( w, (GCRY_MPI)u ); + _gcry_mpi_set( w, (gcry_mpi_t)u ); return w; } -GCRY_MPI -gcry_mpi_set_ui( GCRY_MPI w, unsigned long u ) +gcry_mpi_t +gcry_mpi_set_ui( gcry_mpi_t w, unsigned long u ) { if( !w ) w = _gcry_mpi_alloc(1); @@ -363,7 +363,7 @@ gcry_mpi_set_ui( GCRY_MPI w, unsigned long u ) void -gcry_mpi_randomize( GCRY_MPI w, +gcry_mpi_randomize( gcry_mpi_t w, unsigned int nbits, enum gcry_random_level level ) { char *p = mpi_is_secure(w) ? gcry_random_bytes( (nbits+7)/8, level ) @@ -374,7 +374,7 @@ gcry_mpi_randomize( GCRY_MPI w, void -gcry_mpi_set_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) +gcry_mpi_set_flag( gcry_mpi_t a, enum gcry_mpi_flag flag ) { switch( flag ) { case GCRYMPI_FLAG_SECURE: mpi_set_secure(a); break; @@ -384,7 +384,7 @@ gcry_mpi_set_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) } void -gcry_mpi_clear_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) +gcry_mpi_clear_flag( gcry_mpi_t a, enum gcry_mpi_flag flag ) { switch( flag ) { case GCRYMPI_FLAG_SECURE: @@ -394,7 +394,7 @@ gcry_mpi_clear_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) } int -gcry_mpi_get_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) +gcry_mpi_get_flag( gcry_mpi_t a, enum gcry_mpi_flag flag ) { switch( flag ) { case GCRYMPI_FLAG_SECURE: return (a->flags & 1); diff --git a/mpi/powerpc32/syntax.h b/mpi/powerpc32/syntax.h index 19f79727..5d4af9f0 100644 --- a/mpi/powerpc32/syntax.h +++ b/mpi/powerpc32/syntax.h @@ -30,15 +30,15 @@ #define ASM_GLOBAL_DIRECTIVE .globl #ifdef __STDC__ -# define C_LABEL(name) C_SYMBOL_NAME(name)##: +#define C_LABEL(name) C_SYMBOL_NAME(name)##: #else -# define C_LABEL(name) C_SYMBOL_NAME(name)/**/: +#define C_LABEL(name) C_SYMBOL_NAME(name)/**/: #endif #ifdef __STDC__ -# define L(body) .L##body +#define L(body) .L##body #else -# define L(body) .L/**/body +#define L(body) .L/**/body #endif /* No profiling of gmp's assembly for now... */ |