Skip to contentSkip to conversation

Where has CRYPTO_TFM_MODE_nnn gone?

DISCUSSION Marc St-Jean 2 participants 3 messages Jun 8, 2007 Crypto API

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm porting a security engine driver from 2.6.18 to 2.6.21/22. I've found that although 'cit_mode' is still in struct cipher_tfm, the definitions for CRYPTO_TFM_MODE_ECB and CRYPTO_TFM_MODE_CBC are gone!

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 AES, DES and 3DES?

Advance thanks,
Marc

maintainer
#1 lore raw
Quoted 4 lines · Marc St-Jean

I'm porting a security engine driver from 2.6.18 to 2.6.21/22. I've found that although 'cit_mode' is still in struct cipher_tfm, the definitions for CRYPTO_TFM_MODE_ECB and CRYPTO_TFM_MODE_CBC are gone!

Thanks for noticing it, I'll make sure that cit_mode disappears :)

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

Check out drivers/crypto/padlock* for a good example.

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
maintainer
#2 lore raw
Quoted 7 lines · Herbert Xu
Quoted 4 lines · Marc St-Jean

I'm porting a security engine driver from 2.6.18 to 2.6.21/22. I've found that although 'cit_mode' is still in struct cipher_tfm, the definitions for CRYPTO_TFM_MODE_ECB and CRYPTO_TFM_MODE_CBC are gone!

Thanks for noticing it, I'll make sure that cit_mode disappears :)

Here is the patch.

[CRYPTO] cipher: Remove obsolete fields from cipher_tfm

This removes all the unused block cipher fields from cipher_tfm.

Cheers,

Signature · 5 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
--
include/linux/crypto.h +0 -20
index 0de7e2a..357e8cf 100644
@@ -295,28 +295,8 @@ struct blkcipher_tfm {
 };
 
 struct cipher_tfm {
-	void *cit_iv;
-	unsigned int cit_ivsize;
-	u32 cit_mode;
 	int (*cit_setkey)(struct crypto_tfm *tfm,
 	                  const u8 *key, unsigned int keylen);
-	int (*cit_encrypt)(struct crypto_tfm *tfm,
-			   struct scatterlist *dst,
-			   struct scatterlist *src,
-			   unsigned int nbytes);
-	int (*cit_encrypt_iv)(struct crypto_tfm *tfm,
-	                      struct scatterlist *dst,
-	                      struct scatterlist *src,
-	                      unsigned int nbytes, u8 *iv);
-	int (*cit_decrypt)(struct crypto_tfm *tfm,
-			   struct scatterlist *dst,
-			   struct scatterlist *src,
-			   unsigned int nbytes);
-	int (*cit_decrypt_iv)(struct crypto_tfm *tfm,
-			   struct scatterlist *dst,
-			   struct scatterlist *src,
-			   unsigned int nbytes, u8 *iv);
-	void (*cit_xor_block)(u8 *dst, const u8 *src);
 	void (*cit_encrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
 	void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
 };