Re: [PATCH 0/6] crypto/realtek: add new driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Dienstag, dem 06.12.2022 um 12:10 +0800 schrieb Herbert Xu:
> On Mon, Dec 05, 2022 at 07:47:59PM +0100, Markus Stockhausen wrote:
> > 
> > as I got neither positive nor negative feedback after your last
> > question I just want to ask if there is any work for me to do on
> > this
> > series?
> 
> Sorry about that.
> 
> There is still an issue with your import function.  You dereference
> the imported state directly.  That is not allowed because there is
> no guarantee that the imported state is aligned for a direct CPU
> load.
> 
> So you'll either need to copy it somewhere first or use an unaligned
> load to access hexp->state.
> 
> Cheers,

No problem,

this is something I can work with. Nevertheless I'm unsure about your
guidance. If I get it right, the state assignment is not ok.

	...
	const struct rtcr_ahash_req *hexp = in;

	hreq->state = hexp->state; << *** maybe unaligned? ***
	if (hreq->state & RTCR_REQ_FB_ACT)
		hreq->state |= RTCR_REQ_FB_RDY;

	if (rtcr_check_fallback(areq))
		return crypto_ahash_import(freq, fexp);

	memcpy(hreq, hexp, sizeof(struct rtcr_ahash_req));
	...

Comparing this to safeexcel_ahash_import() where I got my ideas from
one sees a similar coding:

	...
	const struct safexcel_ahash_export_state *export = in;
	int ret;

	ret = crypto_ahash_init(areq);
	if (ret)
		return ret;

	req->len = export->len; << *** same here ***
	req->processed = export->processed;

	req->digest = export->digest;

	memcpy(req->cache, export->cache, HASH_CACHE_SIZE);
	memcpy(req->state, export->state, req->state_sz);
	...

Thanks in advance for your help.





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux