From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 82D0E7EF0D for ; Mon, 22 Feb 2016 22:26:07 +0100 (CET) IronPort-PHdr: 9a23:iJ5MvR9of5HHqf9uRHKM819IXTAuvvDOBiVQ1KB92+ocTK2v8tzYMVDF4r011RmSDdqdtq4P0raH+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStGU0pj8jrzjs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYk7sb+sVBSaT3ebgjBfwdVWx+cjN92Mq+nhnKS0Op6XxUBm4WmxwOBQfCtkuiBb/+tyL7sqx23yzMbuPsSrVhdjm44+9QVBjskCIOMThxpGDRhMtYg69BrFe6uxt724vdZofTOPcoLfCVRs8TWWcUBpUZbCdGGI7pKtJXV+c= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BPAABrfMtWkYN+49RehAxtulQBDYFmFwaFcAKBRDgUAQEBAQEBAQEQAQEBAQcLCwkfMYItghQBAQEDASMyJBALGCoCAiE2BhMJh30DCgwBCasIig8NhEoBAQEBAQUBAQEBFAiFGoUygjqCBoI9OBOBJwWHVo8xgSACikmBc4kdBIVShwWHRB4BAYJEEgiBSWkBiDgBAQE X-IPAS-Result: A0BPAABrfMtWkYN+49RehAxtulQBDYFmFwaFcAKBRDgUAQEBAQEBAQEQAQEBAQcLCwkfMYItghQBAQEDASMyJBALGCoCAiE2BhMJh30DCgwBCasIig8NhEoBAQEBAQUBAQEBFAiFGoUygjqCBoI9OBOBJwWHVo8xgSACikmBc4kdBIVShwWHRB4BAYJEEgiBSWkBiDgBAQE X-IronPort-AV: E=Sophos;i="5.22,486,1449529200"; d="asc'?scan'208";a="165623491" Received: from mout.kundenserver.de ([212.227.126.131]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2016 22:26:06 +0100 Received: from office1.lan.sumadev.de ([188.110.5.208]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0LqpKo-1a2jyp1paM-00eI5c; Mon, 22 Feb 2016 22:26:05 +0100 Received: from [192.168.65.10] (unknown [192.168.65.10]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id A7F06DC05D; Mon, 22 Feb 2016 22:26:04 +0100 (CET) Message-ID: <1456176359.12030.22.camel@e130.lan.sumadev.de> From: Gerd Stolpmann To: Chan Ngo Cc: Milan =?UTF-8?Q?Stanojevi=C4=87?= , Anton Bachin , Caml List Date: Mon, 22 Feb 2016 22:25:59 +0100 In-Reply-To: References: <20160222094853.GH1544@nunchakus.loria.fr> <46EAD496-8667-47FE-B39A-74DA94BC0C25@gmail.com> <4BDBBF0B-1783-4F91-9EFA-D3E9FF9EF1EF@gmail.com> <3DA136DD-0A26-4247-852E-DA596EBFE031@gmail.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-JNxg6atOx48p85xKFhgm" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V03:K0:cJKW1npERi1fVKKVcX9eKf1t9PTM39rxhE1iBhvctuTmzZ9nfae NZEtE1bLY+U7gT9TPahyHk3Gb5sCF3komlw3HBS1gYyGtk+dPedU4iuC28FeKZOuuNn2Ghc SYJ1wn2RvggfRY+hjVJxcvGatF0uAwrGM/0ZB5pyFfnsio15gwpsXXztszgPsMgtl63bgAh LLB/TEkqBhrs0FNFi/b8Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:Wxe/xMy4yR8=:xd8xfpWz08tp068FGMpeKm r5cy/5tp4UxgZ7BTkch+fNB5zPxt4rCxYPsRog0DaJa9zNnJLsSHKalcjA9Wzb/EjdjbMfH7+ X+41blUeoV6xKqIx6DuDtRQxZ62Ys6fIGJOB5PwzHuOZtQ8QhoiPcXLqnjnV6xrSml9R4vC7G P9RhVvoBqGflUJb4TdIHnTObRa7b6pROOS8fIFxyDze17Y6o7/kgF2Fz+g/jiWIDpQo10+lag 46Ev4OlJy8DSa7rmU72w/f4f46/7LV+lQnv3jUI/Vhw8x4ZWb6KKhUjJjLYmxt2YQpJ4ossE9 leKVLzw7FQj7PkuM5zJp6RznxvmertWqagX8fgV0juIlYmB3ES3EOYYZJgsHiKxb/qt7L9hZC GziNHi9Yy6K39NfLCsde3RPkbU9icooEUpKGdRSXvNKXbKbOWJWOonQ1opd9FAQwXpYNTaao7 781vpCJBLbAQmenmdbM7PdbbAJxbtanoitSmxFmrOyd3jMeVy3T8gIXGllvJybHfVphhrf/yS VcwFnI33J3vgfGKm0ZdlcU6VDZzfH2ojwsvBT0IcxhTPMKIrHLk+BMEKR0Z2W/0Gnbb4ljh71 mFy6rSboo0Hx3K8cNMthLP6uahKsFgNdcwCqvBHpcrDg529l3jIy4JcHGEMHQTI0JUG/yYbvs d5bjkQXNoekgJujCQ5SS+F1nzuNspKB8U9mPjzGYl4ly65835YgaDjtZy46KzepRpjiA= Subject: Re: [Caml-list] Constant-time function --=-JNxg6atOx48p85xKFhgm Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am Montag, den 22.02.2016, 15:16 -0500 schrieb Chan Ngo: > Hi Milan, >=20 >=20 > thanks, I see what you mentioned with the =E2=80=9C&&=E2=80=9D 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. You can define an operator that behaves like this: let ( &&& ) p q =3D p && q There might be other functions whose run time varies with the input. E.g. (string) equality comes to my mind. Gerd >=20 > Best, > Chan >=20 > > On Feb 22, 2016, at 3:12 PM, Milan Stanojevi=C4=87 > > wrote: > >=20 > > 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) > >=20 > >=20 > >=20 >=20 >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-JNxg6atOx48p85xKFhgm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJWy3znAAoJEAaM4b9ZLB5TBP0H/0jXHRpZE1Siz2s1tAt6XpUI 5PST3iU8bdQtezDzicxv5NFsYjQBR7R5C50fUasVVGJGg4J1zidcb1+AaZ8+INQ0 hzmXRDEOwjzNsLTJ2IfdaW3KlxvoqE67Fp88UJyc8svcnNby9vmEzCdCB+6J9yxc MG4tWN2k4MgxMdHY6oqaVme2PD015CKH53A+A2l+akdVIESm2hXXJhhogrZqBcaj 8MN7eXPPJP2U3ncdmrDwn6qiQtwOa2ZmY+7xCb3IwVNCVgkuBsWgk/gmJXeqal1c nEoLKZtDDvi1KTdZlempUgpuszRPlGYr0leN3pdx+4PpUN1SirV04L6bSXWA0w8= =ITux -----END PGP SIGNATURE----- --=-JNxg6atOx48p85xKFhgm--