Compatibility of AES Encryption using CryptoAccel library on Teensy 3.6 with PC

Status
Not open for further replies.

paqwa

Member
Hi, I would very much appreciate any help or guidance anyone can bring to bear on getting a better understanding of how Paul's CryptoAccel library works and how to use it for the purposes of encrypting data which was not encrypted using the same library. There isn't any underlying C code for this library (rather it the functions are calling assembly code, likely for better performance using on board hardware), only the header file which collates the exposed functions. The following is what I am trying to do:

I have a Teensy 3.6 project which reads information from files contained on an SD card using Bill's SdFat library and all works well with it. However, I want to try and protect the data on the SD card such that a users won't be able to simply manually remove the SD card and copy it to a computer or other SD card. To achieve this I want to encrypt the information in my files before adding them to the SD card and then during program run time, then have a simple ring buffer reading blocks of bytes from sd card files, decrypt 128bit chucks of information on the fly and then pass it onto my existing functions to execute the appropriate tasks. The decrypted info is never stored but rather overwritten by the next instruction in the ring buffer.

I have very little experience with encryption but from playing around with the CryptoAccel library and examples found at here:
https://forum.pjrc.com/threads/43363-Crypto-acceleration-unit
https://github.com/Heavy-Vehicle-Ne...mples/tree/master/AES_Encrypt_Decrypt_Example
I can define a key, encrypt data in 16 byte chunks (i.e. 128 bits) using AES or DES encryption. However, I don'know what padding (if any) or cipher mode of encryption is employed by the CryptoAccel library (i.e. is it CBC, ECB, OFB, CFB or CTS). I need to know this as I want to encrypt my data on a PC and later decrypt it during execution on the Teensy 3.6 and visa versa for encrypt data recorded by the Teeny 3.6, save on SD card and then decrypt this data on a PC. When encrypting using .NET libraries on a PC I find that the encrypted byte array is always padded (I believe with a long word (4 bytes) at the beginning and another long word (4 bytes) between all subsequent 128 bit chunks of the input byte array.

Any advice or additional understanding re this would be very much appreciated.
 
Replying to my own thread, as I found the cause of the issue I raised! The cipher mode used by AES encryption using CryptoAccel library appear to be Electronic Codebook (ECB) and the output corresponds just fine with that produced via the .NET encryption process. The problem I was having was just to do with 64 bit conversion which was adding some additional bytes to the output.

It would still be useful to gather some more information as to whether a more advanced encryption mode can be utilized on Teensy using hardware acceleration, i.e. with CryptoAccel library, and can this be easily modified to incorporate CBC mode?
 
Status
Not open for further replies.
Back
Top