diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2016-07-12 01:17:42 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-07-18 05:35:42 -0400 |
| commit | ca0494c093371b1ca3cd4c8e14e1e7a19e6e21b6 (patch) | |
| tree | 7c1003354c83a4937c53ad3f45b840e005a5004a /crypto | |
| parent | 1e1f006112b50640d7fc11851346f906d223df09 (diff) | |
crypto: aead - Add skcipher null for IV generators
This patch adds an skcipher null object alongside the existing
null blkcipher so that IV generators using it can switch over
to skcipher.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/aead.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/aead.c b/crypto/aead.c index b155cbc3a0dd..a5d9a83f90e4 100644 --- a/crypto/aead.c +++ b/crypto/aead.c | |||
| @@ -294,10 +294,15 @@ int aead_init_geniv(struct crypto_aead *aead) | |||
| 294 | if (err) | 294 | if (err) |
| 295 | goto out; | 295 | goto out; |
| 296 | 296 | ||
| 297 | ctx->sknull = crypto_get_default_null_skcipher2(); | ||
| 298 | err = PTR_ERR(ctx->sknull); | ||
| 299 | if (IS_ERR(ctx->sknull)) | ||
| 300 | goto out; | ||
| 301 | |||
| 297 | ctx->null = crypto_get_default_null_skcipher(); | 302 | ctx->null = crypto_get_default_null_skcipher(); |
| 298 | err = PTR_ERR(ctx->null); | 303 | err = PTR_ERR(ctx->null); |
| 299 | if (IS_ERR(ctx->null)) | 304 | if (IS_ERR(ctx->null)) |
| 300 | goto out; | 305 | goto drop_sknull; |
| 301 | 306 | ||
| 302 | child = crypto_spawn_aead(aead_instance_ctx(inst)); | 307 | child = crypto_spawn_aead(aead_instance_ctx(inst)); |
| 303 | err = PTR_ERR(child); | 308 | err = PTR_ERR(child); |
| @@ -315,6 +320,8 @@ out: | |||
| 315 | 320 | ||
| 316 | drop_null: | 321 | drop_null: |
| 317 | crypto_put_default_null_skcipher(); | 322 | crypto_put_default_null_skcipher(); |
| 323 | drop_sknull: | ||
| 324 | crypto_put_default_null_skcipher2(); | ||
| 318 | goto out; | 325 | goto out; |
| 319 | } | 326 | } |
| 320 | EXPORT_SYMBOL_GPL(aead_init_geniv); | 327 | EXPORT_SYMBOL_GPL(aead_init_geniv); |
| @@ -325,6 +332,7 @@ void aead_exit_geniv(struct crypto_aead *tfm) | |||
| 325 | 332 | ||
| 326 | crypto_free_aead(ctx->child); | 333 | crypto_free_aead(ctx->child); |
| 327 | crypto_put_default_null_skcipher(); | 334 | crypto_put_default_null_skcipher(); |
| 335 | crypto_put_default_null_skcipher2(); | ||
| 328 | } | 336 | } |
| 329 | EXPORT_SYMBOL_GPL(aead_exit_geniv); | 337 | EXPORT_SYMBOL_GPL(aead_exit_geniv); |
| 330 | 338 | ||
