Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-28 Thread Herbert Xu
On Thu, Feb 28, 2019 at 10:07:42PM +0300, Vitaly Chikunov wrote: > David, > > On Thu, Feb 28, 2019 at 07:02:09PM +, David Howells wrote: > > | > It's not clear that sig->digest is guaranteed to be kmalloc memory. > > > > Well, public_key_signature_free() will go bang if it's not kfree'able. >

Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-28 Thread Vitaly Chikunov
David, On Thu, Feb 28, 2019 at 07:02:09PM +, David Howells wrote: > | > It's not clear that sig->digest is guaranteed to be kmalloc memory. > > Well, public_key_signature_free() will go bang if it's not kfree'able. Well, I had similar argument, FYI: | On Fri, Feb 01, 2019 at 10:09:23AM +030

Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-28 Thread David Howells
| > It's not clear that sig->digest is guaranteed to be kmalloc memory. Well, public_key_signature_free() will go bang if it's not kfree'able. David

Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-28 Thread Vitaly Chikunov
David, On Thu, Feb 28, 2019 at 06:18:54PM +, David Howells wrote: > Vitaly Chikunov wrote: > > > + digest = kmemdup(sig->digest, sig->digest_size, GFP_KERNEL); > > + if (!digest) > > You shouldn't need to copy the digest. It's being passed in to the crypto > algorithm, not extracted ou

Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-28 Thread David Howells
Vitaly Chikunov wrote: > + digest = kmemdup(sig->digest, sig->digest_size, GFP_KERNEL); > + if (!digest) You shouldn't need to copy the digest. It's being passed in to the crypto algorithm, not extracted out. > + if (memcmp(c, outbuf_enc, c_size)) { Please use == 0 and !=

Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-27 Thread Vitaly Chikunov
On Wed, Feb 27, 2019 at 06:28:37PM -0500, Mimi Zohar wrote: > > On Sun, 2019-02-24 at 09:08 +0300, Vitaly Chikunov wrote: > > Previous akcipher .verify() just `decrypts' (using RSA encrypt which is > > using public key) signature to uncover message hash, which was then > > compared in upper level

Re: [PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-27 Thread Mimi Zohar
Hi Vitaly, On Sun, 2019-02-24 at 09:08 +0300, Vitaly Chikunov wrote: > Previous akcipher .verify() just `decrypts' (using RSA encrypt which is > using public key) signature to uncover message hash, which was then > compared in upper level public_key_verify_signature() with the expected > hash valu

[PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-23 Thread Vitaly Chikunov
Previous akcipher .verify() just `decrypts' (using RSA encrypt which is using public key) signature to uncover message hash, which was then compared in upper level public_key_verify_signature() with the expected hash value, which itself was never passed into verify(). This approach was incompatibl