接前一篇文章:tpm2-tools源码分析之tpm2_hash.c(1)
本文对tpm2_hash.c中的tpm2_tool_onstart函数进行详细解析。
先再次贴出该函数源码:
static bool tpm2_tool_onstart(tpm2_options **opts) {
static struct option topts[] = {
{"hierarchy", required_argument, NULL, 'C'},
{"hash-algorithm", required_argument, NULL, 'g'},
{"output", required_argument, NULL, 'o'},
{"ticket", required_argument, NULL, 't'},
{"hex", no_argument, NULL, 0 },
};
/* set up non-static defaults here */
ctx.input_file = stdin;
*opts = tpm2_options_new("C:g:o:t:", ARRAY_LEN(topts), topts, on_option,
on_args, 0);
return *opts != NULL;
}
好文链接
发表评论