diff --git a/lib/md5.c b/lib/md5.c index f3d6e079..75b4fd67 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -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; } diff --git a/lib/md5.h b/lib/md5.h index 8ace29cb..78c62c78 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -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]); diff --git a/lib/printf.c b/lib/printf.c index 3eb988fa..a1c36129 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -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; diff --git a/lib/sha256.c b/lib/sha256.c index 4025c6a0..cd0fef03 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -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; diff --git a/lib/sha256.h b/lib/sha256.h index 44e4a6d0..ce8f1460 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -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 diff --git a/lib/sha512.c b/lib/sha512.c index e917eb98..eea7cda8 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -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; diff --git a/lib/sha512.h b/lib/sha512.h index e37bbcb6..188850b4 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -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 diff --git a/nest/route.h b/nest/route.h index 87f10ae3..2e6bf741 100644 --- a/nest/route.h +++ b/nest/route.h @@ -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 { diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 495178c0..e68ee0f4 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -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; diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h index df5e0236..c82d7a1e 100644 --- a/sysdep/bsd/sysio.h +++ b/sysdep/bsd/sysio.h @@ -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