Changeset 19 for trunk/src/sh_tiger0.c
- Timestamp:
- Feb 12, 2006, 10:49:56 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_tiger0.c
r18 r19 104 104 static 105 105 word64 * sh_tiger_hash_val (char * filename, TigerType what, 106 unsigned longLength, int timeout)106 UINT64 Length, int timeout) 107 107 #else 108 108 static 109 109 sh_word32 * sh_tiger_hash_val (char * filename, TigerType what, 110 unsigned longLength, int timeout)110 UINT64 Length, int timeout) 111 111 #endif 112 112 { … … 117 117 char * tmp; 118 118 sh_byte * bptr; 119 sh_byte bbuf[64]; 119 sh_byte bbuf[64]; 120 UINT64 bcount = 0; 120 121 121 122 static int lockflag = SL_FALSE; … … 178 179 179 180 #if defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK) 180 if ( lockflag == SL_FALSE && skey->mlock_failed == SL_FALSE)181 if ((lockflag == SL_FALSE) && (skey->mlock_failed == SL_FALSE)) 181 182 { 182 if ( (-1) == sh_unix_mlock((char *)buffer,(PRIV_MAX)*sizeof(sh_byte))) 183 lockflag = SL_TRUE; 184 if ( (-1) == sh_unix_mlock(FIL__, __LINE__, 185 (char *)buffer, 186 (PRIV_MAX)*sizeof(sh_byte))) 183 187 skey->mlock_failed = SL_TRUE; 184 lockflag = SL_TRUE;185 188 } 186 189 #else 187 190 if (lockflag == SL_FALSE && skey->mlock_failed == SL_FALSE) 188 191 { 192 lockflag = SL_TRUE; 189 193 skey->mlock_failed = SL_TRUE; 190 lockflag = SL_TRUE;191 194 } 192 195 #endif … … 229 232 230 233 SL_RETURN( NULL, _("sh_tiger_hash_val")); 234 } 235 236 if (Length > 0) 237 { 238 bcount += count; 239 if (bcount > Length) 240 count = count - (bcount - Length); 241 count = (count < 0) ? 0 : count; 231 242 } 232 243 … … 382 393 if (what == TIGER_DATA && filename != NULL) 383 394 { 384 tiger(TIGER_CAST filename, 395 tiger(TIGER_CAST filename, (sh_word32) Length, res); 385 396 SL_RETURN(res, _("sh_tiger_hash_val")); 386 397 } … … 692 703 resulting message digest number will be written into the 16 bytes 693 704 beginning at RESBLOCK. */ 694 static int md5_stream(char * filename, void *resblock, int timeout) 705 static int md5_stream(char * filename, void *resblock, 706 UINT64 Length, int timeout) 695 707 { 696 708 /* Important: BLOCKSIZE must be a multiple of 64. */ … … 702 714 char * tmp; 703 715 uid_t euid; 716 UINT64 bcount = 0; 704 717 705 718 unsigned long pages_read; … … 762 775 } 763 776 777 if (Length > 0) 778 { 779 bcount += n; 780 if (bcount > Length) 781 n = n - (bcount - Length); 782 n = (n < 0) ? 0 : n; 783 } 784 764 785 sum += n; 765 786 } … … 807 828 static 808 829 char * sh_tiger_md5_hash (char * filename, TigerType what, 809 unsigned longLength, int timeout)810 { 811 int cnt = (int) Length;830 UINT64 Length, int timeout) 831 { 832 int cnt; 812 833 static char out[KEY_LEN+1]; 813 834 unsigned char md5buffer[16]; … … 822 843 } 823 844 824 (void) md5_stream (filename, md5buffer, timeout);845 (void) md5_stream (filename, md5buffer, Length, timeout); 825 846 826 847 /*@-bufferoverflowhigh -usedef@*/ … … 1202 1223 resulting message digest number will be written into the 16 bytes 1203 1224 beginning at RESBLOCK. */ 1204 static int sha1_stream(char * filename, void *resblock, int timeout) 1225 static int sha1_stream(char * filename, void *resblock, 1226 UINT64 Length, int timeout) 1205 1227 { 1206 1228 /* Important: BLOCKSIZE must be a multiple of 64. */ … … 1212 1234 char * tmp; 1213 1235 uid_t euid; 1236 UINT64 bcount = 0; 1214 1237 1215 1238 unsigned long pages_read; … … 1275 1298 } 1276 1299 1300 if (Length > 0) 1301 { 1302 bcount += n; 1303 if (bcount > Length) 1304 n = n - (bcount - Length); 1305 n = (n < 0) ? 0 : n; 1306 } 1307 1277 1308 sum += n; 1278 1309 } … … 1322 1353 1323 1354 static char * sh_tiger_sha1_hash (char * filename, TigerType what, 1324 unsigned longLength, int timeout)1355 UINT64 Length, int timeout) 1325 1356 { 1326 1357 int cnt = (int) Length; /* fix compiler warning */ … … 1337 1368 } 1338 1369 1339 (void) sha1_stream (filename, sha1buffer, timeout);1370 (void) sha1_stream (filename, sha1buffer, Length, timeout); 1340 1371 1341 1372 /*@-bufferoverflowhigh -usedef@*/ … … 1388 1419 1389 1420 static char * sh_tiger_hash_internal (char * filename, TigerType what, 1390 unsigned longLength, int timeout);1421 UINT64 Length, int timeout); 1391 1422 1392 1423 char * sh_tiger_hash (char * filename, TigerType what, 1393 unsigned longLength)1424 UINT64 Length) 1394 1425 { 1395 1426 return sh_tiger_hash_internal (filename, what, Length, 0); … … 1397 1428 1398 1429 char * sh_tiger_generic_hash (char * filename, TigerType what, 1399 unsigned longLength, int timeout)1430 UINT64 Length, int timeout) 1400 1431 { 1401 1432 #ifdef USE_SHA1 … … 1414 1445 1415 1446 static char * sh_tiger_hash_internal (char * filename, TigerType what, 1416 unsigned longLength, int timeout)1447 UINT64 Length, int timeout) 1417 1448 { 1418 1449 #if defined(TIGER_64_BIT) … … 1423 1454 static char out[KEY_LEN+1]; 1424 1455 1425 SL_ENTER( _("sh_tiger_hash "));1456 SL_ENTER( _("sh_tiger_hash_internal")); 1426 1457 1427 1458 res = sh_tiger_hash_val (filename, what, Length, timeout); … … 1451 1482 /*@+bufferoverflowhigh@*/ 1452 1483 out[KEY_LEN] = '\0'; 1453 SL_RETURN( out, _("sh_tiger_hash "));1484 SL_RETURN( out, _("sh_tiger_hash_internal")); 1454 1485 1455 1486 } 1456 1487 1457 1488 SL_RETURN( _("000000000000000000000000000000000000000000000000"), 1458 _("sh_tiger_hash "));1489 _("sh_tiger_hash_internal")); 1459 1490 } 1460 1491 1461 1492 char * sh_tiger_hash_gpg (char * filename, TigerType what, 1462 unsigned longLength)1493 UINT64 Length) 1463 1494 { 1464 1495 size_t len; … … 1530 1561 UINT32 * sh_tiger_hash_uint32 (char * filename, 1531 1562 TigerType what, 1532 unsigned longLength)1563 UINT64 Length) 1533 1564 { 1534 1565 #if defined(TIGER_64_BIT)
Note:
See TracChangeset
for help on using the changeset viewer.