12
12
#include <crypto/internal/aead.h>
13
13
#include <crypto/internal/skcipher.h>
14
14
#include <crypto/internal/hash.h>
15
+ #include <crypto/null.h>
15
16
#include <crypto/scatterwalk.h>
16
17
#include <crypto/hash.h>
17
18
#include "internal.h"
@@ -39,7 +40,6 @@ struct crypto_rfc4106_ctx {
39
40
40
41
struct crypto_rfc4543_instance_ctx {
41
42
struct crypto_aead_spawn aead ;
42
- struct crypto_skcipher_spawn null ;
43
43
};
44
44
45
45
struct crypto_rfc4543_ctx {
@@ -1246,7 +1246,7 @@ static int crypto_rfc4543_init_tfm(struct crypto_tfm *tfm)
1246
1246
if (IS_ERR (aead ))
1247
1247
return PTR_ERR (aead );
1248
1248
1249
- null = crypto_spawn_blkcipher ( & ictx -> null . base );
1249
+ null = crypto_get_default_null_skcipher ( );
1250
1250
err = PTR_ERR (null );
1251
1251
if (IS_ERR (null ))
1252
1252
goto err_free_aead ;
@@ -1273,7 +1273,7 @@ static void crypto_rfc4543_exit_tfm(struct crypto_tfm *tfm)
1273
1273
struct crypto_rfc4543_ctx * ctx = crypto_tfm_ctx (tfm );
1274
1274
1275
1275
crypto_free_aead (ctx -> child );
1276
- crypto_free_blkcipher ( ctx -> null );
1276
+ crypto_put_default_null_skcipher ( );
1277
1277
}
1278
1278
1279
1279
static struct crypto_instance * crypto_rfc4543_alloc (struct rtattr * * tb )
@@ -1311,31 +1311,23 @@ static struct crypto_instance *crypto_rfc4543_alloc(struct rtattr **tb)
1311
1311
1312
1312
alg = crypto_aead_spawn_alg (spawn );
1313
1313
1314
- crypto_set_skcipher_spawn (& ctx -> null , inst );
1315
- err = crypto_grab_skcipher (& ctx -> null , "ecb(cipher_null)" , 0 ,
1316
- CRYPTO_ALG_ASYNC );
1317
- if (err )
1318
- goto out_drop_alg ;
1319
-
1320
- crypto_skcipher_spawn_alg (& ctx -> null );
1321
-
1322
1314
err = - EINVAL ;
1323
1315
1324
1316
/* We only support 16-byte blocks. */
1325
1317
if (alg -> cra_aead .ivsize != 16 )
1326
- goto out_drop_ecbnull ;
1318
+ goto out_drop_alg ;
1327
1319
1328
1320
/* Not a stream cipher? */
1329
1321
if (alg -> cra_blocksize != 1 )
1330
- goto out_drop_ecbnull ;
1322
+ goto out_drop_alg ;
1331
1323
1332
1324
err = - ENAMETOOLONG ;
1333
1325
if (snprintf (inst -> alg .cra_name , CRYPTO_MAX_ALG_NAME ,
1334
1326
"rfc4543(%s)" , alg -> cra_name ) >= CRYPTO_MAX_ALG_NAME ||
1335
1327
snprintf (inst -> alg .cra_driver_name , CRYPTO_MAX_ALG_NAME ,
1336
1328
"rfc4543(%s)" , alg -> cra_driver_name ) >=
1337
1329
CRYPTO_MAX_ALG_NAME )
1338
- goto out_drop_ecbnull ;
1330
+ goto out_drop_alg ;
1339
1331
1340
1332
inst -> alg .cra_flags = CRYPTO_ALG_TYPE_AEAD ;
1341
1333
inst -> alg .cra_flags |= alg -> cra_flags & CRYPTO_ALG_ASYNC ;
@@ -1362,8 +1354,6 @@ static struct crypto_instance *crypto_rfc4543_alloc(struct rtattr **tb)
1362
1354
out :
1363
1355
return inst ;
1364
1356
1365
- out_drop_ecbnull :
1366
- crypto_drop_skcipher (& ctx -> null );
1367
1357
out_drop_alg :
1368
1358
crypto_drop_aead (spawn );
1369
1359
out_free_inst :
@@ -1377,7 +1367,6 @@ static void crypto_rfc4543_free(struct crypto_instance *inst)
1377
1367
struct crypto_rfc4543_instance_ctx * ctx = crypto_instance_ctx (inst );
1378
1368
1379
1369
crypto_drop_aead (& ctx -> aead );
1380
- crypto_drop_skcipher (& ctx -> null );
1381
1370
1382
1371
kfree (inst );
1383
1372
}
0 commit comments