Skip to content

Commit f1ddcaf

Browse files
committed
[CRYPTO] api: Remove deprecated interface
This patch removes the old cipher interface and related code. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent ba8da2a commit f1ddcaf

File tree

9 files changed

+17
-663
lines changed

9 files changed

+17
-663
lines changed

crypto/algapi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn)
396396
return ERR_PTR(-EAGAIN);
397397
}
398398

399-
tfm = __crypto_alloc_tfm(alg, 0);
399+
tfm = __crypto_alloc_tfm(alg);
400400
if (IS_ERR(tfm))
401401
crypto_mod_put(alg);
402402

crypto/api.c

+7-56
Original file line numberDiff line numberDiff line change
@@ -212,25 +212,6 @@ struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask)
212212
}
213213
EXPORT_SYMBOL_GPL(crypto_alg_mod_lookup);
214214

215-
static int crypto_init_flags(struct crypto_tfm *tfm, u32 flags)
216-
{
217-
tfm->crt_flags = flags & CRYPTO_TFM_REQ_MASK;
218-
flags &= ~CRYPTO_TFM_REQ_MASK;
219-
220-
switch (crypto_tfm_alg_type(tfm)) {
221-
case CRYPTO_ALG_TYPE_CIPHER:
222-
return crypto_init_cipher_flags(tfm, flags);
223-
224-
case CRYPTO_ALG_TYPE_DIGEST:
225-
return crypto_init_digest_flags(tfm, flags);
226-
227-
case CRYPTO_ALG_TYPE_COMPRESS:
228-
return crypto_init_compress_flags(tfm, flags);
229-
}
230-
231-
return 0;
232-
}
233-
234215
static int crypto_init_ops(struct crypto_tfm *tfm)
235216
{
236217
const struct crypto_type *type = tfm->__crt_alg->cra_type;
@@ -285,7 +266,7 @@ static void crypto_exit_ops(struct crypto_tfm *tfm)
285266
}
286267
}
287268

288-
static unsigned int crypto_ctxsize(struct crypto_alg *alg, int flags)
269+
static unsigned int crypto_ctxsize(struct crypto_alg *alg)
289270
{
290271
const struct crypto_type *type = alg->cra_type;
291272
unsigned int len;
@@ -299,15 +280,15 @@ static unsigned int crypto_ctxsize(struct crypto_alg *alg, int flags)
299280
BUG();
300281

301282
case CRYPTO_ALG_TYPE_CIPHER:
302-
len += crypto_cipher_ctxsize(alg, flags);
283+
len += crypto_cipher_ctxsize(alg);
303284
break;
304285

305286
case CRYPTO_ALG_TYPE_DIGEST:
306-
len += crypto_digest_ctxsize(alg, flags);
287+
len += crypto_digest_ctxsize(alg);
307288
break;
308289

309290
case CRYPTO_ALG_TYPE_COMPRESS:
310-
len += crypto_compress_ctxsize(alg, flags);
291+
len += crypto_compress_ctxsize(alg);
311292
break;
312293
}
313294

@@ -322,23 +303,19 @@ void crypto_shoot_alg(struct crypto_alg *alg)
322303
}
323304
EXPORT_SYMBOL_GPL(crypto_shoot_alg);
324305

325-
struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags)
306+
struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg)
326307
{
327308
struct crypto_tfm *tfm = NULL;
328309
unsigned int tfm_size;
329310
int err = -ENOMEM;
330311

331-
tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags);
312+
tfm_size = sizeof(*tfm) + crypto_ctxsize(alg);
332313
tfm = kzalloc(tfm_size, GFP_KERNEL);
333314
if (tfm == NULL)
334315
goto out_err;
335316

336317
tfm->__crt_alg = alg;
337318

338-
err = crypto_init_flags(tfm, flags);
339-
if (err)
340-
goto out_free_tfm;
341-
342319
err = crypto_init_ops(tfm);
343320
if (err)
344321
goto out_free_tfm;
@@ -362,31 +339,6 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags)
362339
}
363340
EXPORT_SYMBOL_GPL(__crypto_alloc_tfm);
364341

365-
struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
366-
{
367-
struct crypto_tfm *tfm = NULL;
368-
int err;
369-
370-
do {
371-
struct crypto_alg *alg;
372-
373-
alg = crypto_alg_mod_lookup(name, 0, CRYPTO_ALG_ASYNC);
374-
err = PTR_ERR(alg);
375-
if (IS_ERR(alg))
376-
continue;
377-
378-
tfm = __crypto_alloc_tfm(alg, flags);
379-
err = 0;
380-
if (IS_ERR(tfm)) {
381-
crypto_mod_put(alg);
382-
err = PTR_ERR(tfm);
383-
tfm = NULL;
384-
}
385-
} while (err == -EAGAIN && !signal_pending(current));
386-
387-
return tfm;
388-
}
389-
390342
/*
391343
* crypto_alloc_base - Locate algorithm and allocate transform
392344
* @alg_name: Name of algorithm
@@ -420,7 +372,7 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
420372
goto err;
421373
}
422374

423-
tfm = __crypto_alloc_tfm(alg, 0);
375+
tfm = __crypto_alloc_tfm(alg);
424376
if (!IS_ERR(tfm))
425377
return tfm;
426378

@@ -466,7 +418,6 @@ void crypto_free_tfm(struct crypto_tfm *tfm)
466418
kfree(tfm);
467419
}
468420

469-
EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
470421
EXPORT_SYMBOL_GPL(crypto_free_tfm);
471422

472423
int crypto_has_alg(const char *name, u32 type, u32 mask)

0 commit comments

Comments
 (0)