Skip to content

Commit 1876de0

Browse files
Copilotporfanid
andcommitted
Improve error propagation: Check return values of key_init and mc_initialize
Co-authored-by: porfanid <19299306+porfanid@users.noreply.github.com>
1 parent 7197ac4 commit 1876de0

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/core/crypto_config.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,12 @@ int32_t Crypto_Init(void)
264264
key_if = get_key_interface_kmc();
265265
}
266266
}
267-
key_if->key_init();
268-
// TODO: Check and return status on error
267+
status = key_if->key_init();
268+
if (status != CRYPTO_LIB_SUCCESS)
269+
{
270+
return status;
271+
}
272+
269273
/* MC Interface */
270274
if (mc_if == NULL)
271275
{
@@ -282,8 +286,12 @@ int32_t Crypto_Init(void)
282286
mc_if = get_mc_interface_internal();
283287
}
284288
}
285-
mc_if->mc_initialize();
286-
// TODO: Check and return status on error
289+
status = mc_if->mc_initialize();
290+
if (status != CRYPTO_LIB_SUCCESS)
291+
{
292+
return status;
293+
}
294+
287295
/* SA Interface */
288296
if (sa_if == NULL)
289297
{
@@ -310,7 +318,7 @@ int32_t Crypto_Init(void)
310318
{
311319
status = SADB_INVALID_SADB_TYPE;
312320
return status;
313-
} // TODO: Error stack
321+
}
314322
}
315323

316324
/* Crypto Interface */

0 commit comments

Comments
 (0)