From: Qiaowei R. <qia...@in...> - 2014-03-04 06:43:17
|
changeset 947de9aa0330 in /hg/p/tboot/code details: http://hg.code.sf.net/p/tboot/code/code?cmd=changeset;node=947de9aa0330 description: Fix error "unsupported hash alg" for agile extend policy For agile policy, when verify module, error "unsupported hash alg" will be reported for those algorithms which are not spported by tboot. Signed-off-by: Qiaowei Ren <qia...@in...> diffstat: tboot/common/policy.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diffs (27 lines): diff -r 62e5aa243c7f -r 947de9aa0330 tboot/common/policy.c --- a/tboot/common/policy.c Mon Mar 03 09:59:14 2014 +0800 +++ b/tboot/common/policy.c Tue Mar 04 14:34:41 2014 +0800 @@ -440,14 +440,21 @@ return true; } + uint8_t buf[128]; + if ( !g_tpm->hash(g_tpm, 2, base, size, &img_hl) ) return false; for (unsigned int i=0; i<hl->count; i++) { for (unsigned int j=0; j<img_hl.count; j++) { if (hl->entries[i].alg == img_hl.entries[j].alg) { - if ( !extend_hash(&hl->entries[i].hash, - &img_hl.entries[j].hash, hl->entries[i].alg) ) + copy_hash((tb_hash_t *)buf, &hl->entries[i].hash, + hl->entries[i].alg); + copy_hash((tb_hash_t *)buf + get_hash_size(hl->entries[i].alg), + &img_hl.entries[j].hash, hl->entries[i].alg); + if ( !g_tpm->hash(g_tpm, 2, buf, + 2*get_hash_size(hl->entries[i].alg), hl) ) return false; + break; } } |