projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
novi upstream verzije 2.8.3
[ossec-hids.git]
/
src
/
os_crypto
/
md5
/
md5_op.c
diff --git
a/src/os_crypto/md5/md5_op.c
b/src/os_crypto/md5/md5_op.c
index
fdd9958
..
6785697
100755
(executable)
--- a/
src/os_crypto/md5/md5_op.c
+++ b/
src/os_crypto/md5/md5_op.c
@@
-5,7
+5,7
@@
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
* Foundation
*/
@@
-29,25
+29,25
@@
int OS_MD5_File(char * fname, char * output)
unsigned char buf[1024 +1];
unsigned char digest[16];
int n;
unsigned char buf[1024 +1];
unsigned char digest[16];
int n;
-
+
memset(output,0, 33);
buf[1024] = '\0';
memset(output,0, 33);
buf[1024] = '\0';
-
+
fp = fopen(fname,"r");
if(!fp)
{
return(-1);
}
fp = fopen(fname,"r");
if(!fp)
{
return(-1);
}
-
+
MD5Init(&ctx);
while((n = fread(buf, 1, sizeof(buf) -1, fp)) > 0)
{
buf[n] = '\0';
MD5Update(&ctx,buf,n);
}
MD5Init(&ctx);
while((n = fread(buf, 1, sizeof(buf) -1, fp)) > 0)
{
buf[n] = '\0';
MD5Update(&ctx,buf,n);
}
-
+
MD5Final(digest, &ctx);
MD5Final(digest, &ctx);
-
+
for(n = 0;n < 16; n++)
{
snprintf(output, 3, "%02x", digest[n]);
for(n = 0;n < 16; n++)
{
snprintf(output, 3, "%02x", digest[n]);
@@
-56,7
+56,7
@@
int OS_MD5_File(char * fname, char * output)
/* Closing it */
fclose(fp);
/* Closing it */
fclose(fp);
-
+
return(0);
}
return(0);
}
@@
-64,17
+64,17
@@
int OS_MD5_File(char * fname, char * output)
int OS_MD5_Str(char * str, char * output)
{
unsigned char digest[16];
int OS_MD5_Str(char * str, char * output)
{
unsigned char digest[16];
-
+
int n;
int n;
-
+
MD5_CTX ctx;
MD5Init(&ctx);
MD5_CTX ctx;
MD5Init(&ctx);
-
+
MD5Update(&ctx,(unsigned char *)str,strlen(str));
MD5Update(&ctx,(unsigned char *)str,strlen(str));
-
+
MD5Final(digest, &ctx);
MD5Final(digest, &ctx);
-
+
output[32] = '\0';
for(n = 0;n < 16;n++)
{
output[32] = '\0';
for(n = 0;n < 16;n++)
{