Not logged in
Log in now
Create an account
Subscribe to LWN
Recent Features
Book review: Open Advice
Linux support for ARM big.LITTLE
LWN.net Weekly Edition for February 9, 2012
XBMC 11 "Eden"
LWN.net Weekly Edition for February 2, 2012
Why not just use the SHA1 only?
Posted May 23, 2010 9:47 UTC (Sun) by rafal.maj (guest, #66508) [Link]
Posted May 23, 2010 10:57 UTC (Sun) by johill (subscriber, #25196) [Link]
+#define PAGECMP_OFFSET 128 +#define PAGEHASH_SIZE (PAGECMP_OFFSET ? PAGECMP_OFFSET : PAGE_SIZE) +/* hash the page */ +static void page_hash(struct page *page, unsigned char *digest) +{ + struct scatterlist sg; + struct hash_desc desc; + + sg_init_table(&sg, 1); + sg_set_page(&sg, page, PAGEHASH_SIZE, 0); + desc.tfm = tfm; + desc.flags = 0; + crypto_hash_digest(&desc, &sg, PAGEHASH_SIZE, digest); +}
Copyright © 2012, Eklektix, Inc. Comments and public postings are copyrighted by their creators. Linux is a registered trademark of Linus Torvalds