Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Chan Ngo <chan.ngo2203@gmail.com>
To: "Milan Stanojević" <milanst@gmail.com>
Cc: Anton Bachin <antronbachin@gmail.com>, Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Constant-time function
Date: Mon, 22 Feb 2016 15:16:32 -0500	[thread overview]
Message-ID: <E778B379-DE81-4812-936B-668E40BC50EF@gmail.com> (raw)
In-Reply-To: <CAKR7PS9j5eVXP18m4nAOqLoLi=0+9tLK92UXcEqjoF+BWYppuQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

Hi Milan,

thanks, I see what you mentioned with the “&&” operator. In fact, one case the behavior as I wanted is in crypto primitive (we need constant-time function to avoid time side-channel attack, for example, give any input for comparing with the secret hash value with fixed size, the time execution of comparing is constant.

Best,
Chan

> On Feb 22, 2016, at 3:12 PM, Milan Stanojević <milanst@gmail.com> wrote:
> 
> Compiler short circuits && operator so your loop runs only til the first element that differs. If you swap the arguments to && you should get the behavior of visiting all elements (which is of course undesirable in practice)
> 
> 


[-- Attachment #2: Type: text/html, Size: 1594 bytes --]

  reply	other threads:[~2016-02-22 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  9:48 [Caml-list] [ANN] bigstring 0.1 Simon Cruanes
2016-02-22 19:45 ` [Caml-list] Constant-time function Chan Ngo
2016-02-22 19:51   ` Anton Bachin
2016-02-22 19:54     ` Anton Bachin
2016-02-22 19:57     ` Chan Ngo
2016-02-22 20:02       ` Anton Bachin
2016-02-22 20:12         ` Milan Stanojević
2016-02-22 20:16           ` Chan Ngo [this message]
2016-02-22 20:28             ` Milan Stanojević
2016-02-22 21:25             ` Gerd Stolpmann

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=E778B379-DE81-4812-936B-668E40BC50EF@gmail.com \
    --to=chan.ngo2203@gmail.com \
    --cc=antronbachin@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=milanst@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox