0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 10:11:53 +00:00

unsgined char -> byte

This commit is contained in:
Pavel Tvrdík 2015-05-19 08:14:04 +02:00
parent c38a645d9b
commit 8e8a438322
10 changed files with 19 additions and 19 deletions

View File

@ -17,12 +17,12 @@
#ifdef CPU_LITTLE_ENDIAN
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(unsigned char *buf, unsigned longs);
void byteReverse(byte *buf, unsigned longs);
/*
* Note: this code is harmless on little-endian machines.
*/
void byteReverse(unsigned char *buf, unsigned longs)
void byteReverse(byte *buf, unsigned longs)
{
u32 t;
do {
@ -55,7 +55,7 @@ md5_init(md5_context *ctx)
* of bytes.
*/
void
md5_update(md5_context *ctx, unsigned char const *buf, unsigned len)
md5_update(md5_context *ctx, byte const *buf, unsigned len)
{
u32 t;
@ -72,7 +72,7 @@ md5_update(md5_context *ctx, unsigned char const *buf, unsigned len)
if (t)
{
unsigned char *p = (unsigned char *) ctx->in + t;
byte *p = (byte *) ctx->in + t;
t = 64 - t;
if (len < t)
@ -110,7 +110,7 @@ byte *
md5_final(md5_context *ctx)
{
unsigned count;
unsigned char *p;
byte *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
@ -146,7 +146,7 @@ md5_final(md5_context *ctx)
((u32 *) ctx->in)[15] = ctx->bits[1];
md5_transform(ctx->buf, (u32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
byteReverse((byte *) ctx->buf, 4);
return (byte*) ctx->buf;
}

View File

@ -19,11 +19,11 @@ typedef struct
{
u32 buf[4];
u32 bits[2];
unsigned char in[64];
byte in[64];
} md5_context;
void md5_init(md5_context *context);
void md5_update(md5_context *context, unsigned char const *buf, unsigned len);
void md5_update(md5_context *context, byte const *buf, unsigned len);
byte *md5_final(md5_context *context);
void md5_transform(u32 buf[4], u32 const in[16]);

View File

@ -215,7 +215,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
if (!(flags & LEFT))
while (--field_width > 0)
*str++ = ' ';
*str++ = (unsigned char) va_arg(args, int);
*str++ = (byte) va_arg(args, int);
while (--field_width > 0)
*str++ = ' ';
continue;

View File

@ -115,7 +115,7 @@ sum1(u32 x)
32-bit-words. See FIPS 180-2 for details.
*/
static unsigned int
sha256_transform_block(sha256_context *ctx, const unsigned char *data)
sha256_transform_block(sha256_context *ctx, const byte *data)
{
static const u32 K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
@ -215,7 +215,7 @@ sha256_transform_block(sha256_context *ctx, const unsigned char *data)
#undef R
static unsigned int
sha256_transform(void *ctx, const unsigned char *data, size_t nblks)
sha256_transform(void *ctx, const byte *data, size_t nblks)
{
sha256_context *hd = ctx;
unsigned int burn;

View File

@ -23,7 +23,7 @@
#define SHA256_HEX_SIZE 65
#define SHA256_BLOCK_SIZE 64
typedef unsigned int sha_transform_fn (void *c, const unsigned char *blks, size_t nblks);
typedef unsigned int sha_transform_fn (void *c, const byte *blks, size_t nblks);
typedef struct {
u32 h0,h1,h2,h3,h4,h5,h6,h7;
@ -51,7 +51,7 @@ byte* sha224_final(sha224_context *ctx)
return sha256_final(ctx);
}
static unsigned int sha256_transform(void *ctx, const unsigned char *data, size_t nblks);
static unsigned int sha256_transform(void *ctx, const byte *data, size_t nblks);
/**
* HMAC-SHA256, HMAC-SHA224

View File

@ -147,7 +147,7 @@ static const u64 k[] =
* Transform the message W which consists of 16 64-bit-words
*/
static unsigned int
sha512_transform_block(sha512_state *hd, const unsigned char *data)
sha512_transform_block(sha512_state *hd, const byte *data)
{
u64 a, b, c, d, e, f, g, h;
u64 w[16];
@ -410,7 +410,7 @@ sha512_transform_block(sha512_state *hd, const unsigned char *data)
}
static unsigned int
sha512_transform(void *context, const unsigned char *data, size_t nblks)
sha512_transform(void *context, const byte *data, size_t nblks)
{
sha512_context *ctx = context;
unsigned int burn;

View File

@ -52,7 +52,7 @@ byte* sha384_final(sha384_context *ctx)
return sha512_final(ctx);
}
static unsigned int sha512_transform(void *context, const unsigned char *data, size_t nblks);
static unsigned int sha512_transform(void *context, const byte *data, size_t nblks);
/**
* HMAC-SHA512, HMAC-SHA384

View File

@ -320,7 +320,7 @@ struct mpnh {
ip_addr gw; /* Next hop */
struct iface *iface; /* Outgoing interface */
struct mpnh *next;
unsigned char weight;
byte weight;
};
struct rte_src {

View File

@ -43,7 +43,7 @@ unresolved_vlink(ort *ort)
}
static inline struct mpnh *
new_nexthop(struct ospf_proto *p, ip_addr gw, struct iface *iface, unsigned char weight)
new_nexthop(struct ospf_proto *p, ip_addr gw, struct iface *iface, byte weight)
{
struct mpnh *nh = lp_alloc(p->nhpool, sizeof(struct mpnh));
nh->gw = gw;

View File

@ -130,7 +130,7 @@ static inline void
sk_process_cmsg4_ttl(sock *s, struct cmsghdr *cm)
{
if (cm->cmsg_type == IP_RECVTTL)
s->rcv_ttl = * (unsigned char *) CMSG_DATA(cm);
s->rcv_ttl = * (byte *) CMSG_DATA(cm);
}
static inline void