On Wed, Jul 05, 2006 at 03:21:41PM +1000, herbert wrote: > > Also, we can probably bring down the 16-byte numbers if we change the > digest layer to cater for a direct digest interface that takes one sg > entry, i.e., if it's one sg entry then feed it directly to the algo's > digest function, otherwise go through the usual sg walker.
After thinking a bit more about this, IMHO this is definitely worthwhile. If we do this, then we can basically do hmac(sha1) on IPsec/ESP packets without copying most of the data at all! This works because the bulk of HMAC time is spent on digesting the input with a block-sized prefix based on the key. So if the given input has a block worth of headroom, we can copy the prefix there and just feed the whole thing to the padlock. With IPsec/ESP, it should be easy to make sure that the packet has 64 bytes of headroom in front of the ESP header (Ethernet + IP already gives 34, so we won't be wasting too much). The only catch is that the packet has to be linear. However, we always linearise it through skb_cow_data currently because we assume frags to be read-only. So we might as well take advantage of that and do everything through one digest call. By the time we evolve away from a linear ESP implementation, hopefully VIA would've produced a proper SHA1 CPU by then :) Cheers, -- 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 - To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html