Permalink
Browse files

when intializing attmoddiskpairs buffer, make sure diskIDIndex is not…

… equal to any existing diskUUID table index; but that then requires potentially redundantly setting diskIDIndex when setting attmodtime on an empty buffer for the first time
  • Loading branch information...
1 parent 4bd312e commit e4d402ce46cc6ccad9d901110d3c077a4ce48cd2 @scrod committed Jan 18, 2011
Showing with 4 additions and 1 deletion.
  1. +1 −0 BufferUtils.c
  2. +2 −1 NSData_transformations.m
  3. +1 −0 NoteObject.m
View
@@ -334,6 +334,7 @@ unsigned int SetAttrModTimeForDiskIDIndex(UTCDateTime *dateTime, UInt16 diskInde
//use this slot if the diskIndex matches OR it's the first one listed and its attrTime hasn't been touched
if (pairs[i].diskIDIndex == diskIndex || (!i && *(int64_t*)&(pairs[i].attrTime) == 0LL)) {
pairs[i].attrTime = *dateTime;
+ pairs[i].diskIDIndex = diskIndex;
return i;
}
}
View
@@ -170,10 +170,11 @@ - (NSMutableData*)derivedKeyOfLength:(int)len salt:(NSData*)salt iterations:(int
//NSDate *date = [NSDate date];
//when compiled with -Os or greater, this is always faster than OpenSSL version
+#if 1
if (!pbkdf2_sha1([self bytes], [self length], [salt bytes], [salt length], (unsigned int)count, [derivedKey mutableBytes], (size_t)len))
return nil;
//NSLog(@"dk_time(%d): %g", count, (float)[[NSDate date] timeIntervalSinceDate:date]);
-#if 0
+#else
if (!PKCS5_PBKDF2_HMAC_SHA1([self bytes], [self length], (unsigned char*)[salt bytes], [salt length], count, len, [derivedKey mutableBytes]))
return nil;
#endif
View
@@ -59,6 +59,7 @@ - (id)init {
bzero(&fileModifiedDate, sizeof(UTCDateTime));
attrModDiskPairs = calloc(1, sizeof(AttrModDiskPair));
+ attrModDiskPairs[0].diskIDIndex = -1;
attrModPairCount = 1;
modifiedDate = createdDate = 0.0;

0 comments on commit e4d402c

Please sign in to comment.