Skip to contentSkip to conversation

Possible bug: blkcipher_walk_done()

DISCUSSION Dmitry Kasatkin 2 participants 3 messages Feb 10, 2010 – Feb 15, 2010 Crypto API

lore
Share & tools
lore
#0 lore raw

Hi,

It seems that there is a mistake in the implementation of

int blkcipher_walk_done(struct blkcipher_desc *desc,
struct blkcipher_walk *walk, int err)

blkcipher_walk_virt() will call crypto_kmap() to map page.

But in the case then err argument is < 0 and we cannot continue then blkcipher_walk_done() will not
unmap the page.

What do you think?

- Dmitry

maintainer
#1 lore raw
Quoted 7 lines · Dmitry Kasatkin

Hi,

It seems that there is a mistake in the implementation of

int blkcipher_walk_done(struct blkcipher_desc *desc,
struct blkcipher_walk *walk, int err)

Quoted 7 lines

blkcipher_walk_virt() will call crypto_kmap() to map page.

But in the case then err argument is < 0 and we cannot continue then blkcipher_walk_done() will not
unmap the page.

What do you think?

Only blkcipher.c itself calls blkcipher_walk_done with err < 0. Algorithms are not supposed to do that as this interface is only for synchronous implementations.

When blkcipher.c uses it with err < 0 the pages are never mapped.

Do you need to be able to fail with a synchronous algorithm?

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw

Hi,

Strange what you say.... if err < 0 the page are never mapped...

Pages mapped before... and they are not unmapped and mapped again... So they left mapped..
And yes... if HW fails then it need to break the function and unmap previously mapped pages.

I will submit patches for review soon to this list.

Thanks for your discussion!

- Dmitry

Quoted 28 lines · ext Herbert Xu
Quoted 7 lines · Dmitry Kasatkin

Hi,

It seems that there is a mistake in the implementation of

int blkcipher_walk_done(struct blkcipher_desc *desc,
struct blkcipher_walk *walk, int err)

Quoted 8 lines

blkcipher_walk_virt() will call crypto_kmap() to map page.

But in the case then err argument is < 0 and we cannot continue then blkcipher_walk_done() will not
unmap the page.

What do you think?

Only blkcipher.c itself calls blkcipher_walk_done with err < 0. Algorithms are not supposed to do that as this interface is only for synchronous implementations.

When blkcipher.c uses it with err < 0 the pages are never mapped.

Do you need to be able to fail with a synchronous algorithm?

Cheers,