|
From: hqzh1234 <hqz...@16...> - 2007-12-24 06:07:35
|
dear sailer:
i 'll show my program of calculate the list in IMA.it seems not
right ,could you give me some suggestion.
struct ima_queue_entry *qe;
struct crypto_hash *tfm;
struct scatterlist sg;
struct hash_desc desc;
tfm = crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC);
if (!tfm || IS_ERR(tfm)) {
ima_invalidate_pcr("No SHA1 available");
return -EFAULT;
}
desc.tfm = tfm;
desc.flags = 0;
crypto_hash_init(&desc);
list_for_each_entry_rcu(qe, &ima_measurements, later) {
memcpy(bufp, qe->entry->digest, 20);
sg_init_one(&sg, bufp, 20);
crypto_hash_update(&desc, &sg, 20);
}
crypto_hash_final(&desc, bufp);
crypto_free_hash(tfm);
in my opinion.the result of hash list will saved to bufp.why is not
right?
yours chris
|