Permalink
Browse files

[droid] fix symbol collision with python

  • Loading branch information...
1 parent 2ac5937 commit e5c297e23e5b0f1a55588a7bd12add60a783e4d5 theuni committed May 10, 2012
Showing with 26 additions and 25 deletions.
  1. +6 −5 lib/libRTV/crypt.c
  2. +16 −16 lib/libRTV/md5.c
  3. +4 −4 lib/libRTV/md5.h
View
@@ -50,11 +50,12 @@ static void checksum(unsigned char * dest, unsigned const char * src, u32 len,
0x96,0x43,0x2b,0xcc, 0x0c,0x9d,0x26,0xb9,
}};
- md5_context c;
- md5_starts(&c);
- md5_update(&c, src, len);
- md5_update(&c, extradata[checksum_num], sizeof extradata[checksum_num]);
- md5_finish(&c, dest);
+ rtv_md5_context c;
+ rtv_md5_starts(&c);
+ rtv_md5_update(&c, src, len);
+ rtv_md5_update(&c, extradata[checksum_num], sizeof extradata[checksum_num]);
+ rtv_md5_finish(&c, dest);
+
}
static u32 cryptblock(u32 k, char * buf, u32 size)
View
@@ -31,7 +31,7 @@
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
}
-void md5_starts( md5_context *ctx )
+void rtv_md5_starts( rtv_md5_context *ctx )
{
ctx->total[0] = 0;
ctx->total[1] = 0;
@@ -42,7 +42,7 @@ void md5_starts( md5_context *ctx )
ctx->state[3] = 0x10325476;
}
-void md5_process( md5_context *ctx, const uint8 data[64] )
+void rtv_md5_process( rtv_md5_context *ctx, const uint8 data[64] )
{
uint32 X[16], A, B, C, D;
@@ -165,7 +165,7 @@ void md5_process( md5_context *ctx, const uint8 data[64] )
ctx->state[3] += D;
}
-void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
+void rtv_md5_update( rtv_md5_context *ctx, const uint8 *input, uint32 length )
{
uint32 left, fill;
@@ -184,15 +184,15 @@ void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
{
memcpy( (void *) (ctx->buffer + left),
(void *) input, fill );
- md5_process( ctx, ctx->buffer );
+ rtv_md5_process( ctx, ctx->buffer );
length -= fill;
input += fill;
left = 0;
}
while( length >= 64 )
{
- md5_process( ctx, input );
+ rtv_md5_process( ctx, input );
length -= 64;
input += 64;
}
@@ -204,15 +204,15 @@ void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
}
}
-static uint8 md5_padding[64] =
+static uint8 rtv_md5_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-void md5_finish( md5_context *ctx, uint8 digest[16] )
+void rtv_md5_finish( rtv_md5_context *ctx, uint8 digest[16] )
{
uint32 last, padn;
uint32 high, low;
@@ -228,8 +228,8 @@ void md5_finish( md5_context *ctx, uint8 digest[16] )
last = ctx->total[0] & 0x3F;
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
- md5_update( ctx, md5_padding, padn );
- md5_update( ctx, msglen, 8 );
+ rtv_md5_update( ctx, rtv_md5_padding, padn );
+ rtv_md5_update( ctx, msglen, 8 );
PUT_UINT32( ctx->state[0], digest, 0 );
PUT_UINT32( ctx->state[1], digest, 4 );
@@ -274,7 +274,7 @@ int main( int argc, char *argv[] )
FILE *f;
int i, j;
char output[33];
- md5_context ctx;
+ rtv_md5_context ctx;
unsigned char buf[1000];
unsigned char md5sum[16];
@@ -286,9 +286,9 @@ int main( int argc, char *argv[] )
{
//printf( " Test %d ", i + 1 );
- md5_starts( &ctx );
- md5_update( &ctx, (uint8 *) msg[i], strlen( msg[i] ) );
- md5_finish( &ctx, md5sum );
+ rtv_md5_starts( &ctx );
+ rtv_md5_update( &ctx, (uint8 *) msg[i], strlen( msg[i] ) );
+ rtv_md5_finish( &ctx, md5sum );
for( j = 0; j < 16; j++ )
{
@@ -314,14 +314,14 @@ int main( int argc, char *argv[] )
return( 1 );
}
- md5_starts( &ctx );
+ rtv_md5_starts( &ctx );
while( ( i = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
{
- md5_update( &ctx, buf, i );
+ rtv_md5_update( &ctx, buf, i );
}
- md5_finish( &ctx, md5sum );
+ rtv_md5_finish( &ctx, md5sum );
for( j = 0; j < 16; j++ )
{
View
@@ -15,10 +15,10 @@ typedef struct
uint32 state[4];
uint8 buffer[64];
}
-md5_context;
+rtv_md5_context;
-void md5_starts( md5_context *ctx );
-void md5_update( md5_context *ctx, const uint8 *input, uint32 length );
-void md5_finish( md5_context *ctx, uint8 digest[16] );
+void rtv_md5_starts( rtv_md5_context *ctx );
+void rtv_md5_update( rtv_md5_context *ctx, const uint8 *input, uint32 length );
+void rtv_md5_finish( rtv_md5_context *ctx, uint8 digest[16] );
#endif /* md5.h */

0 comments on commit e5c297e

Please sign in to comment.