<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -343,6 +343,7 @@ static void FixKeyLengths( CCAlgorithm algorithm, NSMutableData * keyData, NSMut
 	size_t bufsize = CCCryptorGetOutputLength( cryptor, (size_t)[self length], true );
 	void * buf = malloc( bufsize );
 	size_t bufused = 0;
+    size_t bytesTotal = 0;
 	*status = CCCryptorUpdate( cryptor, [self bytes], (size_t)[self length], 
 							  buf, bufsize, &amp;bufused );
 	if ( *status != kCCSuccess )
@@ -350,6 +351,8 @@ static void FixKeyLengths( CCAlgorithm algorithm, NSMutableData * keyData, NSMut
 		free( buf );
 		return ( nil );
 	}
+    
+    bytesTotal += bufused;
 	
 	// From Brent Royal-Gordon (Twitter: architechies):
 	//  Need to update buf ptr past used bytes when calling CCCryptorFinal()
@@ -359,8 +362,10 @@ static void FixKeyLengths( CCAlgorithm algorithm, NSMutableData * keyData, NSMut
 		free( buf );
 		return ( nil );
 	}
+    
+    bytesTotal += bufused;
 	
-	return ( [NSData dataWithBytesNoCopy: buf length: bufused] );
+	return ( [NSData dataWithBytesNoCopy: buf length: bytesTotal] );
 }
 
 - (NSData *) dataEncryptedUsingAlgorithm: (CCAlgorithm) algorithm</diff>
      <filename>CommonCrypto/NSData+CommonCrypto.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6444c94dba3aefb8a548be89d8a0b0781dd079f8</id>
    </parent>
  </parents>
  <author>
    <name>Jim Dovey</name>
    <email>jimdovey@mac.com</email>
  </author>
  <url>http://github.com/AlanQuatermain/aqtoolkit/commit/3df3b8d687f164ab3ba6a6fdf16306f87c709e06</url>
  <id>3df3b8d687f164ab3ba6a6fdf16306f87c709e06</id>
  <committed-date>2009-04-13T16:03:47-07:00</committed-date>
  <authored-date>2009-04-13T16:03:47-07:00</authored-date>
  <message>Fixed a bug calculating output data sizes from core encrypt/decrypt function.
Credit goes to Brendan Duddrudge for the information on this one.</message>
  <tree>932a7c27b2c693f64f834cae0ac175de4db06ee0</tree>
  <committer>
    <name>Jim Dovey</name>
    <email>jimdovey@mac.com</email>
  </committer>
</commit>
