emsec / ChameleonMini

The ChameleonMini is a versatile contactless smartcard emulator compliant to NFC. The ChameleonMini was developed by https://kasper-oswald.de. The device is available at https://shop.kasper.it. For further information see the Getting Started Page https://rawgit.com/emsec/ChameleonMini/master/Doc/Doxygen/html/_page__getting_started.html or the Wiki tab above.
Other
1.73k stars 392 forks source link

Updating and adding new support for DES and AES-128 crypto with HW acceleration #286

Closed maxieds closed 3 years ago

maxieds commented 3 years ago

@david-oswald pointed out in issue 10 in this repo that it is better to code the AES crypto support using the AVR Xmega built-in hardware acceleration (in place of the previous software implementation). In making the revisions in this pull request, I updated the existing DES/3DES/2KTDEA support added by @dev-zzo and created the new AES-128 HW accelerated functionality based on source code samples from Microchip's ASF library for Xmega.

To test these routines, enable the following new settings flags in the Makefile:

#Enable tests for DES/2KTDEA/3DES/AES128 crypto schemes:
SETTINGS  += -DENABLE_CRYPTO_TESTS

#Enable a command to run any tests added by developers, e.g., the 
#crypto scheme tests that can be enabled above:
SETTINGS  += -DENABLE_RUNTESTS_TERMINAL_COMMAND

Then after recompiling and refreshing, the following command output of the new Chameleon terminal command RUNTESTS shows that the cryptographic routine test cases all pass:

RUNTESTS                                
101:OK WITH TEXT                        
All tests passed: 4 / 4.

Note that enabling the crypto tests brings in extra memory requirements, so make sure to remove that setting by default in the Makefile.