From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH v4 3/6] cipher: Return result length from asymmetric cipher
Date: Thu, 16 Jun 2016 20:38:11 -0500 [thread overview]
Message-ID: <57635483.20606@gmail.com> (raw)
In-Reply-To: <CAOq732JQCsT0kADU3b7tPW5TAoMiXteKrtVvKbMCm81y3QXB+A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]
Hi Andrew,
On 06/16/2016 08:30 PM, Andrzej Zaborowski wrote:
> Hi,
>
> On 17 June 2016 at 02:17, Mat Martineau
> <mathew.j.martineau@linux.intel.com> wrote:
>> On Thu, 16 Jun 2016, Denis Kenzior wrote:
>>> On 06/15/2016 12:18 PM, Mat Martineau wrote:
>>>> @@ -1790,9 +1813,12 @@ static void tls_handle_rsa_client_key_xchg(struct
>>>> l_tls *tls,
>>>> return;
>>>> }
>>>>
>>>> - result = l_asymmetric_cipher_decrypt(rsa_server_privkey, buf + 2,
>>>> - pre_master_secret,
>>>> - key_size, 48);
>>>> + pre_master_secret = l_malloc(key_size);
>>>> +
>>>> + bytes_decrypted = l_asymmetric_cipher_decrypt(rsa_server_privkey,
>>>> + buf + 2,
>>>> +
>>>> pre_master_secret,
>>>> + key_size,
>>>> key_size);
>>>
>>>
>>> So what's the verdict, I thought we decided to accept short reads?
>>
>>
>> Short reads work with software RSA in the kernel, but we're still sorting
>> out expectations for crypto hardware drivers. For now, long reads are still
>> the way to ensure compatibility.
>
> I guess it depends on what kernel you're aiming for but your test tree
> has only the software pkcs1pad driver. Upstream can in theory add a
> new driver at any time but AF_ALG is still under review there.
>
> By the way I wouldn't call these short reads as we're reading all the
> data that the socket has to read ;) In the commit message I think Mat
> may be referring to the other short reads.
I think this is what Mat means. That the AF_ALG socket is expecting the
buffer to recvmsg to be key_size bytes. E.g. a 'short-read'.
>
> I don't think these kernel api changes should spill into tls.c though.
>
Anyway, the bottom line is for pkcs1pad we should be able to pass a
buffer < key_size for recvmsg. Nothing else makes sense. For sendmsg,
the output buffer should always be key_size.
For rsa primitive operation, the recvmsg buffer 'should' be key_size bytes.
Regards,
-Denis
next prev parent reply other threads:[~2016-06-17 1:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 17:18 [PATCH v4 1/6] cipher: Update for current kernel akcipher interface Mat Martineau
2016-06-15 17:18 ` [PATCH v4 2/6] unit: Update for akcipher changes Mat Martineau
2016-06-16 23:17 ` Denis Kenzior
2016-06-15 17:18 ` [PATCH v4 3/6] cipher: Return result length from asymmetric cipher Mat Martineau
2016-06-16 23:16 ` Denis Kenzior
2016-06-17 0:17 ` Mat Martineau
2016-06-17 1:30 ` Andrzej Zaborowski
2016-06-17 1:38 ` Denis Kenzior [this message]
2016-06-17 16:15 ` Mat Martineau
2016-06-15 17:18 ` [PATCH v4 4/6] unit: Check asymmetric cipher result lengths Mat Martineau
2016-06-15 17:18 ` [PATCH v4 5/6] unit: Check decryption against known ciphertext Mat Martineau
2016-06-15 17:18 ` [PATCH v4 6/6] cipher: Use only one socket for asymmetric cipher Mat Martineau
2016-06-16 23:17 ` [PATCH v4 1/6] cipher: Update for current kernel akcipher interface Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57635483.20606@gmail.com \
--to=denkenz@gmail.com \
--cc=ell@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.