Skip to content

Commit ae0ec86

Browse files
authored
Merge pull request #12667 from boomer41/fix-devicekey
Add check for return code in DeviceKey to avoid injecting invalid ROT
2 parents 539cf3f + c6e8ae5 commit ae0ec86

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
@@ -269,7 +269,10 @@ int DeviceKey::generate_root_of_trust()
269269

270270
mbedtls_entropy_free(entropy);
271271
delete entropy;
272-
ret = device_inject_root_of_trust(key_buff, actual_size);
272+
273+
if (ret == DEVICEKEY_SUCCESS) {
274+
ret = device_inject_root_of_trust(key_buff, actual_size);
275+
}
273276
#endif
274277

275278
return ret;

0 commit comments

Comments
 (0)