Hans Leidekker (@hans) commented about dlls/ncrypt/tests/ncrypt.c:
- output_a = malloc(output_size);
- ret = NCryptEncrypt(key, data_to_encrypt, sizeof(data_to_encrypt), NULL, output_a, output_size,
&output_size, NCRYPT_NO_PADDING_FLAG);
- ok(ret == NTE_INVALID_PARAMETER, "got %lx\n", ret);
- free(output_a);
- /* Test output RSA with PKCS1. PKCS1 should append a random padding to the data, so the output should be different
* with each call. */
- ret = NCryptEncrypt(key, data_to_encrypt, sizeof(data_to_encrypt), NULL, NULL, 0,
&output_size, NCRYPT_PAD_PKCS1_FLAG);
- ok(ret == ERROR_SUCCESS, "got %lx\n", ret);
- ok(output_size == 128, "got %ld\n", output_size);
- output_a = malloc(output_size);
- output_b = malloc(output_size);
It would be good to initialize these buffers (i.e. use calloc()), especially since you expect them to be different after encryption.