aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-08-21 07:40:49 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:46:16 -0400
commit7226bc877a22244e8003924031435a4bffd52654 (patch)
treeb522aec40dcf6c9c3080d6c8d0fce77c432238af /crypto
parent03fd9cee7f46dddcd2562bc175d2c348502ce281 (diff)
[CRYPTO] api: Mark parts of cipher interface as deprecated
Mark the parts of the cipher interface that have been replaced by block ciphers as deprecated. Thanks to Andrew Morton for suggesting doing this before removing them completely. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/cipher.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 326461780673..9e03701cfdcc 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -23,6 +23,28 @@
23#include "internal.h" 23#include "internal.h"
24#include "scatterwalk.h" 24#include "scatterwalk.h"
25 25
26struct cipher_alg_compat {
27 unsigned int cia_min_keysize;
28 unsigned int cia_max_keysize;
29 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key,
30 unsigned int keylen);
31 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
32 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
33
34 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
35 u8 *dst, const u8 *src,
36 unsigned int nbytes);
37 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
38 u8 *dst, const u8 *src,
39 unsigned int nbytes);
40 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
41 u8 *dst, const u8 *src,
42 unsigned int nbytes);
43 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
44 u8 *dst, const u8 *src,
45 unsigned int nbytes);
46};
47
26static inline void xor_64(u8 *a, const u8 *b) 48static inline void xor_64(u8 *a, const u8 *b)
27{ 49{
28 ((u32 *)a)[0] ^= ((u32 *)b)[0]; 50 ((u32 *)a)[0] ^= ((u32 *)b)[0];
@@ -276,7 +298,7 @@ static int ecb_encrypt(struct crypto_tfm *tfm,
276 struct scatterlist *src, unsigned int nbytes) 298 struct scatterlist *src, unsigned int nbytes)
277{ 299{
278 struct cipher_desc desc; 300 struct cipher_desc desc;
279 struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; 301 struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher;
280 302
281 desc.tfm = tfm; 303 desc.tfm = tfm;
282 desc.crfn = cipher->cia_encrypt; 304 desc.crfn = cipher->cia_encrypt;
@@ -291,7 +313,7 @@ static int ecb_decrypt(struct crypto_tfm *tfm,
291 unsigned int nbytes) 313 unsigned int nbytes)
292{ 314{
293 struct cipher_desc desc; 315 struct cipher_desc desc;
294 struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; 316 struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher;
295 317
296 desc.tfm = tfm; 318 desc.tfm = tfm;
297 desc.crfn = cipher->cia_decrypt; 319 desc.crfn = cipher->cia_decrypt;
@@ -306,7 +328,7 @@ static int cbc_encrypt(struct crypto_tfm *tfm,
306 unsigned int nbytes) 328 unsigned int nbytes)
307{ 329{
308 struct cipher_desc desc; 330 struct cipher_desc desc;
309 struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; 331 struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher;
310 332
311 desc.tfm = tfm; 333 desc.tfm = tfm;
312 desc.crfn = cipher->cia_encrypt; 334 desc.crfn = cipher->cia_encrypt;
@@ -322,7 +344,7 @@ static int cbc_encrypt_iv(struct crypto_tfm *tfm,
322 unsigned int nbytes, u8 *iv) 344 unsigned int nbytes, u8 *iv)
323{ 345{
324 struct cipher_desc desc; 346 struct cipher_desc desc;
325 struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; 347 struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher;
326 348
327 desc.tfm = tfm; 349 desc.tfm = tfm;
328 desc.crfn = cipher->cia_encrypt; 350 desc.crfn = cipher->cia_encrypt;
@@ -338,7 +360,7 @@ static int cbc_decrypt(struct crypto_tfm *tfm,
338 unsigned int nbytes) 360 unsigned int nbytes)
339{ 361{
340 struct cipher_desc desc; 362 struct cipher_desc desc;
341 struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; 363 struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher;
342 364
343 desc.tfm = tfm; 365 desc.tfm = tfm;
344 desc.crfn = cipher->cia_decrypt; 366 desc.crfn = cipher->cia_decrypt;
@@ -354,7 +376,7 @@ static int cbc_decrypt_iv(struct crypto_tfm *tfm,
354 unsigned int nbytes, u8 *iv) 376 unsigned int nbytes, u8 *iv)
355{ 377{
356 struct cipher_desc desc; 378 struct cipher_desc desc;
357 struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; 379 struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher;
358 380
359 desc.tfm = tfm; 381 desc.tfm = tfm;
360 desc.crfn = cipher->cia_decrypt; 382 desc.crfn = cipher->cia_decrypt;