diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lib/md5.c | 17 | ||||
-rw-r--r-- | apps/plugins/md5sum.c | 22 |
2 files changed, 31 insertions, 8 deletions
diff --git a/apps/plugins/lib/md5.c b/apps/plugins/lib/md5.c index 97156634e5..05535de12c 100644 --- a/apps/plugins/lib/md5.c +++ b/apps/plugins/lib/md5.c | |||
@@ -34,7 +34,14 @@ void md5_init( const struct plugin_api *api ) | |||
34 | rb = api; | 34 | rb = api; |
35 | } | 35 | } |
36 | 36 | ||
37 | #ifdef WORDS_BIGENDIAN | 37 | #ifdef ROCKBOX_BIG_ENDIAN |
38 | static inline uint32_t GetDWLE( const void * _p ) | ||
39 | { | ||
40 | const uint8_t * p = (const uint8_t *)_p; | ||
41 | return ( ((uint32_t)p[3] << 24) | ((uint32_t)p[2] << 16) | ||
42 | | ((uint32_t)p[1] << 8) | p[0] ); | ||
43 | } | ||
44 | |||
38 | /***************************************************************************** | 45 | /***************************************************************************** |
39 | * Reverse: reverse byte order | 46 | * Reverse: reverse byte order |
40 | *****************************************************************************/ | 47 | *****************************************************************************/ |
@@ -246,10 +253,10 @@ void psz_md5_hash( char *psz, struct md5_s *md5_s ) | |||
246 | for ( i = 0; i < 4; i++ ) | 253 | for ( i = 0; i < 4; i++ ) |
247 | { | 254 | { |
248 | rb->snprintf( &psz[8*i], 9, "%02x%02x%02x%02x", | 255 | rb->snprintf( &psz[8*i], 9, "%02x%02x%02x%02x", |
249 | md5_s->p_digest[i] & 0xff, | 256 | (unsigned int)(md5_s->p_digest[i] & 0xff), |
250 | ( md5_s->p_digest[i] >> 8 ) & 0xff, | 257 | (unsigned int)(( md5_s->p_digest[i] >> 8 ) & 0xff), |
251 | ( md5_s->p_digest[i] >> 16 ) & 0xff, | 258 | (unsigned int)(( md5_s->p_digest[i] >> 16 ) & 0xff), |
252 | md5_s->p_digest[i] >> 24 | 259 | (unsigned int)(md5_s->p_digest[i] >> 24) |
253 | ); | 260 | ); |
254 | } | 261 | } |
255 | } | 262 | } |
diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c index 6845c4c473..1c27fe53ac 100644 --- a/apps/plugins/md5sum.c +++ b/apps/plugins/md5sum.c | |||
@@ -24,12 +24,15 @@ PLUGIN_HEADER | |||
24 | 24 | ||
25 | static const struct plugin_api *rb; | 25 | static const struct plugin_api *rb; |
26 | 26 | ||
27 | MEM_FUNCTION_WRAPPERS(rb); | ||
28 | |||
27 | int hash( char *string, const char *path ) | 29 | int hash( char *string, const char *path ) |
28 | { | 30 | { |
29 | char *buffer[512]; | 31 | char *buffer[512]; |
30 | ssize_t len; | 32 | ssize_t len; |
31 | struct md5_s md5; | 33 | struct md5_s md5; |
32 | int in = rb->open( path, O_RDONLY ); | 34 | int in = rb->open( path, O_RDONLY ); |
35 | rb->splash( 0, path ); | ||
33 | if( in < 0 ) return -1; | 36 | if( in < 0 ) return -1; |
34 | 37 | ||
35 | InitMD5( &md5 ); | 38 | InitMD5( &md5 ); |
@@ -50,7 +53,7 @@ void hash_file( int out, const char *path ) | |||
50 | rb->write( out, "error", 5 ); | 53 | rb->write( out, "error", 5 ); |
51 | else | 54 | else |
52 | rb->write( out, string, MD5_STRING_LENGTH ); | 55 | rb->write( out, string, MD5_STRING_LENGTH ); |
53 | rb->write( out, " ", 1 ); | 56 | rb->write( out, " ", 2 ); |
54 | rb->write( out, path, rb->strlen( path ) ); | 57 | rb->write( out, path, rb->strlen( path ) ); |
55 | rb->write( out, "\n", 1 ); | 58 | rb->write( out, "\n", 1 ); |
56 | } | 59 | } |
@@ -129,7 +132,8 @@ void hash_check( int out, const char *path ) | |||
129 | else | 132 | else |
130 | { | 133 | { |
131 | char string[MD5_STRING_LENGTH+1]; | 134 | char string[MD5_STRING_LENGTH+1]; |
132 | filename++; | 135 | while( *filename == ' ' ) |
136 | filename++; | ||
133 | rb->write( out, filename, rb->strlen( filename ) ); | 137 | rb->write( out, filename, rb->strlen( filename ) ); |
134 | rb->write( out, ": ", 2 ); | 138 | rb->write( out, ": ", 2 ); |
135 | if( hash( string, filename ) ) | 139 | if( hash( string, filename ) ) |
@@ -151,6 +155,9 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
151 | 155 | ||
152 | md5_init( api ); | 156 | md5_init( api ); |
153 | rb = api; | 157 | rb = api; |
158 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
159 | rb->cpu_boost( true ); | ||
160 | #endif | ||
154 | 161 | ||
155 | if( arg && *arg ) | 162 | if( arg && *arg ) |
156 | { | 163 | { |
@@ -158,7 +165,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
158 | DIR *dir; | 165 | DIR *dir; |
159 | rb->snprintf( filename, MAX_PATH, "%s.md5sum", arg ); | 166 | rb->snprintf( filename, MAX_PATH, "%s.md5sum", arg ); |
160 | out = rb->open( filename, O_WRONLY|O_CREAT ); | 167 | out = rb->open( filename, O_WRONLY|O_CREAT ); |
161 | if( out < 0 ) return PLUGIN_ERROR; | 168 | if( out < 0 ) |
169 | { | ||
170 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
171 | rb->cpu_boost( false ); | ||
172 | #endif | ||
173 | return PLUGIN_ERROR; | ||
174 | } | ||
162 | 175 | ||
163 | if( ext ) | 176 | if( ext ) |
164 | { | 177 | { |
@@ -202,5 +215,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
202 | 215 | ||
203 | exit: | 216 | exit: |
204 | rb->close( out ); | 217 | rb->close( out ); |
218 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
219 | rb->cpu_boost( false ); | ||
220 | #endif | ||
205 | return PLUGIN_OK; | 221 | return PLUGIN_OK; |
206 | } | 222 | } |