From: Shirish Pargaonkar Subject: Re: crypto apis in cifs module allocating storage for character array during run-time vs. dynamic allocation Date: Tue, 24 Aug 2010 10:03:55 -0500 Message-ID: References: <363759039.1172081282603157268.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-crypto@vger.kernel.org, linux-cifs@vger.kernel.org To: Miloslav Trmac Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:46454 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754926Ab0HXPD4 convert rfc822-to-8bit (ORCPT ); Tue, 24 Aug 2010 11:03:56 -0400 In-Reply-To: <363759039.1172081282603157268.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: On Mon, Aug 23, 2010 at 5:39 PM, Miloslav Trmac wrote= : > ----- "Shirish Pargaonkar" wrote: >> Instead of determining and allocating a char array for use during us= age of >> crypto_shash_* calls, would like to instead dynamically >> allocate (and free) storage for the duration of crypto calculation >> (crypto_shash_init, >> crypto_shash_update, and crypto_shash_final) >> But everytime I try, it results in some sort of oops in the cifs mod= ule. > Let me just suggest something, without trying it... > >> +struct sdesc { >> + =A0 =A0 =A0 struct shash_desc shash; >> + =A0 =A0 =A0 char *ctx; > =A0 =A0 =A0 =A0char ctx[]; > would be correct here. >> +}; > And you need to allocate both shash_desc and "ctx" together as a sing= le piece of memory - exactly mirror the memory layout of the original "= sdesc" variable. > =A0 =A0Mirek > Mirek, Thanks, that worked.