Skip to content

Commit 26d033b

Browse files
jukkarfabiobaltieri
authored andcommitted
net: ipv6_pe: Check return value from mbedtls_md_setup
Bail out if mbedtls_md_setup() returns an error. Fixes #81950 Coverify-CID: 434626 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 7d20d3a commit 26d033b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

subsys/net/ip/ipv6_pe.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,12 @@ static int gen_temporary_iid(struct net_if *iface,
256256
}
257257

258258
mbedtls_md_init(&ctx);
259-
mbedtls_md_setup(&ctx, md_info, true);
259+
ret = mbedtls_md_setup(&ctx, md_info, true);
260+
if (ret != 0) {
261+
NET_DBG("Cannot %s hmac (%d)", "setup", ret);
262+
goto err;
263+
}
264+
260265
ret = mbedtls_md_hmac_starts(&ctx, secret_key, sizeof(secret_key));
261266
if (ret != 0) {
262267
NET_DBG("Cannot %s hmac (%d)", "start", ret);

0 commit comments

Comments
 (0)