ahtn / keyplus

An easy to use, wired and wireless modular keyboard firmware
MIT License
246 stars 40 forks source link

NRF51 Port #92

Open bezmi opened 5 years ago

bezmi commented 5 years ago

Putting this here as I work on integrating the nrf51 chips via the ESB protocol for the following use cases.

The only challenge I foresee is the crypto hardware of the nrf51/nrf52 series. These chips can only do encryption via AES and are designed to be used with CTR based modes of operation which only rely on encryption operations. They all have BLE compliant AES-CCM hardware that can perform authenticated encryption/decryption, where each packet is a 27 byte payload + 1 byte length field + 4 byte message integrity check. The nrf52840 is an exception here, as it has ARM CryptoCell which should be able to do decryption of AES ciphertext.

I will just implement software based decryption using cifra, the nrf51 chips should be able to do this fast enough for a keyboard.

~Using the built in AES-CCM hardware has the benefit of being able to encrypt/decrypt packets on the fly as they are being transmitted/received and is also the most straightforward implementation in the nrf5 series. However, it also means either a rewrite of the existing security code for the AVR, or having two different security protocols coexist. Not sure how to proceed here. I don't believe CCM is optimal for the small (1 block) stream that keyplus.~