Skip to content

Commit

Permalink
crypto: drbg - report backend_cra_name when allocation fails
Browse files Browse the repository at this point in the history
Be more verbose and also report ->backend_cra_name when
crypto_alloc_shash() or crypto_alloc_cipher() fail in
drbg_init_hash_kernel() or drbg_init_sym_kernel()
correspondingly.

Example
 DRBG: could not allocate digest TFM handle: hmac(sha256)

Signed-off-by: Sergey Senozhatsky <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
sergey-senozhatsky authored and herbertx committed Jun 11, 2015
1 parent 42ea507 commit 593dfbd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crypto/drbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,8 @@ static int drbg_init_hash_kernel(struct drbg_state *drbg)

tfm = crypto_alloc_shash(drbg->core->backend_cra_name, 0, 0);
if (IS_ERR(tfm)) {
pr_info("DRBG: could not allocate digest TFM handle\n");
pr_info("DRBG: could not allocate digest TFM handle: %s\n",
drbg->core->backend_cra_name);
return PTR_ERR(tfm);
}
BUG_ON(drbg_blocklen(drbg) != crypto_shash_digestsize(tfm));
Expand Down Expand Up @@ -1686,7 +1687,8 @@ static int drbg_init_sym_kernel(struct drbg_state *drbg)

tfm = crypto_alloc_cipher(drbg->core->backend_cra_name, 0, 0);
if (IS_ERR(tfm)) {
pr_info("DRBG: could not allocate cipher TFM handle\n");
pr_info("DRBG: could not allocate cipher TFM handle: %s\n",
drbg->core->backend_cra_name);
return PTR_ERR(tfm);
}
BUG_ON(drbg_blocklen(drbg) != crypto_cipher_blocksize(tfm));
Expand Down

0 comments on commit 593dfbd

Please sign in to comment.