Skip to content

Commit f01bc97

Browse files
committed
Add check for return code in DeviceKey to avoid injecting invalid ROT
1 parent 67e9502 commit f01bc97

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

features/device_key/source/DeviceKey.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ int DeviceKey::generate_root_of_trust()
270270

271271
mbedtls_entropy_free(entropy);
272272
delete entropy;
273-
ret = device_inject_root_of_trust(key_buff, actual_size);
273+
274+
if (ret == MBED_SUCCESS) {
275+
ret = device_inject_root_of_trust(key_buff, actual_size);
276+
}
274277
#endif
275278

276279
return ret;

0 commit comments

Comments
 (0)