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

Re: [Minios-devel] [UNIKRAFT PATCH v3 0/4] lib/ukswrand: Add ChaCha20


  • To: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Tue, 12 Nov 2019 14:52:16 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Iem1RYNFpFRfmBIpspUP4/wb26uziSxwsRjZohkBV8c=; b=HTDMd9jmZqULoPE7lOgmOHReHLeX2lwcwaGZZjnlfAl9IIWNeixY+FDkRwk0CpZpIhYWGMlvQcii/AaPLBtJ44e8lxrD9VUKAEDhe6gV3UXaeet7JvEfTKOzLLLRQSKWbGhhJHEIL0lmqGme0CpN6jaTyvBuMDkpY2ozGYE53i0ckpK9XVrC5LJhUd1MSfntd+HahAvdUCrkHZYy+q3gk5EeUS704CagoSKvBaboM17HK2AyovyzTgWokp7hx87x9aaq9v7qLwykr3avV9R+bZ1suUfbhDqN7poSnYvZ/Hl6s2+jYaNC8rPa7b5+lGch17HgSR7wKKQ8mEnJEIPYgw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwVXCCyENUdcq5BFEjCz1W+Wkc87yICaySLLPyPNVxfXL0D0ZLPNcV7eFpRt8DtPRF7hBcpEVxsKSyONmQa+fHXOvQfduNGEFapDt9ohrA9Bt9GNJNAqz7oS5EiJAf2w0BboXowSYR4NK1Gyou7rNLANGnI1pwMpgs4j8x57yRr0puZuwye0g5N31cybixOER30ZPtFddaf6X88n2L/8pSb/YIoN/iEFypp/PaBZEBvTwypC31eHIV1FyDMjBZRAkQZRta8CE6wRCi1TMWrVFEbMOnGRzVCFhnli5qc8zPAbDhYTQdUwtnWPNQhg57MbuDzsUjMN1Oku/VqG52y2Iw==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "felipe.huici@xxxxxxxxx" <felipe.huici@xxxxxxxxx>
  • Delivery-date: Tue, 12 Nov 2019 14:52:27 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHViAOjngO9FkFw7E6YJOMvFVqVC6eGAiqAgAG/WoA=
  • Thread-topic: [UNIKRAFT PATCH v3 0/4] lib/ukswrand: Add ChaCha20

Hey Simon,

On 11.11.2019 14:11, Simon Kuenzer wrote:
> Hi Vlad,
>
> thanks a lot for your work. I was trying out your patches and it looks 
> good so far.
>
> Design-wise I would like to change the way how the seed is handled. I 
> think we have two options (although I prefer the second idea):
>
> 1) Remove  the seed argument from the init function API 
> (`uk_swrandr_init_r`). The random number generators would call the 
> function as often as seeds are needed by themselves.
>
> 2) Extend the seed argument at the init function API 
> (`uk_swrandr_init_r`) with a custom sized vector:
>
> void uk_swrand_init_r(struct uk_swrand *r, unsigned int seedc, const 
> __u32 seedv[]);
>
> ...or even abstract it with a random byte buffer:
>
> void uk_swrand_init_r(struct uk_swrand *r, __sz seedlen, const void 
> *seed);
>
> A helper function in `chacha.c` would make it easy to access as many 
> bytes as needed (as example to the vector):
>
> static inline __u32 _infvec_val(unsigned int c, __u32 v[], unsinged 
> int pos)
> {
>     if (c == 0)
>         return 0x0;
>     return vec[pos % c];
> }
>
> This would keep us the ability that we can initialize multiple random 
> number generator instances while keeping it flexible which seed source 
> someone wants to use (similar to libc's random functions). In the 
> library constructor we would need to dimension the vector size 
> according to the selected default random number generator. We could do 
> this by using a vector of 2 numbers as default and use a 
> compile-guard'ed version with 10 numbers for ChaCha.
>
> Independent of this, we should also decide if we want to make 
> `_get_random_seed()` public on the API or if we want to keep internal 
> to the library. In the public case, I would rename it to `__u32 
> uk_swrandr_gen_seed32(void)` (and adding it to `exportsyms.uk`). In 
> the other case, try to remove it from the API header and introduce a 
> small internal header (e.g, `/lib/ukswrandr/swrandr.h`) that is 
> included with quotes in your sources: `#include "swrandr.h"`
>
> What do you think?
This seems like a better approach to handling the seed. I'll send a v4 
with the proposed changes.
>
>
> Thanks,
>
> Simon
>
> On 21.10.19 13:35, Vlad-Andrei BĂDOIU (78692) wrote:
>> We add the ChaCha20 algorithm. This patch series refactors the
>> existing code for multiple algorithms support.
>>
>> Changes since v2:
>> * Moved _uk_rotl32 to chacha.c
>> * Moved the constructor and _get_random_seed32 to swrand.c
>> * Added compile check for rdrand
>> * Changed to drop-down menu in config.
>>
>>
>> Vlad-Andrei Badoiu (4):
>>    lib/ukswrand: Adapt the library to work with multiple algorithms
>>    lib/ukswrand: Add seed generating function
>>    lib/ukswrand: Add ChaCha algorithm
>>    lib/ukswrand: Fix uk_swrand_fill_buffer to fill the entire buffer
>>
>>   lib/ukswrand/Config.uk           |  29 +++++-
>>   lib/ukswrand/Makefile.uk         |   2 +
>>   lib/ukswrand/chacha.c            | 151 +++++++++++++++++++++++++++++++
>>   lib/ukswrand/include/uk/swrand.h |  10 +-
>>   lib/ukswrand/mwc.c               |  37 ++------
>>   lib/ukswrand/swrand.c            |  86 ++++++++++++++++++
>>   6 files changed, 273 insertions(+), 42 deletions(-)
>>   create mode 100644 lib/ukswrand/chacha.c
>>   create mode 100644 lib/ukswrand/swrand.c
>>

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.