Standardized type names! Who would use such things?!

This commit is contained in:
Tyler J. Stachecki 2016-01-30 15:04:14 -05:00
parent 2b5eaa579d
commit 9e33765f2e
2 changed files with 18 additions and 17 deletions

View file

@ -52,7 +52,7 @@
#ifndef unsupported
/* constant table */
static u_int32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
static uint32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
#define K(t) _K[(t) / 20]
#define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d)))
@ -90,9 +90,9 @@ static void
sha1_step(ctxt)
struct sha1_ctxt *ctxt;
{
u_int32_t a, b, c, d, e;
uint32_t a, b, c, d, e;
size_t t, s;
u_int32_t tmp;
uint32_t tmp;
#if BYTE_ORDER == LITTLE_ENDIAN
struct sha1_ctxt tctxt;
@ -221,7 +221,7 @@ sha1_pad(ctxt)
void
sha1_loop(ctxt, input, len)
struct sha1_ctxt *ctxt;
const u_int8_t *input;
const uint8_t *input;
size_t len;
{
size_t gaplen;
@ -249,7 +249,7 @@ sha1_loop(ctxt, input, len)
void
sha1_result(ctxt, digest)
struct sha1_ctxt *ctxt;
u_int8_t *digest;
uint8_t *digest;
{
sha1_pad(ctxt);
#if BYTE_ORDER == BIG_ENDIAN
@ -269,9 +269,9 @@ sha1_result(ctxt, digest)
}
extern void sha1(data, size, digest)
const u_int8_t *data;
const uint8_t *data;
size_t size;
u_int8_t *digest;
uint8_t *digest;
{
struct sha1_ctxt ctx = { 0, };
sha1_init(&ctx);

View file

@ -37,31 +37,32 @@
#ifndef _NETINET6_SHA1_H_
#define _NETINET6_SHA1_H_
#include "common.h"
#define SHA1_SIZE 20
struct sha1_ctxt {
union {
u_int8_t b8[20];
u_int32_t b32[5];
uint8_t b8[20];
uint32_t b32[5];
} h;
union {
u_int8_t b8[8];
u_int64_t b64[1];
uint8_t b8[8];
uint64_t b64[1];
} c;
union {
u_int8_t b8[64];
u_int32_t b32[16];
uint8_t b8[64];
uint32_t b32[16];
} m;
u_int8_t count;
uint8_t count;
};
extern void sha1_init(struct sha1_ctxt *);
extern void sha1_pad(struct sha1_ctxt *);
extern void sha1_loop(struct sha1_ctxt *, const u_int8_t *, size_t);
extern void sha1_result(struct sha1_ctxt *, u_int8_t *);
extern void sha1_loop(struct sha1_ctxt *, const uint8_t *, size_t);
extern void sha1_result(struct sha1_ctxt *, uint8_t *);
extern void sha1(const u_int8_t *, size_t, u_int8_t *);
extern void sha1(const uint8_t *, size_t, uint8_t *);
/* compatibilty with other SHA1 source codes */
typedef struct sha1_ctxt SHA1_CTX;