commit c4e9156b71c9056587a20469c7e3fa91448c7096
parent d58f7265ced47c79b87b75564935a0d2ee96b8f6
Author: Remy Noulin <loader2x@gmail.com>
Date: Mon, 15 Oct 2018 15:26:23 +0200
fix compilation errors due to updates in libsheepy
bcrypt.c | 44 ++++++++++++++++++++++----------------------
package.yml | 2 +-
2 files changed, 23 insertions(+), 23 deletions(-)
Diffstat:
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/bcrypt.c b/bcrypt.c
@@ -32,15 +32,15 @@
internal int try_close(int fd)
{
- int ret;
+ int r;
for (;;) {
errno = 0;
- ret = close(fd);
- if (ret == -1 && errno == EINTR)
+ r = close(fd);
+ if (r == -1 && errno == EINTR)
continue;
break;
}
- return ret;
+ return r;
}
internal int try_read(int fd, char *out, size_t count)
@@ -79,7 +79,7 @@ internal int timing_safe_strcmp(const char *str1, const char *str2)
{
const unsigned char *u1;
const unsigned char *u2;
- int ret;
+ int r;
int i;
int len1 = strlen(str1);
@@ -94,11 +94,11 @@ internal int timing_safe_strcmp(const char *str1, const char *str2)
u1 = (const unsigned char *)str1;
u2 = (const unsigned char *)str2;
- ret = 0;
+ r = 0;
for (i = 0; i < len1; ++i)
- ret |= (u1[i] ^ u2[i]);
+ r |= (u1[i] ^ u2[i]);
- return !ret;
+ return !r;
}
@@ -143,11 +143,11 @@ int bcryptHashSync(const char *passwd, const char salt[BCRYPT_HASHSIZE], char ha
int bcryptCheckSync(const char *passwd, const char hash[BCRYPT_HASHSIZE])
{
- int ret;
+ int r;
char outhash[BCRYPT_HASHSIZE];
- ret = bcryptHashSync(passwd, hash, outhash);
- if (!ret)
+ r = bcryptHashSync(passwd, hash, outhash);
+ if (!r)
return 0;
return timing_safe_strcmp(hash, outhash);
@@ -166,18 +166,18 @@ internal void hash(void *AG) {
char salt[BCRYPT_HASHSIZE];
char hash[BCRYPT_HASHSIZE];
- int ret;
+ int r;
- ret = bcryptGensaltSync(args->saltRounds, salt);
- ret = bcryptHashSync(args->passwd, salt, hash);
+ r = bcryptGensaltSync(args->saltRounds, salt);
+ r = bcryptHashSync(args->passwd, salt, hash);
- args->callback(ret, hash, args->callbackEnv);
+ args->callback(r, hash, args->callbackEnv);
free(AG);
}
int bcryptHash(const char *passwd, u8 saltRounds, bcryptHashCallbackt callback, void *callbackEnv) {
- int ret = 0;
+ int r = 0;
bcryptHashArgs *args;
if (!callback || !passwd) return 0;
@@ -191,7 +191,7 @@ int bcryptHash(const char *passwd, u8 saltRounds, bcryptHashCallbackt callback,
tpoolAdd(hash, args);
- return ret;
+ return r;
}
typedef struct {
@@ -205,11 +205,11 @@ internal void check(void *AG) {
cast(bcryptCheckArgs *, args, AG);
- int ret;
+ int r;
- ret = bcryptCheckSync(args->passwd, args->hash);
+ r = bcryptCheckSync(args->passwd, args->hash);
- args->callback(0, ret, args->callbackEnv);
+ args->callback(0, r, args->callbackEnv);
free(args->hash);
free(AG);
}
@@ -217,7 +217,7 @@ internal void check(void *AG) {
int bcryptCheck(const char *passwd, char hash[BCRYPT_HASHSIZE], bcryptCheckCallbackt callback, void *callbackEnv) {
- int ret = 0;
+ int r = 0;
bcryptCheckArgs *args;
if (!callback || !passwd) return 0;
@@ -231,5 +231,5 @@ int bcryptCheck(const char *passwd, char hash[BCRYPT_HASHSIZE], bcryptCheckCallb
tpoolAdd(check, args);
- return ret;
+ return r;
}
diff --git a/package.yml b/package.yml
@@ -1,6 +1,6 @@
---
name: bcrypt
- version: 0.0.1
+ version: 0.0.2
description: "bcrypt hash function"
bin: ./bcrypt.c
cflags: -O2 -std=gnu11 -fPIC -pipe