lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1518508670.3326.6.camel@hxt-semitech.com>
Date:   Tue, 13 Feb 2018 07:57:50 +0000
From:   "Yang, Shunyong" <shunyong.yang@...-semitech.com>
To:     "linux@...musvillemoes.dk" <linux@...musvillemoes.dk>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "andriy.shevchenko@...ux.intel.com" 
        <andriy.shevchenko@...ux.intel.com>,
        "Zheng, Joey" <yu.zheng@...-semitech.com>,
        "me@...in.cc" <me@...in.cc>
Subject: Re: [PATCH] vsprintf: replace space with readable '=' before crng
 is ready

Hi, Rasmus,

On Tue, 2018-02-13 at 08:16 +0100, Rasmus Villemoes wrote:
> On 13 February 2018 at 07:20, Shunyong Yang
> <shunyong.yang@...-semitech.com> wrote:
> 
> > 
> > 
> > This patch replaces space with readable "=" when output needs
> > padding.
> > Following is the output after applying the patch,
> > 
> > Suggested-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> > 
> >         if (unlikely(!have_filled_random_ptr_key)) {
> > +               char *ptrval_str = "(ptrval)";
> > +               char str[default_width + 1];
> > +               int len = strlen(ptrval_str);
> > +
> > +               if (default_width > len) {
> > +                       int pos;
> > +
> > +                       pos = (default_width - len) / 2;
> > +                       memset(str, '=', default_width);
> > +                       memcpy(str + pos + 1, ptrval_str + 1, len -
> > 2);
> > +                       str[0] = '(';
> > +                       str[default_width - 1] = ')';
> > +                       str[default_width] = 0;
> > +                       ptrval_str = str;
> > +               }
> > +
> I'm sorry, but that's way too convoluted.
> 
> > 
> >                 spec.field_width = default_width;
> >                 /* string length must be less than default_width */
> > -               return string(buf, end, "(ptrval)", spec);
> > +               return string(buf, end, ptrval_str, spec);
> >         }
> I was thinking of just doing something like
> 
> -               return string(buf, end, "(ptrval)", spec);
> +               return string(buf, end, sizeof(void *) == 8 ?
> "(====ptrval====)" : "(ptrval)", spec);
> 

Thanks a lot! It's more straightforward considering 32/64-bit system.

Thanks.
Shunyong.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ