-/* $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 <provos@physnet.uni-hamburg.de>
* All rights reserved.
};
#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;
}
}
+#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;
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;
char *
bcrypt(key, salt)
- char *key;
- char *salt;
+ const char *key;
+ const char *salt;
{
blf_ctx state;
u_int32_t rounds, i, k;
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;
-/* $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 <provos@physnet.uni-hamburg.de>
}
+#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;
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;
}
+#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;
u_int16_t databytes;
const u_int8_t *key;
u_int16_t keybytes;
+#endif
{
u_int16_t i;
u_int16_t j;
}
+#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);
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;
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;
-/* $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 <provos@physnet.uni-hamburg.de>
* 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;