From: Duboucher Thomas <thomas@duboucher.eu>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Imminent bugfix release (1.97.1)
Date: Mon, 09 Nov 2009 18:46:16 +0100 [thread overview]
Message-ID: <4AF85568.7080105@duboucher.eu> (raw)
In-Reply-To: <4AF82868.6090803@gmail.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vladimir 'phcoder' Serbinenko a écrit :
> Bean wrote:
>> On Mon, Nov 9, 2009 at 9:50 PM, Vladimir 'phcoder' Serbinenko
>> <phcoder@gmail.com> wrote:
>>
>> Hi,
>>
>> int
>> grub_auth_strcmp (const char *s1, const char *s2)
>> {
>> int ret;
>> grub_uint64_t end;
>>
>> end = grub_get_time_ms () + 100;
>> ret = grub_strcmp (s1, s2);
>>
>> /* This prevents an attacker from deriving information about the
>> password from the time it took to execute this function. */
>> while (grub_get_time_ms () < end);
>>
>> return ret;
>> }
>>
>> Isn't this 100 ms ? Anyway, the longest supported string is 1024 long,
>> I doubt there is any perceivable difference between them.
>>
>>
> If attacker is on fast serial connection he could possibly measure the
> difference
>
Hi,
I'm not very confident in this piece of code. I would rather go with
something like
int
grub_auth_strcmp (const char *s1, const char *s2)
{
int n;
volatile int ret = 0;
for (n = grub_strlen (s1); n >= 0; n--)
{
if (*s1 != *s2)
ret |= 1;
else
ret |= 0;
s1++; s2++;
}
return ret;
}
Ok, I typed this in a few minutes and I'm not confident either with
what I wrote; I would check that it works first. ;)
But the point here is that whatever the user gives as an input, it is
executed exactly n-th times, n being the length of the user input; and
that whatever the result of the 'if' statement is, the CPU realizes the
same amount of operations. By doing so, the attacker will only find out
how long it takes to make the comparison with a n caracters long input.
Thomas.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkr4VWgACgkQBV7eXqefhqhcIQCgpviYSvNqGqH3fi2Td4QChsam
JWQAni9R7zOWFMGBu5X9rXWOjenIXx31
=vnph
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2009-11-09 17:47 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 1:04 Imminent bugfix release (1.97.1) Robert Millan
2009-11-09 1:27 ` Robert Millan
2009-11-09 2:08 ` Jordan Uggla
2009-11-09 14:15 ` Robert Millan
2009-11-09 13:33 ` Bean
2009-11-09 13:50 ` Vladimir 'phcoder' Serbinenko
2009-11-09 14:18 ` Robert Millan
2009-11-09 14:21 ` Bean
2009-11-09 14:34 ` Vladimir 'phcoder' Serbinenko
2009-11-09 17:46 ` Duboucher Thomas [this message]
2009-11-09 18:10 ` Robert Millan
2009-11-09 18:15 ` Vladimir 'phcoder' Serbinenko
2009-11-09 18:25 ` Robert Millan
2009-11-09 18:36 ` Bean
2009-11-09 18:46 ` Vladimir 'phcoder' Serbinenko
2009-11-09 18:49 ` Bean
2009-11-09 21:13 ` Duboucher Thomas
2009-11-09 21:34 ` Vladimir 'phcoder' Serbinenko
2009-11-09 21:43 ` Duboucher Thomas
2009-11-09 22:06 ` Robert Millan
2009-11-09 22:46 ` Duboucher Thomas
2009-11-09 23:09 ` Darron Black
2009-11-09 23:50 ` richardvoigt
2009-11-09 23:56 ` Darron Black
2009-11-09 23:46 ` richardvoigt
2009-11-10 5:39 ` Bean
2009-11-10 8:28 ` Bean
2009-11-10 8:46 ` Bean
2009-11-10 8:52 ` Bean
2009-11-10 9:05 ` Bean
2009-11-10 12:37 ` Bean
2009-11-10 14:25 ` Duboucher Thomas
2009-11-10 14:47 ` Bean
2009-11-10 17:43 ` Duboucher Thomas
2009-11-10 19:01 ` Vladimir 'phcoder' Serbinenko
2009-11-10 19:04 ` Vladimir 'phcoder' Serbinenko
2009-11-10 21:29 ` Duboucher Thomas
2009-11-10 15:27 ` richardvoigt
2009-11-10 17:38 ` Duboucher Thomas
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=4AF85568.7080105@duboucher.eu \
--to=thomas@duboucher.eu \
--cc=grub-devel@gnu.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.