aboutsummaryrefslogtreecommitdiff
path: root/src/sha256.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sha256.c')
-rw-r--r--src/sha256.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/sha256.c b/src/sha256.c
index 0761987ebe..bc2be2678f 100644
--- a/src/sha256.c
+++ b/src/sha256.c
@@ -21,7 +21,7 @@
*/
#include "vim.h"
-
+#include "sha256.h"
static void sha256_process __ARGS((context_sha256_T *ctx, char_u data[64]));
@@ -41,8 +41,7 @@ static void sha256_process __ARGS((context_sha256_T *ctx, char_u data[64]));
(b)[(i) + 3] = (char_u)((n) ); \
}
-void sha256_start(ctx)
-context_sha256_T *ctx;
+void sha256_start(context_sha256_T *ctx)
{
ctx->total[0] = 0;
ctx->total[1] = 0;
@@ -57,9 +56,7 @@ context_sha256_T *ctx;
ctx->state[7] = 0x5BE0CD19;
}
-static void sha256_process(ctx, data)
-context_sha256_T *ctx;
-char_u data[64];
+static void sha256_process(context_sha256_T *ctx, char_u data[64])
{
UINT32_T temp1, temp2, W[64];
UINT32_T A, B, C, D, E, F, G, H;
@@ -190,10 +187,7 @@ char_u data[64];
ctx->state[7] += H;
}
-void sha256_update(ctx, input, length)
-context_sha256_T *ctx;
-char_u *input;
-UINT32_T length;
+void sha256_update(context_sha256_T *ctx, char_u *input, UINT32_T length)
{
UINT32_T left, fill;
@@ -234,9 +228,7 @@ static char_u sha256_padding[64] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-void sha256_finish(ctx, digest)
-context_sha256_T *ctx;
-char_u digest[32];
+void sha256_finish(context_sha256_T *ctx, char_u digest[32])
{
UINT32_T last, padn;
UINT32_T high, low;
@@ -270,11 +262,7 @@ static unsigned int get_some_time __ARGS((void));
* Returns hex digest of "buf[buf_len]" in a static array.
* if "salt" is not NULL also do "salt[salt_len]".
*/
-char_u * sha256_bytes(buf, buf_len, salt, salt_len)
-char_u *buf;
-int buf_len;
-char_u *salt;
-int salt_len;
+char_u *sha256_bytes(char_u *buf, int buf_len, char_u *salt, int salt_len)
{
char_u sha256sum[32];
static char_u hexit[65];
@@ -297,10 +285,7 @@ int salt_len;
/*
* Returns sha256(buf) as 64 hex chars in static array.
*/
-char_u * sha256_key(buf, salt, salt_len)
-char_u *buf;
-char_u *salt;
-int salt_len;
+char_u *sha256_key(char_u *buf, char_u *salt, int salt_len)
{
/* No passwd means don't encrypt */
if (buf == NULL || *buf == NUL)
@@ -332,7 +317,7 @@ static char *sha_self_test_vector[] = {
* Perform a test on the SHA256 algorithm.
* Return FAIL or OK.
*/
-int sha256_self_test() {
+int sha256_self_test(void) {
int i, j;
char output[65];
context_sha256_T ctx;
@@ -370,7 +355,7 @@ int sha256_self_test() {
return failures > 0 ? FAIL : OK;
}
-static unsigned int get_some_time() {
+static unsigned int get_some_time(void) {
# ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
@@ -386,11 +371,7 @@ static unsigned int get_some_time() {
* Fill "header[header_len]" with random_data.
* Also "salt[salt_len]" when "salt" is not NULL.
*/
-void sha2_seed(header, header_len, salt, salt_len)
-char_u *header;
-int header_len;
-char_u *salt;
-int salt_len;
+void sha2_seed(char_u *header, int header_len, char_u *salt, int salt_len)
{
int i;
static char_u random_data[1000];