aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-10-26 11:34:23 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-10-26 11:34:23 +0300
commita9a5d76f3fdac0ddbf76f7d021be3c95b7bfbdef (patch)
tree382f76cf3eea6b4126408878262fcc9bf502f1c2
parentd82eb4514d1951473ee93ad0276d1108a3519343 (diff)
downloadvmod-basicauth-a9a5d76f3fdac0ddbf76f7d021be3c95b7bfbdef.tar.gz
vmod-basicauth-a9a5d76f3fdac0ddbf76f7d021be3c95b7bfbdef.tar.bz2
Fix compiler warnings in md5.c
-rw-r--r--src/md5.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/md5.c b/src/md5.c
index 8c0d9a6..1bb02d7 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -183,3 +183,3 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
-#define F1(x, y, z) (x & y | ~x & z)
+#define F1(x, y, z) ((x & y) | (~x & z))
#define F2(x, y, z) F1(z, x, y)
@@ -303,3 +303,4 @@ MD5Transform(uint32_t buf[4], uint32_t const cin[16])
*/
-static const char *const apr1_id = "$apr1$";
+#define APR1_ID_STR "$apr1$"
+#define APR1_ID_LEN (sizeof(APR1_ID_STR)-1)
@@ -351,4 +352,4 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
*/
- if (!strncmp(sp, apr1_id, strlen(apr1_id))) {
- sp += strlen(apr1_id);
+ if (!strncmp(sp, APR1_ID_STR, APR1_ID_LEN)) {
+ sp += APR1_ID_LEN;
}
@@ -374,3 +375,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
*/
- MD5Update(&ctx, pw, strlen(pw));
+ MD5Update(&ctx, (unsigned char const*) pw, strlen(pw));
@@ -379,3 +380,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
*/
- MD5Update(&ctx, apr1_id, strlen(apr1_id));
+ MD5Update(&ctx, (unsigned char const*)APR1_ID_STR, APR1_ID_LEN);
@@ -384,3 +385,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
*/
- MD5Update(&ctx, sp, sl);
+ MD5Update(&ctx, (unsigned char const*)sp, sl);
@@ -390,5 +391,5 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
MD5Init(&ctx1);
- MD5Update(&ctx1, pw, strlen(pw));
- MD5Update(&ctx1, sp, sl);
- MD5Update(&ctx1, pw, strlen(pw));
+ MD5Update(&ctx1, (unsigned char const*)pw, strlen(pw));
+ MD5Update(&ctx1, (unsigned char const*)sp, sl);
+ MD5Update(&ctx1, (unsigned char const*)pw, strlen(pw));
MD5Final(final, &ctx1);
@@ -411,3 +412,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
else
- MD5Update(&ctx, pw, 1);
+ MD5Update(&ctx, (unsigned char const*)pw, 1);
}
@@ -418,3 +419,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
*/
- strcpy(passwd, apr1_id);
+ strcpy(passwd, APR1_ID_STR);
strncat(passwd, sp, sl);
@@ -436,3 +437,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
if (i & 1)
- MD5Update(&ctx1, pw, strlen(pw));
+ MD5Update(&ctx1, (unsigned char const*)pw, strlen(pw));
else
@@ -440,6 +441,6 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
if (i % 3)
- MD5Update(&ctx1, sp, sl);
+ MD5Update(&ctx1, (unsigned char const*)sp, sl);
if (i % 7)
- MD5Update(&ctx1, pw, strlen(pw));
+ MD5Update(&ctx1, (unsigned char const*)pw, strlen(pw));
@@ -448,3 +449,3 @@ apr_md5_encode(const char *pw, const char *salt, char *result, size_t nbytes)
else
- MD5Update(&ctx1, pw, strlen(pw));
+ MD5Update(&ctx1, (unsigned char const*)pw, strlen(pw));
MD5Final(final,&ctx1);

Return to:

Send suggestions and report system problems to the System administrator.