|
|||||||||||
|
[Design] Making KLIPS 1 asynchronous to support H/W crypto
From: Arthur van Leeuwen <arthurvl(at)xos.nl>
Date: Mon Mar 03 2003 - 09:44:06 EST
The idea of making KLIPS 1 support asynchronous encryption is that of breaking up loops and basic blocks in which encryption can take place and allow re-entry from a callback. This is accomplished by keeping the decrypting function's state not on the stack but on the heap and passing pointers to it around. Fortunately, for ipsec_rcv in linux/net/ipsec/ipsec_rcv.c this is already partially done by encapsulating almost all necessary state in an ipsec_rcv_state struct. All that needs to be done is break the function at the correct place so that a callback can re-enter the decryption from an interrupt handler for a crypto-board and allocate the ipsec_rcv_state struct on the heap. For ipsec_start_xmit the situation is not that easy. It has not been refactored yet. Now, the 1094 lines that are directly involved with encrypting form 1 single loop. In this loop there is code that sets up the encryption steps and a loop that then does the actual encryption.
Accompanied are my patch to FreeS/WAN 2.00-rc1 (afaik it should also patch cleanly to 2.00-rc2, but I haven't tested that), and my version of the cryptolib that applies cleanly to a RedHat 2.4.18-24 kernel. (Took me a bit to figure out: Martin's cryptolib actually also supports synchronous encryption, so I first tried that, but most hardware doesn't, so it didn't actually work :), and KLIPS 1 is *monstrous* to say the very least. I think I can pinpoint at least 1 bug just by reading the code... I still need to verify that though.) Now, what I want to know: am I completely off the rocker on my assessment? Is this approach reasonable? Are there obvious pitfalls? I am concerned about possible information leaks due to for instance releasing the tdb_lock when asynchronously encrypting a transmit request: the ipsec_sa table may get modified in the meantime. Fortunately releasing the lock when encrypting upon receive seems to merely result in a spurious drop, and I don't feel the need to deal with those, higher level protocols as TCP can do that. IP doesn't guarantee reception of data anyway. Comments? _______________________________________________ Design mailing list Design@lists.freeswan.org http://lists.freeswan.org/mailman/listinfo/design
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 12:59:32 EDT |
||||||||||
|
|||||||||||