Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=630a7649362b922435dd21701477a950795d1994

commit 630a7649362b922435dd21701477a950795d1994
Author: Michel Hermier <[email protected]>
Date:   Wed May 15 08:36:15 2013 +0200

libflib: Update fmd5 API to flib naming and argument ordering.

diff --git a/lib/libflib/fmd5.c b/lib/libflib/fmd5.c
index 30ce600..a3045c2 100644
--- a/lib/libflib/fmd5.c
+++ b/lib/libflib/fmd5.c
@@ -94,7 +94,7 @@ Rotation is separate from addition to prevent recomputation.

/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
-void f_MD5Init (context)
+void f_md5_init (context)
MD5_CTX *context;                                        /* context */
{
context->count[0] = context->count[1] = 0;
@@ -110,7 +110,7 @@ MD5_CTX *context;                                        /* 
context */
operation, processing another message block, and updating the
context.
*/
-void f_MD5Update (context, input, inputLen)
+void f_md5_update (context, input, inputLen)
MD5_CTX *context;                                        /* context */
unsigned char *input;                                /* input block */
unsigned int inputLen;                     /* length of input block */
@@ -150,7 +150,7 @@ unsigned int inputLen;                     /* length of 
input block */
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
-void f_MD5Final (digest, context)
+void f_md5_fini (context, digest)
unsigned char digest[16];                         /* message digest */
MD5_CTX *context;                                       /* context */
{
@@ -164,10 +164,10 @@ MD5_CTX *context;                                       
/* context */
*/
md5_index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (md5_index < 56) ? (56 - md5_index) : (120 - md5_index);
-  f_MD5Update (context, PADDING, padLen);
+  f_md5_update (context, PADDING, padLen);

/* Append length (before padding) */
-  f_MD5Update (context, bits, 8);
+  f_md5_update (context, bits, 8);

/* Store state in digest */
Encode (digest, context->state, 16);
diff --git a/lib/libflib/fmd5.h b/lib/libflib/fmd5.h
index f303e9d..f12bada 100644
--- a/lib/libflib/fmd5.h
+++ b/lib/libflib/fmd5.h
@@ -40,8 +40,8 @@ typedef struct {
unsigned char buffer[64];                         /* input buffer */
} MD5_CTX;

-void f_MD5Init(MD5_CTX *);
-void f_MD5Update(MD5_CTX *, unsigned char *, unsigned int);
-void f_MD5Final(unsigned char [16], MD5_CTX *);
+void f_md5_init (MD5_CTX *);
+void f_md5_update (MD5_CTX *, unsigned char *, unsigned int);
+void f_md5_fini (MD5_CTX *, unsigned char [16]);

/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/md5driver.c b/lib/libpacman/md5driver.c
index 97e9be4..444d00d 100644
--- a/lib/libpacman/md5driver.c
+++ b/lib/libpacman/md5driver.c
@@ -37,9 +37,6 @@ documentation and/or software.
#define TEST_BLOCK_COUNT 1000

#define MD_CTX MD5_CTX
-#define MDInit f_MD5Init
-#define MDUpdate f_MD5Update
-#define MDFinal f_MD5Final

char* _pacman_MDFile(char *filename)
{
@@ -54,11 +51,11 @@ char* _pacman_MDFile(char *filename)
char *ret;
int i, x;

-               MDInit(&context);
+               f_md5_init (&context);
while((len = fread(buffer, 1, 1024, file))) {
-                       MDUpdate(&context, buffer, len);
+                       f_md5_update (&context, buffer, len);
}
-               MDFinal(digest, &context);
+               f_md5_fini (digest, &context);
fclose(file);
/*printf("MD5 (%s) = ", filename);
MDPrint(digest);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to