Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754691AbZDONhC (ORCPT ); Wed, 15 Apr 2009 09:37:02 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752227AbZDONgv (ORCPT ); Wed, 15 Apr 2009 09:36:51 -0400 Received: from mx2.redhat.com ([66.187.237.31]:39804 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751318AbZDONgu (ORCPT ); Wed, 15 Apr 2009 09:36:50 -0400 From: Jarod Wilson Organization: Red Hat, Inc. To: Herbert Xu Subject: [PATCH 1/3] crypto: properly handle null input and assoc data aead test vectors Date: Wed, 15 Apr 2009 09:36:10 -0400 User-Agent: KMail/1.11.2 (Linux/2.6.29.1-54.fc11.x86_64; KDE/4.2.2; x86_64; ; ) Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Horman References: <200904091434.59639.jarod@redhat.com> <200904150835.38818.jarod@redhat.com> <200904150935.15947.jarod@redhat.com> In-Reply-To: <200904150935.15947.jarod@redhat.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904150936.10800.jarod@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1350 Lines: 47 Currenty, if either input or associated data are null in an aead test vector, we'll have random contents of the input and assoc arrays. Similar to the iv, play it safe and zero out the contents. Signed-off-by: Jarod Wilson --- crypto/testmgr.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index bfee6e9..a8bdcb3 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -314,8 +314,18 @@ static int test_aead(struct crypto_aead *tfm, int enc, input = xbuf[0]; assoc = axbuf[0]; - memcpy(input, template[i].input, template[i].ilen); - memcpy(assoc, template[i].assoc, template[i].alen); + if (template[i].input) + memcpy(input, template[i].input, + template[i].ilen); + else + memset(input, 0, MAX_IVLEN); + + if (template[i].assoc) + memcpy(assoc, template[i].assoc, + template[i].alen); + else + memset(assoc, 0, MAX_IVLEN); + if (template[i].iv) memcpy(iv, template[i].iv, MAX_IVLEN); else -- 1.6.2.2 -- Jarod Wilson jarod@redhat.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/