Fix a segmentation fault in the ECDSA signing logic of `mkimage`
that occurs when the "-r" option is not specified.
This reproduces the logic in `lib/rsa/rsa-sign.c` by checking if
`info->require_keys` is non-null before passing it to
`fdt_setprop_string()`.
Signed-off-by: Lucas Dietrich <lucas.dietrich.git@proton.me>
if (ret < 0)
return ret;
- ret = fdt_setprop_string(fdt, key_node, FIT_KEY_REQUIRED,
- info->require_keys);
- if (ret < 0)
- return ret;
+ if (info->require_keys) {
+ ret = fdt_setprop_string(fdt, key_node, FIT_KEY_REQUIRED,
+ info->require_keys);
+ if (ret < 0)
+ return ret;
+ }
return key_node;
}