Changeset ab77928 in mainline for uspace/lib/ext4/libext4_hash.c
- Timestamp:
- 2011-10-26T09:27:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0dc91833
- Parents:
- aaedaba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_hash.c
raaedaba rab77928 49 49 #define H(x, y, z) ((x) ^ (y) ^ (z)) 50 50 51 51 52 /* 52 53 * The generic round function. The application is so specific that … … 62 63 63 64 64 static void tea_transform(uint32_t buf[4], uint32_t const in[])65 static void tea_transform(uint32_t buf[4], uint32_t const in[]) 65 66 { 66 67 uint32_t sum = 0; … … 233 234 int i; 234 235 uint32_t in[8], buf[4]; 235 bool unsigned_version = false; 236 void (*str2hashbuf)(const char *, int, uint32_t *, int) = str2hashbuf_signed; 237 238 /* 239 for (i = 0; i < 8; ++i) { 240 in[i] = 0; 241 } 242 */ 236 243 237 244 /* Initialize the default seed for the hash checksum functions */ … … 247 254 break; 248 255 } 249 if (i < 4) {250 memcpy(buf, hinfo->seed, sizeof(buf));251 }256 } 257 if (i < 4) { 258 memcpy(buf, hinfo->seed, sizeof(buf)); 252 259 } 253 260 } … … 264 271 265 272 case EXT4_HASH_VERSION_HALF_MD4_UNSIGNED: 266 unsigned_version = true;273 str2hashbuf = str2hashbuf_unsigned; 267 274 268 275 case EXT4_HASH_VERSION_HALF_MD4: 269 276 p = name; 270 277 while (len > 0) { 271 if (unsigned_version) { 272 str2hashbuf_unsigned(p, len, in, 8); 273 } else { 274 str2hashbuf_signed(p, len, in, 8); 275 } 278 (*str2hashbuf)(p, len, in, 8); 276 279 half_md4_transform(buf, in); 277 280 len -= 32; … … 284 287 285 288 case EXT4_HASH_VERSION_TEA_UNSIGNED: 286 unsigned_version = true;289 str2hashbuf = str2hashbuf_unsigned; 287 290 288 291 case EXT4_HASH_VERSION_TEA: 289 292 p = name; 290 293 while (len > 0) { 291 if (unsigned_version) { 292 str2hashbuf_unsigned(p, len, in, 4); 293 } else { 294 str2hashbuf_signed(p, len, in, 4); 295 } 294 (*str2hashbuf)(p, len, in, 4); 296 295 tea_transform(buf, in); 297 296 len -= 16; … … 311 310 hash = (EXT4_DIRECTORY_HTREE_EOF-1) << 1; 312 311 } 312 313 313 hinfo->hash = hash; 314 314 hinfo->minor_hash = minor_hash;
Note:
See TracChangeset
for help on using the changeset viewer.