[Cryptography] how reliably do audits spot backdoors?

ianG iang at iang.org
Thu Dec 26 02:37:09 EST 2013


On 25/12/13 04:34 AM, James A. Donald wrote:
> "James A. Donald" <jamesd at echeque.com> wrote:
>>> I find C quite intuitive, possibly as a result of having done a bit
>>> of code review.
>>>
>>> What you would call counterintuitive, I read as idiomatic, and what
>>> is undefined, I read as unidiomatic.
>
> On 2013-12-25 08:12, Benjamin Kreuter wrote:
>> So the fact that it is possible for the sum of two positive integers to
>> be a negative number is idiomatic?
>
> To me that is totally intuitive and natural, and I have written code
> that takes advantage of this effect (sliding window code)  It just
> seemed natural to do it that way.


It's meat & drink to cryptoplumbers.  Sometimes it is known as overflow, 
sometimes as modulo math.  % is your friend, bits are your chisel.

When I was in the business of employing C programmers a long time ago, I 
asked two questions.  The first was "how big is an int" ... which pretty 
much separated the sheep from the wolves.

(Apropos, the second q was to opine on whether to use a macro or a 
function for a simple task like max(a,b) and why.  Again, baa v. howl 
with a high confidence level.)

...
> Do what I did in the example, and de-obfuscate the obfuscated code, by
> manually substituting the macro.  It did not take me very long.

Yeah, you beat me.  I just read it and did it all in my mind, not serious.

>> Now, if it is on the table, then I do not see any reason why it would
>> be desirable to choose C over a more well-defined language.  If a
>> complete rewrite is something we can undertake, then even if *none* of
>> the languages available now fit the bill, why not just create a new
>> one?  Why not just identify that subset of C that is "good" and write a
>> compiler for that language, without any undefined behavior?  Why not
>> create a new language that we can audit more easily if something like
>> OCaml is "too slow" (or whatever reason people are giving for avoiding
>> high-level languages these days)?
>
> Whenever you attempt to do a project in "high level code", the project
> becomes ninety percent complete in much less time than when you do it in
> C++, and then remains ninety percent complete forever.


The choice of language is heavily influenced by personal and business 
factors.  There is no one real theory or way here, which is perhaps why 
there are so many languages.  Emotionally, once a coder has committed to 
a language and written lots of code, that coder is incentivised to 
promote their choice, in no small part in order to self-validate their 
investment, both in kloc and mental energy.

I do it all in Java.  Once, when I did a port from Java to various 
languages, it took 5 times longer to get it into C as opposed to various 
OO languages (PHP, Perl).  I imagine C++ is more that latter case, OO 
speed.  I prefer Java because it is faster, safer, cheaper in the only 
metric that matters to me: coder time.

But I note there are many others who also speak with such emotion, but 
in obsequience to other idols.

> You get the higher level language problem that the libraries are
> slightly different on each machine, which results in nightmare
> installations.  Doubtless you can audit your code faster, but can you
> audit all those installations and libraries?
>
> If you have one high level program using a library, and another high
> level program using that same library, there is, with remarkable
> frequency, a way for the one high level program to screw over the other
> high level program.


If we're talking real security, don't use other people's libraries.  Bad.



iang



More information about the cryptography mailing list