接前一篇文章:tpm2-tools源码分析之tpm2_getrandom.c(2)
本文对tpm2_getrandom.c中的tpm2_tool_onrun函数进行详细解析。
先再次贴出该函数源码:
static tool_rc tpm2_tool_onrun(ESYS_CONTEXT *ectx, tpm2_option_flags flags) {
UNUSED(flags);
/*
* 1. Process options
*/
/*
* 2. Process inputs
*/
tool_rc rc = process_inputs(ectx);
if (rc != tool_rc_success) {
return rc;
}
/*
* 3. TPM2_CC_<command> call
*/
rc = get_random(ectx);
if (rc != tool_rc_success) {
return rc;
}
/*
* 4. Process outputs
*/
re