On Mon, Sep 21, 2015 at 08:58:23PM +0200, Stephan Mueller wrote: > > +/* > + * Fast forward the SGL to the "end" length minus SEMIBSIZE. > + * The start in the SGL defined by the fast-forward is returned with > + * the walk variable > + */ > +static void crypto_kw_scatterlist_ff(struct scatter_walk *walk, > + struct scatterlist *sg, > + unsigned int end) > +{ > + unsigned int skip = 0; > + > + /* The caller should only operate on full SEMIBLOCKs. */ > + BUG_ON(end < SEMIBSIZE); > + > + skip = end - SEMIBSIZE; > + while (sg) { > + if (sg->length > skip) { > + scatterwalk_start(walk, sg); > + scatterwalk_advance(walk, skip); > + break; > + } else > + skip -= sg->length; > + > + sg = sg_next(sg); > + } > +} This looks very slow but it's conceptually nice and I like it :) I'll apply this today. Thanks, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html