@@ -107,7 +107,7 @@ typedef struct EncryptionThreadPoolWorkItemStruct
107107 int PasswordLength ;
108108 int Pkcs5Prf ;
109109 unsigned char * Salt ;
110-
110+ LONG volatile * pAbortKeyDerivation ;
111111 } KeyDerivation ;
112112
113113 struct
@@ -245,32 +245,32 @@ static TC_THREAD_PROC EncryptionThreadProc (void *threadArg)
245245 {
246246 case BLAKE2S :
247247 derive_key_blake2s (workItem -> KeyDerivation .Password , workItem -> KeyDerivation .PasswordLength , workItem -> KeyDerivation .Salt , PKCS5_SALT_SIZE ,
248- workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize ());
248+ workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize (), workItem -> KeyDerivation . pAbortKeyDerivation );
249249 break ;
250250
251251 case SHA512 :
252252 derive_key_sha512 (workItem -> KeyDerivation .Password , workItem -> KeyDerivation .PasswordLength , workItem -> KeyDerivation .Salt , PKCS5_SALT_SIZE ,
253- workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize ());
253+ workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize (), workItem -> KeyDerivation . pAbortKeyDerivation );
254254 break ;
255255
256256 case WHIRLPOOL :
257257 derive_key_whirlpool (workItem -> KeyDerivation .Password , workItem -> KeyDerivation .PasswordLength , workItem -> KeyDerivation .Salt , PKCS5_SALT_SIZE ,
258- workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize ());
258+ workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize (), workItem -> KeyDerivation . pAbortKeyDerivation );
259259 break ;
260260
261261 case SHA256 :
262262 derive_key_sha256 (workItem -> KeyDerivation .Password , workItem -> KeyDerivation .PasswordLength , workItem -> KeyDerivation .Salt , PKCS5_SALT_SIZE ,
263- workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize ());
263+ workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize (), workItem -> KeyDerivation . pAbortKeyDerivation );
264264 break ;
265265
266266 case STREEBOG :
267267 derive_key_streebog (workItem -> KeyDerivation .Password , workItem -> KeyDerivation .PasswordLength , workItem -> KeyDerivation .Salt , PKCS5_SALT_SIZE ,
268- workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize ());
268+ workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize (), workItem -> KeyDerivation . pAbortKeyDerivation );
269269 break ;
270270
271271 case ARGON2 :
272272 derive_key_argon2 (workItem -> KeyDerivation .Password , workItem -> KeyDerivation .PasswordLength , workItem -> KeyDerivation .Salt , PKCS5_SALT_SIZE ,
273- workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .Memorycost , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize ());
273+ workItem -> KeyDerivation .IterationCount , workItem -> KeyDerivation .Memorycost , workItem -> KeyDerivation .DerivedKey , GetMaxPkcs5OutSize (), workItem -> KeyDerivation . pAbortKeyDerivation );
274274 break ;
275275
276276 default :
@@ -533,7 +533,7 @@ void EncryptionThreadPoolStop ()
533533}
534534
535535
536- void EncryptionThreadPoolBeginKeyDerivation (TC_EVENT * completionEvent , TC_EVENT * noOutstandingWorkItemEvent , LONG * completionFlag , LONG * outstandingWorkItemCount , int pkcs5Prf , unsigned char * password , int passwordLength , unsigned char * salt , int iterationCount , int memoryCost , unsigned char * derivedKey )
536+ void EncryptionThreadPoolBeginKeyDerivation (TC_EVENT * completionEvent , TC_EVENT * noOutstandingWorkItemEvent , LONG * completionFlag , LONG * outstandingWorkItemCount , int pkcs5Prf , unsigned char * password , int passwordLength , unsigned char * salt , int iterationCount , int memoryCost , unsigned char * derivedKey , LONG volatile * pAbortKeyDerivation )
537537{
538538 EncryptionThreadPoolWorkItem * workItem ;
539539
@@ -563,6 +563,7 @@ void EncryptionThreadPoolBeginKeyDerivation (TC_EVENT *completionEvent, TC_EVENT
563563 workItem -> KeyDerivation .PasswordLength = passwordLength ;
564564 workItem -> KeyDerivation .Pkcs5Prf = pkcs5Prf ;
565565 workItem -> KeyDerivation .Salt = salt ;
566+ workItem -> KeyDerivation .pAbortKeyDerivation = pAbortKeyDerivation ;
566567
567568 InterlockedIncrement (outstandingWorkItemCount );
568569 TC_CLEAR_EVENT (* noOutstandingWorkItemEvent );
0 commit comments