Van de Ven: Deprecating old crypto
But more, and this is a call to action: If you're working on an open source project that uses crypto, please please don't opencode crypto algorithm usage. The algorithm may be outdated at any time and might have to go away in a hurry."
Posted Mar 24, 2015 21:05 UTC (Tue)
by epa (subscriber, #39769)
[Link] (6 responses)
Similarly if hashes like MD5 provided two interfaces: make_hash(data) and check_hash(data, expected_hash) then you could compile out support for generating new MD5 digests while still working with existing signed data.
Posted Mar 25, 2015 0:25 UTC (Wed)
by jeff_marshall (subscriber, #49255)
[Link] (1 responses)
However, the mode with which the cipher is used may not make this possible. For example, counter mode only uses the block-cipher encryption primitive to implement both encryption and decryption of messages.
At the api/implementation level, the problem tends to be that make_hash (or equivalent) often takes a struct with function pointers to the implementation of the actual cryptographic method. This is done because the decision of which hash function to use is often a result of header parsing (offline case) or session negotiation (online case) and lives in a different module from the code that actually invokes the hash function. If you want to ditch a cipher completely you'd have to either reject it at selection time (more code to inspect for correctness), or remove the cipher completely and give up decryption as well as encryption. Add to the fact that someone might call make_hash() and do memcmp() themselves instead of calling check_hash() while still getting correct results, and automated checking of the source code becomes more difficult.
Posted Mar 25, 2015 3:02 UTC (Wed)
by ncm (guest, #165)
[Link]
Counter modes only appear in relatively modern cryptosystems, so are not in most of the systems you don't want.
Posted Mar 25, 2015 21:46 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (3 responses)
Well, if the interfaces were that easy, maybe people wouldn't have thought they needed to reimplement them in their own projects. Really, the code to get hashes of data out of these things is absurd.
Posted Mar 25, 2015 23:41 UTC (Wed)
by cesarb (subscriber, #6266)
[Link] (2 responses)
The traditional hashing API is pretty simple: an "init" function, an "update" function to be called repeatedly as data arrived, and a "finish" function to be called at the end to finish the computations and return the hash. The code to get a hash out of this API is not "absurd"; in fact, if you have all the data already in memory, it's three straight calls (init, update passing all the data at once, finish).
I can see, however, the value in providing two variants of the "finish" call: one which simply returns the hash, and one which does a constant-time compare with a passed hash. A lot of people forget the "constant-time" part, and it's important!
Posted Mar 30, 2015 13:47 UTC (Mon)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
Posted Mar 30, 2015 19:24 UTC (Mon)
by dkg (subscriber, #55359)
[Link]
Posted Mar 25, 2015 3:01 UTC (Wed)
by imgx64 (guest, #78590)
[Link] (3 responses)
Posted Mar 25, 2015 6:34 UTC (Wed)
by epa (subscriber, #39769)
[Link] (2 responses)
Conceivably a similar setup could be used for virtual machines to talk to other VMs on the same supervisor, where the virtual network interface has no risk of eavesdropping or MITM (unless deliberately configured to do so by the machine's owner). You might not want to do it on Microsoft Azure, but for your own compute farm it could be handy.
Posted Mar 25, 2015 7:24 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Mar 25, 2015 13:56 UTC (Wed)
by arjan (subscriber, #36785)
[Link]
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
If you just want a simple hashing interface without a lot of unnecessary library initialization and shutdown overhead, i recommend looking at nettle. The nettle manual's example code even shows that workflow explicitly.
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto
Van de Ven: Deprecating old crypto