Re: crypto API to compute the hash of some small kernel-memory buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 22, 2007 at 01:13:59AM +0100, Nicolas Boullis wrote:
> 
> First of all, sorry to bother you. I thought I'd rather ask my question 
> to a list dedicated to the crypto API, but only found 
> linux-crypto@xxxxxxxxxxxxxxx that appears to be dead...

Actually that list is alive and well.

> I'm working on a linux driver for some hardware MPEG decompression 
> boards (see dxr3.sourceforge.net). Those cards have an on-board i2c 
> serial EEPROM, and I'd like to compute a hash of the EEPROM's content, 
> to mach different card models.
> 
> Since it's i2c-based, it can't be memory-mapped, so I think I have to 
> first read it into a buffer in kernel memory. But the I have some 
> trouble to compute the hash.
> 
> It seemed to work correctly, while I used the crypto_digest functions + 
> a direct call to the dis_update function of the underlying algorith, 
> although it was somewhat hackish...
> 
> It still seems to work allocating a crypto_hash transform and then using 
> the underlying digest algorith functions, but looks even more hackish.
> 
> 
> SO my question is: is there a non-hackish way to compute the hash of a 
> kernel buffer? (I thought I'd use md5 but a different one would be as 
> fine.)

As long as your kernel buffer is malloced, you can turn it into an
sg list with sg_set_buf.

Once the async interface is in place, it might make sense to convert
all remaining sync users to use an address-based interface instead
of scatter lists.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux