How to modify a HW MCU source code to become CW compatible

Hi,

I’m not very good nor experienced with this kind of work, so I was wondering if there is an application note or the like of how to modify an MCU source code to be compatible with the CW interface. Basically a step-by-step instruction with preferably an example (I learn best through examples). For example, I want to implement the PRESENT algorithm on a UFO target board, e.g. for the STM32F family of chips. As an example, I found a 32-bit PRESENT implementation here: http://www.lightweightcrypto.org/implementations.php but I have no idea where to start to make it compliant with the CW Lite board interface, meaning incorporating the SimpleSerial interface to transfer plaintexts for encryption, control signals, triggers etc.

Any help would be appreciated, but a detailed step-by-step application note of some kind, with a concrete example would be perfect for learning how to do it for other targets as well.

Thanks!

That encryption lib looks pretty small, so it’ll be much easier to just add it to a ChipWhispererer project. Basically, you want to make a copy of simpleserial base, make a function out of the PRESENT code, and modify the get_key and get_pt functions to load a key and to encrypt the sent plaintext, respectively.

Alex

Hi Alex,

Yes, that sounds like a better approach, namely to modify an existing CW code. Btw, do you have any recommendations for free IDEs for modifying and re-compiling CW projects?

I just use VS Code: https://code.visualstudio.com/ and build things through the command line.

Thanks! I will look into that.

Btw, do you have an example of a build instruction you would use in the command line, e.g. for the STM32F3 UFO target? (just so I can see an example of the structure together with possibly common options. I’m very new to this, that’s why I’m asking very simple questions)

Thanks!

It’s just the same build that we use in the tutorials:

make PLATFORM=CW308_STM32F3 CRYPTO_TARGET=TINYAES128C