We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abd9c66 commit 749b1e3Copy full SHA for 749b1e3
components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c
@@ -1522,10 +1522,14 @@ static void psa_rng_operation(void)
1522
1523
case PSA_IPC_CALL: {
1524
size_t random_size = msg.out_size[0];
1525
- unsigned char *random = mbedtls_calloc(1, random_size);
1526
- if (random == NULL) {
1527
- status = PSA_ERROR_INSUFFICIENT_MEMORY;
1528
- break;
+ unsigned char *random = NULL;
+
+ if (random_size > 0) {
+ random = mbedtls_calloc(1, random_size);
1529
+ if (random == NULL) {
1530
+ status = PSA_ERROR_INSUFFICIENT_MEMORY;
1531
+ break;
1532
+ }
1533
}
1534
1535
status = psa_generate_random(random, random_size);
0 commit comments