diff options
Diffstat (limited to 'mpi')
-rw-r--r-- | mpi/mpi-mpow.c | 4 | ||||
-rw-r--r-- | mpi/mpicoder.c | 8 | ||||
-rw-r--r-- | mpi/mpih-mul.c | 4 | ||||
-rw-r--r-- | mpi/mpiutil.c | 28 |
4 files changed, 22 insertions, 22 deletions
diff --git a/mpi/mpi-mpow.c b/mpi/mpi-mpow.c index 956d97077..9a186103a 100644 --- a/mpi/mpi-mpow.c +++ b/mpi/mpi-mpow.c @@ -65,7 +65,7 @@ mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) assert(t); assert( k < 10 ); - G = m_alloc_clear( (1<<k) * sizeof *G ); + G = xmalloc_clear( (1<<k) * sizeof *G ); /* and calculate */ tmp = mpi_alloc( mpi_get_nlimbs(m)+1 ); mpi_set_ui( res, 1 ); @@ -96,5 +96,5 @@ mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) mpi_free(tmp); for(i=0; i < (1<<k); i++ ) mpi_free(G[i]); - m_free(G); + xfree(G); } diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c index c0ae5f4be..46cfb5b1d 100644 --- a/mpi/mpicoder.c +++ b/mpi/mpicoder.c @@ -56,7 +56,7 @@ mpi_write( IOBUF out, MPI a ) p = buf = mpi_get_buffer( a, &n, NULL ); rc = iobuf_write( out, p, n ); - m_free(buf); + xfree(buf); return rc; } @@ -344,7 +344,7 @@ mpi_get_keyid( MPI a, u32 *keyid ) /**************** - * Return an m_alloced buffer with the MPI (msb first). + * Return an xmalloced buffer with the MPI (msb first). * NBYTES receives the length of this buffer. Caller must free the * return string (This function does return a 0 byte buffer with NBYTES * set to zero if the value of A is zero. If sign is not NULL, it will @@ -363,8 +363,8 @@ do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure ) *nbytes = n = a->nlimbs * BYTES_PER_MPI_LIMB; if (!n) n++; /* avoid zero length allocation */ - p = buffer = force_secure || mpi_is_secure(a) ? m_alloc_secure(n) - : m_alloc(n); + p = buffer = force_secure || mpi_is_secure(a) ? xmalloc_secure(n) + : xmalloc(n); for(i=a->nlimbs-1; i >= 0; i-- ) { alimb = a->d[i]; diff --git a/mpi/mpih-mul.c b/mpi/mpih-mul.c index b35f4618b..397ec6066 100644 --- a/mpi/mpih-mul.c +++ b/mpi/mpih-mul.c @@ -422,7 +422,7 @@ mpihelp_mul_karatsuba_case( mpi_ptr_t prodp, } else { if( !ctx->next ) { - ctx->next = m_alloc_clear( sizeof *ctx ); + ctx->next = xmalloc_clear( sizeof *ctx ); } mpihelp_mul_karatsuba_case( ctx->tspace, vp, vsize, @@ -451,7 +451,7 @@ mpihelp_release_karatsuba_ctx( struct karatsuba_ctx *ctx ) mpi_free_limb_space( ctx->tp ); if( ctx->tspace ) mpi_free_limb_space( ctx->tspace ); - m_free( ctx ); + xfree( ctx ); } } diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index f0a0f69c0..fdbd354f2 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -59,7 +59,7 @@ mpi_alloc( unsigned nlimbs ) a = m_debug_alloc( sizeof *a, info ); a->d = nlimbs? mpi_debug_alloc_limb_space( nlimbs, 0, info ) : NULL; #else - a = m_alloc( sizeof *a ); + a = xmalloc( sizeof *a ); a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 0 ) : NULL; #endif a->alloced = nlimbs; @@ -92,7 +92,7 @@ mpi_alloc_secure( unsigned nlimbs ) a = m_debug_alloc( sizeof *a, info ); a->d = nlimbs? mpi_debug_alloc_limb_space( nlimbs, 1, info ) : NULL; #else - a = m_alloc( sizeof *a ); + a = xmalloc( sizeof *a ); a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 1 ) : NULL; #endif a->alloced = nlimbs; @@ -145,7 +145,7 @@ mpi_alloc_limb_space( unsigned nlimbs, int secure ) #ifdef M_DEBUG p = secure? m_debug_alloc_secure(len, info):m_debug_alloc( len, info ); #else - p = secure? m_alloc_secure( len ):m_alloc( len ); + p = secure? xmalloc_secure( len ):xmalloc( len ); #endif return p; @@ -186,7 +186,7 @@ mpi_free_limb_space( mpi_ptr_t a ) } #endif - m_free(a); + xfree(a); } @@ -202,7 +202,7 @@ mpi_assign_limb_space( MPI a, mpi_ptr_t ap, unsigned nlimbs ) /**************** * Resize the array of A to NLIMBS. the additional space is cleared - * (set to 0) [done by m_realloc()] + * (set to 0) [done by xrealloc()] */ void #ifdef M_DEBUG @@ -225,9 +225,9 @@ mpi_resize( MPI a, unsigned nlimbs ) a->d = m_debug_alloc_clear( nlimbs * sizeof(mpi_limb_t), info ); #else if( a->d ) - a->d = m_realloc(a->d, nlimbs * sizeof(mpi_limb_t) ); + a->d = xrealloc(a->d, nlimbs * sizeof(mpi_limb_t) ); else - a->d = m_alloc_clear( nlimbs * sizeof(mpi_limb_t) ); + a->d = xmalloc_clear( nlimbs * sizeof(mpi_limb_t) ); #endif a->alloced = nlimbs; } @@ -253,7 +253,7 @@ mpi_free( MPI a ) if( DBG_MEMORY ) log_debug("mpi_free\n" ); if( a->flags & 4 ) - m_free( a->d ); + xfree( a->d ); else { #ifdef M_DEBUG mpi_debug_free_limb_space(a->d, info); @@ -263,7 +263,7 @@ mpi_free( MPI a ) } if( a->flags & ~7 ) log_bug("invalid flag value in mpi\n"); - m_free(a); + xfree(a); } @@ -307,7 +307,7 @@ mpi_set_opaque( MPI a, void *p, unsigned int len ) } if( a->flags & 4 ) - m_free( a->d ); + xfree( a->d ); else { #ifdef M_DEBUG mpi_debug_free_limb_space(a->d, "alloc_opaque"); @@ -351,8 +351,8 @@ mpi_copy( MPI a ) MPI b; if( a && (a->flags & 4) ) { - void *p = m_is_secure(a->d)? m_alloc_secure( a->nbits ) - : m_alloc( a->nbits ); + void *p = m_is_secure(a->d)? xmalloc_secure( a->nbits ) + : xmalloc( a->nbits ); memcpy( p, a->d, a->nbits ); b = mpi_set_opaque( NULL, p, a->nbits ); } @@ -392,8 +392,8 @@ mpi_alloc_like( MPI a ) MPI b; if( a && (a->flags & 4) ) { - void *p = m_is_secure(a->d)? m_alloc_secure( a->nbits ) - : m_alloc( a->nbits ); + void *p = m_is_secure(a->d)? xmalloc_secure( a->nbits ) + : xmalloc( a->nbits ); memcpy( p, a->d, a->nbits ); b = mpi_set_opaque( NULL, p, a->nbits ); } |