This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Has anyone implemented Diffie-Hellman key exchange and has source?



Hello,

   I'm looking at using Diffie-Hellman key exchange for exchanging keys over a link. Has anyone implemented this on a Stellaris? I've seen libraries from OpenSSL etc. but they are more complex than necessary and designed to be used with lots of other files. I'm looking for more of a "pure" DHKE implementation.

Thanks,

Derek

  • Derek,

    To start with, I must disclose that it has been a while since I have played around with encryption algorithms (aside from SHA keys, but even there my experience is more in setup and use than in cryptographic implementation).  Also, there is no official Stellaris or Tiva example code for this particular algorithm, which doesn't meant that a non-TI affiliated member of our community won't be able to chime in with a working example, but I don't think you will find an official TI sanctioned snippet of C code for this exact problem.

    That being said, there should be nothing unique about running DHKE algorithms on a Stellaris than there would be for any other platform running C.  A quick glance at the wikipedia entry on Diffie–Hellman key exchange contains a simple C implementation for a user given common prime/base and a specified private value a and b, to generate the set of keys to be exchanged.  I see no reason why you would be unable to use that algorithm on a Stellaris (aside from potential legal reasons, of which I am uneducated and can only make uninformed guesses to the nature of what licensing sample code from wikipedia would fall under).  Also, a bit of googling should bring up a few different examples that ought to be of use if you are interested in writing and testing your own algorithm.

    I would recommend trying to find an open source example (possibly the one on the wiki entry) of how to implement DHKE in C, get it compiling and running in the C editor and compiler of your choice, then move it to the microcontroller and verify using simple UART print statements or a debugger that you get the same results on the MCU that you got when running on your development system.

    Sorry I couldn't be of more assistance in providing a fully coded, turn key solution for what you're needing.