From: tholo Date: Wed, 30 Apr 1997 05:57:03 +0000 (+0000) Subject: Be more careful about possible type promotion X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fe926a21ad8e0153a9580549adf8320441c9c35a;p=openbsd Be more careful about possible type promotion --- diff --git a/lib/libc/crypt/bcrypt.c b/lib/libc/crypt/bcrypt.c index d47100cec89..f626c2f4538 100644 --- a/lib/libc/crypt/bcrypt.c +++ b/lib/libc/crypt/bcrypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcrypt.c,v 1.4 1997/03/27 01:09:38 provos Exp $ */ +/* $OpenBSD: bcrypt.c,v 1.5 1997/04/30 05:57:04 tholo Exp $ */ /* * Copyright 1997 Niels Provos * All rights reserved. @@ -95,11 +95,16 @@ const static u_int8_t index_64[128] = }; #define CHAR64(c) ( (c) > 127 ? 255 : index_64[(c)]) +#if __STDC__ +static void +decode_base64(u_int8_t *buffer, u_int16_t len, u_int8_t *data) +#else static void decode_base64(buffer, len, data) u_int8_t *buffer; u_int16_t len; u_int8_t *data; +#endif { u_int8_t *bp = buffer; u_int8_t *p = data; @@ -133,12 +138,17 @@ decode_base64(buffer, len, data) } } +#if __STDC__ +static void +encode_salt(char *salt, u_int8_t *csalt, u_int16_t clen, u_int8_t logr) +#else static void encode_salt(salt, csalt, clen, logr) char *salt; u_int8_t *csalt; u_int16_t clen; u_int8_t logr; +#endif { salt[0] = '$'; salt[1] = BCRYPT_VERSION; @@ -153,9 +163,14 @@ encode_salt(salt, csalt, clen, logr) seems sensible. */ -char * +#if __STDC__ +char * +bcrypt_gensalt(u_int8_t log_rounds) +#else +char * bcrypt_gensalt(log_rounds) u_int8_t log_rounds; +#endif { u_int8_t csalt[BCRYPT_MAXSALT]; u_int16_t i; @@ -179,8 +194,8 @@ bcrypt_gensalt(log_rounds) char * bcrypt(key, salt) - char *key; - char *salt; + const char *key; + const char *salt; { blf_ctx state; u_int32_t rounds, i, k; @@ -256,11 +271,16 @@ bcrypt(key, salt) return encrypted; } +#if __STDC__ +static void +encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len) +#else static void encode_base64(buffer, data, len) u_int8_t *buffer; u_int8_t *data; u_int16_t len; +#endif { u_int8_t *bp = buffer; u_int8_t *p = data; diff --git a/lib/libc/crypt/blowfish.c b/lib/libc/crypt/blowfish.c index 21c492209d8..46568d23188 100644 --- a/lib/libc/crypt/blowfish.c +++ b/lib/libc/crypt/blowfish.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blowfish.c,v 1.3 1997/02/16 20:58:17 provos Exp $ */ +/* $OpenBSD: blowfish.c,v 1.4 1997/04/30 05:57:05 tholo Exp $ */ /* * Blowfish block cipher for OpenBSD * Copyright 1997 Niels Provos @@ -441,11 +441,16 @@ Blowfish_initstate(c) } +#if __STDC__ +u_int32_t +Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes, u_int16_t *current) +#else u_int32_t Blowfish_stream2word(data, databytes, current) const u_int8_t *data; u_int16_t databytes; u_int16_t *current; +#endif { u_int8_t i; u_int16_t j; @@ -464,11 +469,16 @@ Blowfish_stream2word(data, databytes, current) return temp; } +#if __STDC__ +void +Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes) +#else void Blowfish_expand0state(c, key, keybytes) blf_ctx *c; const u_int8_t *key; u_int16_t keybytes; +#endif { u_int16_t i; u_int16_t j; @@ -506,6 +516,11 @@ Blowfish_expand0state(c, key, keybytes) } +#if __STDC__ +void +Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes, + const u_int8_t *key, u_int16_t keybytes) +#else void Blowfish_expandstate(c, data, databytes, key, keybytes) blf_ctx *c; @@ -513,6 +528,7 @@ Blowfish_expandstate(c, data, databytes, key, keybytes) u_int16_t databytes; const u_int8_t *key; u_int16_t keybytes; +#endif { u_int16_t i; u_int16_t j; @@ -553,11 +569,16 @@ Blowfish_expandstate(c, data, databytes, key, keybytes) } +#if __STDC__ +void +blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len) +#else void blf_key(c, k, len) blf_ctx *c; const u_int8_t *k; u_int16_t len; +#endif { /* Initalize S-boxes and subkeys with Pi */ Blowfish_initstate(c); @@ -566,11 +587,16 @@ blf_key(c, k, len) Blowfish_expand0state(c, k, len); } +#if __STDC__ +void +blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks) +#else void blf_enc(c, data, blocks) blf_ctx *c; u_int32_t *data; u_int16_t blocks; +#endif { u_int32_t *d; u_int16_t i; @@ -581,11 +607,17 @@ blf_enc(c, data, blocks) d += 2; } } + +#if __STDC__ +void +blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks) +#else void blf_dec(c, data, blocks) blf_ctx *c; u_int32_t *data; u_int16_t blocks; +#endif { u_int32_t *d; u_int16_t i; diff --git a/lib/libc/net/res_random.c b/lib/libc/net/res_random.c index ebd1831e51b..f3514542027 100644 --- a/lib/libc/net/res_random.c +++ b/lib/libc/net/res_random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_random.c,v 1.5 1997/04/25 07:43:05 provos Exp $ */ +/* $OpenBSD: res_random.c,v 1.6 1997/04/30 05:57:03 tholo Exp $ */ /* * Copyright 1997 Niels Provos @@ -100,9 +100,14 @@ static void res_initid __P((void)); * of 0 - (mod-1) */ +#if __STDC__ +static u_int16_t +pmod(u_int16_t gen, u_int16_t exp, u_int16_t mod) +#else static u_int16_t pmod(gen, exp, mod) u_int16_t gen, exp, mod; +#endif { u_int16_t s, t, u;