From: Corentin LABBE Subject: Re: Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator Date: Sat, 16 May 2015 20:09:27 +0200 Message-ID: <555787D7.80708@gmail.com> 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> Reply-To: clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, pawel.moll-5wv7dgnIgG8@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org, galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org, linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org, davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org, joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org, tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org, boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To: herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org Return-path: In-Reply-To: <20150515065222.GA16808-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , List-Id: linux-crypto.vger.kernel.org Le 15/05/2015 08:52, Herbert Xu a =C3=A9crit : > 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 =3D 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 =3D ahash_request_ctx(areq); >> + >> + memcpy(op, in, sizeof(struct sun4i_req_ctx)); >=20 > 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. >=20 > Cheers, >=20 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 o= r do you will accept a patch for adding them. Regards --=20 You received this message because you are subscribed to the Google Groups "= linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout.