Skip to contentSkip to conversation

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

DISCUSSION Herbert Xu 1 participant 1 message Mar 23, 2007 1 message not in the archive Crypto API

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20070322001359.GA3126@home

Herbert Xu

author maintainer
#1 lore raw
Quoted 4 lines · Nicolas Boullis

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 [email protected] that appears to be dead...

Actually that list is alive and well.

Quoted 13 lines

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...

Quoted 7 lines

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,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt