Re: [ PATCH v4 2/6] sign-file: move file signing logic to its own function

From: David Howells
Date: Tue Mar 14 2023 - 12:11:41 EST


Shreenidhi Shedi <yesshedi@xxxxxxxxx> wrote:

> Keep the main function bare minimal and do less in main function.

I would recommend repeating the subject here and expanding on it. You also
need to say what the goal is.

> + char *hash_algo = opts->hash_algo;
> + char *dest_name = opts->dest_name;
> + char *private_key_name = opts->private_key_name;
> + char *raw_sig_name = opts->raw_sig_name;
> + char *x509_name = opts->x509_name;
> + char *module_name = opts->module_name;

I suggest just using opts-> everywhere rather than copying everything out into
stack variables.

> + OpenSSL_add_all_algorithms();
> + ERR_load_crypto_strings();
> + ERR_clear_error();

That would seem like it belongs in main().

> + struct cmd_opts opts = {0};

It would be better to do "struct cmd_opts opts = {};"

David