From patchwork Wed Jun 10 13:27:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 6579951 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BEACC0020 for ; Wed, 10 Jun 2015 13:28:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B59EE20576 for ; Wed, 10 Jun 2015 13:28:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4F66204A7 for ; Wed, 10 Jun 2015 13:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933699AbbFJN2q (ORCPT ); Wed, 10 Jun 2015 09:28:46 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36818 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933654AbbFJN2p (ORCPT ); Wed, 10 Jun 2015 09:28:45 -0400 Received: by pabqy3 with SMTP id qy3so34952105pab.3; Wed, 10 Jun 2015 06:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9ga6+oLi7KJXx7aC6oPNLG+HK0vnR2AVPZXmWlc8YNc=; b=05qN3FMpqpGGb6tEak5xCIKP/VSdasX/gS4NGL5GftaxFgEkf/Ce+JX9iI8kjyanA9 CIgRRL6amGUHKu9cYXXR4jjSESX1363RLZHSJkkxiyiD+lF5DGZ8H/l4cMslUkKQtLnn +DwrGBRgr8x9gMkf3GZN6YTegDbKXV8Uy5H2gkwM38BfV/o1Ow+vhxt/ceK5HlZoes7o +DCT8g9dksWlKPJhUw3k0R5eFIErYSFxTHye3yvXT+D687IxtfHWcKu1FdUOOAaIygUL IYjZSnpRPLHgHhcajahayiWtPqQdqpKWNKDtAx+g4YSAfs4dGNz5DuMEzxR9iW0VoFf/ JJrg== X-Received: by 10.69.25.41 with SMTP id in9mr5828576pbd.80.1433942925271; Wed, 10 Jun 2015 06:28:45 -0700 (PDT) Received: from swordfish.localdomain ([112.168.75.135]) by mx.google.com with ESMTPSA id r9sm8725856pdp.5.2015.06.10.06.28.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jun 2015 06:28:44 -0700 (PDT) From: Sergey Senozhatsky To: Herbert Xu Cc: "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, sergey.senozhatsky.work@gmail.com, Sergey Senozhatsky Subject: [PATCH] crypto/drbg: report backend_cra_name when allocation fails Date: Wed, 10 Jun 2015 22:27:48 +0900 Message-Id: <1433942868-16447-2-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.4.3.368.g7974889 In-Reply-To: <1433942868-16447-1-git-send-email-sergey.senozhatsky@gmail.com> References: <1433942868-16447-1-git-send-email-sergey.senozhatsky@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- crypto/drbg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 04836b4..d42f678 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1590,7 +1590,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)); @@ -1641,7 +1642,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));