@@ -221,6 +221,7 @@ bool _native_crypto_aes_256_cbc_encrypt(aes_256_args_t args) {
221221
222222 NTSTATUS nt_status ;
223223
224+ ULONG bytes_written = args .bytes_written ? * args .bytes_written : 0u ;
224225 nt_status = BCryptEncrypt (state -> key_handle ,
225226 (PUCHAR )(args .in -> data ),
226227 args .in -> len ,
@@ -229,8 +230,9 @@ bool _native_crypto_aes_256_cbc_encrypt(aes_256_args_t args) {
229230 state -> iv_len ,
230231 args .out -> data ,
231232 args .out -> len ,
232- args . bytes_written ,
233+ & bytes_written ,
233234 0 );
235+ args .bytes_written ? (* args .bytes_written = bytes_written ) : (void )0 ;
234236
235237 if (nt_status != STATUS_SUCCESS ) {
236238 CLIENT_ERR ("error initializing cipher: 0x%x" , (int )nt_status );
@@ -255,6 +257,7 @@ bool _native_crypto_aes_256_cbc_decrypt(aes_256_args_t args) {
255257
256258 NTSTATUS nt_status ;
257259
260+ ULONG bytes_written = args .bytes_written ? * args .bytes_written : 0u ;
258261 nt_status = BCryptDecrypt (state -> key_handle ,
259262 (PUCHAR )(args .in -> data ),
260263 args .in -> len ,
@@ -263,8 +266,9 @@ bool _native_crypto_aes_256_cbc_decrypt(aes_256_args_t args) {
263266 state -> iv_len ,
264267 args .out -> data ,
265268 args .out -> len ,
266- args . bytes_written ,
269+ & bytes_written ,
267270 0 );
271+ args .bytes_written ? (* args .bytes_written = bytes_written ) : (void )0 ;
268272
269273 if (nt_status != STATUS_SUCCESS ) {
270274 CLIENT_ERR ("error initializing cipher: 0x%x" , (int )nt_status );
@@ -360,7 +364,7 @@ typedef struct {
360364static bool _cng_ctr_crypto_generate (cng_ctr_encrypt_state * state , mongocrypt_status_t * status ) {
361365 BSON_ASSERT (state );
362366
363- uint32_t bytesEncrypted = 0 ;
367+ ULONG bytesEncrypted = 0 ;
364368 NTSTATUS nt_status = BCryptEncrypt (state -> key_handle ,
365369 state -> input_block ,
366370 state -> input_block_len ,
0 commit comments