mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
* sunrpc/svcauth_des.c (cache_init): Use calloc instead of
malloc&bzero. * sunrpc/svc_udp.c (BZERO): Remove definition. (CALLOC): Define. (svc_enablecache): Use CALLOC instead of ALLOC&BZERO. * sunrpc/des_impl.c: Remove ALT_ECB support. We never used it. (des_SPtrans): Use uint32_t type. (des_skb): Likewise. * sunrpc/xdr_ref.c (xdr_reference): Use calloc instead of malloc&bzero. place where the iso639 array might be accessed beyond the limits.
This commit is contained in:
17
ChangeLog
17
ChangeLog
@@ -1,3 +1,18 @@
|
|||||||
|
2006-05-05 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sunrpc/svcauth_des.c (cache_init): Use calloc instead of
|
||||||
|
malloc&bzero.
|
||||||
|
|
||||||
|
* sunrpc/svc_udp.c (BZERO): Remove definition.
|
||||||
|
(CALLOC): Define.
|
||||||
|
(svc_enablecache): Use CALLOC instead of ALLOC&BZERO.
|
||||||
|
|
||||||
|
* sunrpc/des_impl.c: Remove ALT_ECB support. We never used it.
|
||||||
|
(des_SPtrans): Use uint32_t type.
|
||||||
|
(des_skb): Likewise.
|
||||||
|
|
||||||
|
* sunrpc/xdr_ref.c (xdr_reference): Use calloc instead of malloc&bzero.
|
||||||
|
|
||||||
2006-05-05 Jakub Jelinek <jakub@redhat.com>
|
2006-05-05 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
[BZ #2509]
|
[BZ #2509]
|
||||||
@@ -7,7 +22,7 @@
|
|||||||
2006-05-05 Ulrich Drepper <drepper@redhat.com>
|
2006-05-05 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* locale/programs/ld-address.c (address_finish): Fix one more
|
* locale/programs/ld-address.c (address_finish): Fix one more
|
||||||
place where the iso639 array might be access beyond the limits.
|
place where the iso639 array might be accessed beyond the limits.
|
||||||
|
|
||||||
2006-05-04 Ulrich Drepper <drepper@redhat.com>
|
2006-05-04 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
@@ -6,10 +6,11 @@
|
|||||||
/* write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,*/
|
/* write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,*/
|
||||||
/* Boston, MA 02111, USA to obtain a copy. */
|
/* Boston, MA 02111, USA to obtain a copy. */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "des.h"
|
#include "des.h"
|
||||||
|
|
||||||
|
|
||||||
static const unsigned long des_SPtrans[8][64] =
|
static const uint32_t des_SPtrans[8][64] =
|
||||||
{
|
{
|
||||||
{ /* nibble 0 */
|
{ /* nibble 0 */
|
||||||
0x00820200, 0x00020000, 0x80800000, 0x80820200,
|
0x00820200, 0x00020000, 0x80800000, 0x80820200,
|
||||||
@@ -155,7 +156,7 @@ static const unsigned long des_SPtrans[8][64] =
|
|||||||
0x00000020, 0x08208000, 0x00208020, 0x00000000,
|
0x00000020, 0x08208000, 0x00208020, 0x00000000,
|
||||||
0x08000000, 0x08200020, 0x00008000, 0x00208020}};
|
0x08000000, 0x08200020, 0x00008000, 0x00208020}};
|
||||||
|
|
||||||
static const unsigned long des_skb[8][64] =
|
static const uint32_t des_skb[8][64] =
|
||||||
{
|
{
|
||||||
{ /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
|
{ /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
|
||||||
0x00000000, 0x00000010, 0x20000000, 0x20000010,
|
0x00000000, 0x00000010, 0x20000000, 0x20000010,
|
||||||
@@ -352,26 +353,6 @@ static const unsigned long des_skb[8][64] =
|
|||||||
(a)=(a)^(t)^(t>>(16-(n))))
|
(a)=(a)^(t)^(t>>(16-(n))))
|
||||||
|
|
||||||
|
|
||||||
/* The changes to this macro may help or hinder, depending on the
|
|
||||||
* compiler and the achitecture. gcc2 always seems to do well :-).
|
|
||||||
* Inspired by Dana How <how@isl.stanford.edu>
|
|
||||||
* DO NOT use the alternative version on machines with 8 byte longs.
|
|
||||||
*/
|
|
||||||
#ifdef ALT_ECB
|
|
||||||
#define D_ENCRYPT(L,R,S) \
|
|
||||||
u=((R^s[S ])<<2); \
|
|
||||||
t= R^s[S+1]; \
|
|
||||||
t=((t>>2)+(t<<30)); \
|
|
||||||
L^= \
|
|
||||||
*(const unsigned long *)(des_SP+0x0100+((t )&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+0x0300+((t>> 8)&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+0x0500+((t>>16)&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+0x0700+((t>>24)&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+ ((u )&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+0x0200+((u>> 8)&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+0x0400+((u>>16)&0xfc))+ \
|
|
||||||
*(const unsigned long *)(des_SP+0x0600+((u>>24)&0xfc));
|
|
||||||
#else /* original version */
|
|
||||||
#define D_ENCRYPT(L,R,S) \
|
#define D_ENCRYPT(L,R,S) \
|
||||||
u=(R^s[S ]); \
|
u=(R^s[S ]); \
|
||||||
t=R^s[S+1]; \
|
t=R^s[S+1]; \
|
||||||
@@ -384,7 +365,6 @@ static const unsigned long des_skb[8][64] =
|
|||||||
des_SPtrans[2][(u>> 8)&0x3f]| \
|
des_SPtrans[2][(u>> 8)&0x3f]| \
|
||||||
des_SPtrans[4][(u>>16)&0x3f]| \
|
des_SPtrans[4][(u>>16)&0x3f]| \
|
||||||
des_SPtrans[6][(u>>24)&0x3f];
|
des_SPtrans[6][(u>>24)&0x3f];
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ITERATIONS 16
|
#define ITERATIONS 16
|
||||||
|
|
||||||
@@ -464,9 +444,6 @@ internal_function
|
|||||||
des_encrypt (unsigned long *buf, unsigned long *schedule, int encrypt)
|
des_encrypt (unsigned long *buf, unsigned long *schedule, int encrypt)
|
||||||
{
|
{
|
||||||
register unsigned long l, r, t, u;
|
register unsigned long l, r, t, u;
|
||||||
#ifdef ALT_ECB
|
|
||||||
register const unsigned char *des_SP = (const unsigned char *) des_SPtrans;
|
|
||||||
#endif
|
|
||||||
register int i;
|
register int i;
|
||||||
register unsigned long *s;
|
register unsigned long *s;
|
||||||
|
|
||||||
|
@@ -406,8 +406,8 @@ svcudp_destroy (xprt)
|
|||||||
#define ALLOC(type, size) \
|
#define ALLOC(type, size) \
|
||||||
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
|
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
|
||||||
|
|
||||||
#define BZERO(addr, type, size) \
|
#define CALLOC(type, size) \
|
||||||
__bzero((char *) addr, sizeof(type) * (int) (size))
|
(type *) calloc (sizeof (type), size)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An entry in the cache
|
* An entry in the cache
|
||||||
@@ -482,15 +482,14 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
|
|||||||
}
|
}
|
||||||
uc->uc_size = size;
|
uc->uc_size = size;
|
||||||
uc->uc_nextvictim = 0;
|
uc->uc_nextvictim = 0;
|
||||||
uc->uc_entries = ALLOC (cache_ptr, size * SPARSENESS);
|
uc->uc_entries = CALLOC (cache_ptr, size * SPARSENESS);
|
||||||
if (uc->uc_entries == NULL)
|
if (uc->uc_entries == NULL)
|
||||||
{
|
{
|
||||||
mem_free (uc, sizeof (struct udp_cache));
|
mem_free (uc, sizeof (struct udp_cache));
|
||||||
CACHE_PERROR (_("enablecache: could not allocate cache data"));
|
CACHE_PERROR (_("enablecache: could not allocate cache data"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BZERO (uc->uc_entries, cache_ptr, size * SPARSENESS);
|
uc->uc_fifo = CALLOC (cache_ptr, size);
|
||||||
uc->uc_fifo = ALLOC (cache_ptr, size);
|
|
||||||
if (uc->uc_fifo == NULL)
|
if (uc->uc_fifo == NULL)
|
||||||
{
|
{
|
||||||
mem_free (uc->uc_entries, size * SPARSENESS);
|
mem_free (uc->uc_entries, size * SPARSENESS);
|
||||||
@@ -498,7 +497,6 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
|
|||||||
CACHE_PERROR (_("enablecache: could not allocate cache fifo"));
|
CACHE_PERROR (_("enablecache: could not allocate cache fifo"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BZERO (uc->uc_fifo, cache_ptr, size);
|
|
||||||
su->su_cache = (char *) uc;
|
su->su_cache = (char *) uc;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -396,11 +396,9 @@ cache_init (void)
|
|||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
authdes_cache = (struct cache_entry *)
|
authdes_cache = (struct cache_entry *)
|
||||||
mem_alloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ);
|
calloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ, 1);
|
||||||
if (authdes_cache == NULL)
|
if (authdes_cache == NULL)
|
||||||
return;
|
return;
|
||||||
__bzero ((char *) authdes_cache,
|
|
||||||
sizeof (struct cache_entry) * AUTHDES_CACHESZ);
|
|
||||||
|
|
||||||
authdes_lru = (int *) mem_alloc (sizeof (int) * AUTHDES_CACHESZ);
|
authdes_lru = (int *) mem_alloc (sizeof (int) * AUTHDES_CACHESZ);
|
||||||
/*
|
/*
|
||||||
|
@@ -79,14 +79,13 @@ xdr_reference (xdrs, pp, size, proc)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case XDR_DECODE:
|
case XDR_DECODE:
|
||||||
*pp = loc = (caddr_t) mem_alloc (size);
|
*pp = loc = (caddr_t) calloc (1, size);
|
||||||
if (loc == NULL)
|
if (loc == NULL)
|
||||||
{
|
{
|
||||||
(void) __fxprintf (NULL, "%s",
|
(void) __fxprintf (NULL, "%s",
|
||||||
_("xdr_reference: out of memory\n"));
|
_("xdr_reference: out of memory\n"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
__bzero (loc, (int) size);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user