[Openswan Users] Some questions about OCF structures...

farajian amin amin_o_city at yahoo.com
Sat Oct 3 10:59:17 EDT 2009



 Dear David,
 Dear All,

We wrote an OCF based device driver for our crypto-engine which supports AES,3DES,SHA1 and MD5 withHMAC and it is somewhat working. (Many thanks to hifn driver developers)

As we understood , the buffer which is passed to the driver is crp->crp_buf and it's len is crp->crp_ilen . Am i right? 

So , what is the relation between crp_ilen and crd->skip,crd->inject,crd->len, in encryption,decryption and MAC? 

I understand that cryptodev sets these values in encryption path, but in decryption path (receiver) how cryptodev can set  these values( how it knows what is skip,inject?)  and send them to the driver?

The following is the result of pinging ,with some debugging  information,and  I appreciate if you explain the above questions on the following results.

Actually in the encryption path , i think " cmd->enccrd->crd_skip -cmd->enccrd->crd_inject" is the size of IV.(Am i right?)

So, why cmd->maccrd->crd_len is started from 104 , and cmd->maccrd->crd_skip is 20 ( what about the first 20 bytes of buffer? what are they for? Why are these 8 bytes ( cmd->enccrd->crd_inject- cmd->maccrd->crd_skip) ??


---------------------------------------------------------------------------------------------------------
ping 192.168.1.90
PING 192.168.1.90 (192.168.1.90): 56 data bytes
[42949478.610000] cmd->enccrd->crd_len is(Bytes to Process:) 88
[42949478.610000] cmd->enccrd->crd_skip is(Bytes to Ignore from first:) 36
[42949478.610000] cmd->enccrd->crd_inject is(Where to Put the result:) 28
[42949478.610000] cmd->enccrd->crd_flags is 0x1
[42949478.610000] cmd->enccrd->crd_alg is 2
[42949478.610000] cmd->enccrd->crd_klen is 192 bits
[42949478.610000] cmd->enccrd->crd_mlen is 0 bytes 
[42949478.610000] cmd->enccrd->crd_iv[0] is 0x0
[42949478.610000] cmd->enccrd->crd_iv[1] is 0x0
[42949478.610000] cmd->maccrd->crd_len is(Bytes to Process:) 104
[42949478.610000] cmd->maccrd->crd_skip is(Bytes to Ignore from first:) 20
[42949478.610000] cmd->maccrd->crd_inject is(Where to Put the result:) 124
[42949478.610000] cmd->maccrd->crd_flags is 0x0
[42949478.610000] cmd->maccrd->crd_alg is 7
[42949478.610000] cmd->maccrd->crd_klen is 160 bits
[42949478.610000] cmd->maccrd->crd_mlen is 12 bytes 
[42949478.610000] cmd->maccrd->crd_iv[0] is 0x0
[42949478.610000] cmd->maccrd->crd_iv[1] is 0x0
[42949478.610000]  crp->ilen is 136
[42949478.610000]  crp->olen is 0


[42949478.810000] cmd->enccrd->crd_len is(Bytes to Process:) 88
[42949478.810000] cmd->enccrd->crd_skip is(Bytes to Ignore from first:) 16
[42949478.810000] cmd->enccrd->crd_inject is(Where to Put the result:) 8
[42949478.810000] cmd->enccrd->crd_flags is 0x0
[42949478.810000] cmd->enccrd->crd_alg is 2
[42949478.810000] cmd->enccrd->crd_klen is 192 bits
[42949478.810000] cmd->enccrd->crd_mlen is 0 bytes 
[42949478.810000] cmd->enccrd->crd_iv[0] is 0x0
[42949478.810000] cmd->enccrd->crd_iv[1] is 0x0
[42949478.810000] cmd->maccrd->crd_len is(Bytes to Process:) 104
[42949478.810000] cmd->maccrd->crd_skip is(Bytes to Ignore from first:) 0
[42949478.810000] cmd->maccrd->crd_inject is(Where to Put the result:) 104
[42949478.810000] cmd->maccrd->crd_flags is 0x0
[42949478.810000] cmd->maccrd->crd_alg is 7
[42949478.810000] cmd->maccrd->crd_klen is 160 bits
[42949478.810000] cmd->maccrd->crd_mlen is 12 bytes 
[42949478.810000] cmd->maccrd->crd_iv[0] is 0x0
[42949478.810000] cmd->maccrd->crd_iv[1] is 0x0
[42949478.810000]  crp->ilen is 116
[42949478.810000]  crp->olen is 0
[42949478.810000] HI THERE.................
64 bytes from 192.168.1.90: seq=0 ttl=64 time=213.606 ms
----------------------------------------------------------------------------------------------------------------


Thanks in Advance.


Amin Farajian



      


More information about the Users mailing list