[Cryptography] Construction of cryptographic software.

John Denker jsd at av8n.com
Wed Dec 3 16:25:38 EST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/02/2014 02:44 PM, Ray Dillinger wrote:

> [some things] can mostly be trusted to do exactly what they
> say and nothing more.

That's a very useful way to frame the discussion.

Good construction practices are an excellent idea.  They 
reduce the attack surface by orders of magnitude.  OTOH
I would like to argue that they don't reduce it to zero.
They don't reduce it by the factors of 2^80 that we are
accustomed to seeing in good crypto primitives.

The problem is, I've almost(*) never seen a compiler, library, 
operating system, or hardware platform that could /really/ be 
trusted to have no side-effects.  Some are muuuch worse than
others, but even the top of the pile is underwater, AFAICT.

Compiler developers don't even think about side-effects
of the kind we are talking about.  They have a model that 
says the variables that are seen by the program have to
conform to the spec, but everything else belongs to the 
implementation.  The implementation details are "unspecified"
which means the implementation can do whatever it wants.

Ditto for libraries.  C++ classes have private member
variables and methods, for the express purpose of hiding
implementation details.  Hiding is considered a virtue.
The cryptographer's notion of "no side effects" is not 
even on the radar.

The issue of paging has already been mentioned.  You can try
to work around that by locking a crypto-sensitive workspace 
in memory, but that is not the end of the story.  Even if the
compiler is not trying to do any super-clever optimizations,
it still has to to compute stuff one sub-expression at a 
time and store stuff in registers.  If there is an interrupt,
the registers get saved who-knows-where, not in the locked 
workspace, and might very well get paged out or hibernated.
And then you have really lost control of the situation.

  Zeroizing a disk is no longer possible AFAICT, because
  the disk controller is constantly moving stuff around,
  for error-concealment and wear-leveling.  Main memory
  is not far behind.

  Heating discarded magnetic media above the Curie point
  still works, but is not what you want for routine day-
  to-day erasure.

(*) For super-sensitive tasks, you can use a Faraday cage
with a single-user machine on the inside and armed guards on
the outside.  However, alas, that leaves the other 99.9999%
of the problem unsolved, for instance if you want to write 
a reasonably decent browser or MUA for Grandma to use.

Bottom line:  I don't think we have the primitives to really
do what we want.  This is fixable, but it would require 
changes at every layer from the hardware on up.  This is
serious business.  Try to imagine a hardware instruction
that says
  onInterruptStoreMyRegistersHereAndNowhereElseEvenIfItHurtsPerformance
and imagine support for that all the way up to the language
and library level.

For today, we should do what we can.  It's a tricky two-part
argument:
 a) It helps to lock the front door and the back door, even
  though the side window is standing open.
 b) OTOH we should not overestimate how much good it will do.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIVAwUBVH9/0vO9SFghczXtAQIKKBAAxJryWrw40hYvjwqAHaf0EKvfNndwO2Gv
Dwu4nQzGAwEJMERPJ4AJoB6zOFa9cZuuiVQGTaLYLqgluF5F8TQwPeJWCGfdbCgK
6OnhP2H/PtCYAnFRui5eaDVn3wXqJcZO6LKahs1tgulADk06H0ZgPYJANLvg7grZ
jwUA/vnocMdF+TkmHLF2qnxoUTFUChA4yPKLos47VKUCK/T4VXmdTq9RqKTTHgpF
sbWzcF1MuOUq6HzFGlvkTHtAAxLLQQ6iJCd+ATLuPYoLSliRxIKbGRPd0/ds8+VA
1Qnu1kUCvpztu5eeC2K4TQDab4Kwx+pLJ/LtfcwkHLkRSkUpQenZ9Pn6uJ9F0X65
klz4b2xF13XIwhHEOZDhjg/6spwdhk4zmnIG5N+qBjOaoo5J4vCqpYEQE9CUEVtx
5CzzPQlHOkkl0BbS7EwRzFL9KL7OtQNFuYamRu3H2C245PQz98rqGBNa0Nx/2ex1
fsWl6AcnzwbEHxrq38fBrBfU2amUff3mY8vhKjudpWA9ED3NGFYuQOA3YnJbTyQm
Pd19PyRYhI6krHRtrZPMTqHAjeZwJqcGsDN/0+rzBxFc/LfEjnUEgzeuk+WwtJao
wRS9D4GT1WDHPZpFp5QdsFYHqoqdYPNwsGr4ZE4eMXKe3orBshHXN5rSZd0axtgM
XiBLnA+y8dU=
=jqI+
-----END PGP SIGNATURE-----


More information about the cryptography mailing list