aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Willemse2013-11-17 00:38:25 +0100
committerTom Willemse2013-11-17 00:38:25 +0100
commite67489c6ddd7a229c68027eb673605dad7f64254 (patch)
tree9bc086dd5b37c2930e82e14f280ed039768fa4d0
parent6e7e8e9ba249bb8fac1d90e2c9a9628563232c1e (diff)
downloadlibdispass-e67489c6ddd7a229c68027eb673605dad7f64254.tar.gz
libdispass-e67489c6ddd7a229c68027eb673605dad7f64254.zip
Fix some compiler warnings
- Remove some unused variables - Explicitly cast =tbuff= to a pointer to =unsigned char= when using =SHA512=. - Use =long long unsigned= as =seqno=, since there is no theoretical limit to it. - Use =size_t= for the =tbufflen= variable in =dispass1= since technically that is what =strlen= returns.
-rw-r--r--sha1.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sha1.c b/sha1.c
index 5198a19..3024845 100644
--- a/sha1.c
+++ b/sha1.c
@@ -71,18 +71,17 @@ rmchar(char rm, char **s)
}
char *
-dispass1(char *label, char *password, int len, int seqno)
+dispass1(char *label, char *password, int len, long long unsigned seqno)
{
- int i;
unsigned char *d;
- long tbufflen = strlen(label) + strlen(password) + 1;
+ size_t tbufflen = strlen(label) + strlen(password) + 1;
char *tbuff = calloc(tbufflen, sizeof(char));
char buff[MAXLEN + 1] = { '\0' };
char *b64;
strcat(tbuff, label);
strcat(tbuff, password);
- d = SHA512(tbuff, strlen(tbuff), 0);
+ d = SHA512((unsigned char *)tbuff, strlen(tbuff), 0);
free(tbuff);
sha512_to_string(d, buff);
b64 = base64encode(buff, strlen(buff));
@@ -93,9 +92,8 @@ dispass1(char *label, char *password, int len, int seqno)
}
char *
-dispass2(char *label, char *password, int len, int seqno)
+dispass2(char *label, char *password, int len, long long unsigned seqno)
{
- int i;
unsigned char *d;
char ibuff[300];
char *tbuff, *b64;
@@ -107,7 +105,7 @@ dispass2(char *label, char *password, int len, int seqno)
strcat(tbuff, label);
strcat(tbuff, ibuff);
strcat(tbuff, password);
- d = SHA512(tbuff, strlen(tbuff), 0);
+ d = SHA512((unsigned char *)tbuff, strlen(tbuff), 0);
free(tbuff);
sha512_to_string(d, buff);
b64 = base64encode(buff, strlen(buff));