Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751528AbbEPSJk (ORCPT ); Sat, 16 May 2015 14:09:40 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37656 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750960AbbEPSJg (ORCPT ); Sat, 16 May 2015 14:09:36 -0400 Message-ID: <555787D7.80708@gmail.com> Date: Sat, 16 May 2015 20:09:27 +0200 From: Corentin LABBE User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: herbert@gondor.apana.org.au CC: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, maxime.ripard@free-electrons.com, linux@arm.linux.org.uk, davem@davemloft.net, akpm@linux-foundation.org, gregkh@linuxfoundation.org, mchehab@osg.samsung.com, joe@perches.com, tj@kernel.org, arnd@arndb.de, boris.brezillon@free-electrons.com, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator References: <1431608341-10936-1-git-send-email-clabbe.montjoie@gmail.com> <1431608341-10936-5-git-send-email-clabbe.montjoie@gmail.com> <20150515065222.GA16808@gondor.apana.org.au> In-Reply-To: <20150515065222.GA16808@gondor.apana.org.au> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1328 Lines: 38 Le 15/05/2015 08:52, Herbert Xu a écrit : > On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: >> >> +int sun4i_hash_export(struct ahash_request *areq, void *out) >> +{ >> + struct sun4i_req_ctx *op = ahash_request_ctx(areq); >> + >> + memcpy(out, op, sizeof(struct sun4i_req_ctx)); >> + return 0; >> +} >> + >> +int sun4i_hash_import(struct ahash_request *areq, const void *in) >> +{ >> + struct sun4i_req_ctx *op = ahash_request_ctx(areq); >> + >> + memcpy(op, in, sizeof(struct sun4i_req_ctx)); > > This is very wrong. You're importing an arbitrary ss pointer. The > whole point of having an import function instead of just a simple > memcpy is to deal with such problems. > > Cheers, > Hello You are right, I have totally mis-understood the export/import functions by just reading them from crypto/md5.c. Reading them from drivers/crypto/* is better. Incidental question, I need to use the MD5 IV for export_md5 function, but they are not defined anywhere (unlike SHAxx ones), does this is voluntary or do you will accept a patch for adding them. Regards -- 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/