Where has CRYPTO_TFM_MODE_nnn gone?
Quoted 8 lines · Herbert Xu
Quoted 2 lines · Marc St-Jean
I'm porting a security engine driver from 2.6.18 to 2.6.21/22. I've
found
Quoted 2 lines
that although '
cit_mode' is still in structcipher_tfm, the definitions forCRYPTO_TFM_MODE_ECBandCRYPTO_TFM_MODE_CBCare gone!Thanks for noticing it, I'll make sure that
cit_modedisappears :)
No problem :) Looking at your patch I see that you've also dropped cit_encrypt_iv/cit_decrypt_iv. That is likely related to my next question regarding crypto_tfm_alg_ivsize().
In CBC mode we had a line of code copying cipher_desc.info to get the initialization vector. Such as:
/* Copy in IV */ memcpy((u8*)(sa->crypt_iv), desc->info, crypto_tfm_alg_ivsize(tfm));
Now the only reference to the function I can find is in an IPsec comment from include/net/esp.h. Any tips on getting the size?
Quoted 9 lines
Quoted 2 lines
Our HW needs to know what mode to set up some SA flags. Any advice on how to best find this mode from a common cipher function which can
handle
Quoted 1 line
AES, DES and 3DES?
The block algorithm is now part of the name just like the cipher algorithm itself. So if you're providing a block cipher you should register it as "cbc(aes)" (for example) instead of "aes" as you would've done previously.
And if we can support both I assume we must register multiple times?
Quoted 1 line
Check out
drivers/crypto/padlock*for a good example.
Thanks, I have been looking at that code but unfortunately it supports fewer cryptos/hashes so does not answer all my questions.
Marc
Herbert Xu
maintainerQuoted 9 lines · Marc St-Jean
In CBC mode we had a line of code copying cipher_desc.info to get the initialization vector. Such as:
/* Copy in IV */ memcpy((u8*)(sa->crypt_iv), desc->info, crypto_tfm_alg_ivsize(tfm));Now the only reference to the function I can find is in an IPsec comment from
include/net/esp.h. Any tips on getting the size?
We now have two types of ciphers, simple ciphers and block ciphers. The former only ever ecnrypts one block at a time, and therefore needs no IV. Only block ciphers have IVs.
The other change is that instead of having everything as crypto_tfm they all have their own types now. So ciphers are crypto_cipher while block ciphers are crypto_blkcipher.
In your case your tfm should be of type crypto_blkcipher. Then you simply call crypto_blkcipher_ivsize(tfm) to get the size.
Quoted 2 lines
Thanks, I have been looking at that code but unfortunately it supports fewer cryptos/hashes so does not answer all my questions.
The same concept still applies regardless of the actual number of modes.
Oh and yes you do register it multiple times, once for each combination of the blocking mode and the cipher.
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