Skip to content

Customize Pa55ware firmware

Baldanos edited this page Dec 8, 2013 · 1 revision

At the moment, many options on the firmware can only be customized in the source code itself. Fortunately, all these settings are in defines or in variables at the beginning of the source.

At least, the following actions may be done before using Pa55ware :

  1. Change the PIN code
  2. Set The AES key on the device

Touch buttons

Four actions are used in the firmware :

  1. UP
  2. DOWN
  3. BACK
  4. ENTER

The INPUT[] variable defines which physical inputs are bound to which action :

//INPUTS contains the pin numbers associated with the touch input buttons
//  Order is UP, DOWN, BACK, ENTER
int INPUTS[] = {15,16,17,18};

In this default example, touch input 15 on the Teensy is bound to UP, 16 to DOWN, and so on.

As the touch inputs differ from a case to an other, you may encounter a case where the Pa55ware seem to have a stuck input, or an input does not work at all. This is generally caused by the capacitive sensor, which cannot detect your finger. To change this, you can change the THRESHOLDS[] value.

//THRESHOLDS contains the threshold value to consider a touch button "pressed"
int THRESHOLDS[] = {510,520,590,730};

If a touch input is stuck, you may have to change this value to a higher one. In the case where an action is not recognized at all, you may lower this value.

PIN code

Pa55ware uses the four input buttons to input a PIN code. Two variables need to be changed :

  1. PASS_LENGTH, which contains the length of the PIN code
  2. PASSWORD[PASS_LENGTH], which contains the PIN code.

Set the PIN code

To set the PIN code to UP, UP, DOWN, DOWN :

//Unlocking sequence length
#define PASS_LENGTH 4
//PASSWORD contains the lock screen password
int PASSWORD[PASS_LENGTH] = {ACTION_UP,ACTION_UP,ACTION_DOWN,ACTION_DOWN};

Change the number of failed attempts

The MAX_TRIES define is there for this :

//Max tries allowed for bad lockscreen sequence
#define MAX_TRIES 3

AES key

The AES key is used to encrypt all data stored on the SD card. This means that this value must be kept secret. In the code, the key is stored in the KEY global. It is read from the EEPROM from address 1 to 33 (when using AES256).

Generating an AES key

At the moment, there is no mechanism to generate an AES key. To generate a new one, you should use the following code to initialize the Teensy's EEPROM with your AES key :

#include <EEPROM.h>

void setup(){
    byte AES_KEY[32] = {'\x00\x01\x02\x03\x04\x05\x06\x07\x08\09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d'};
    for (int i=0;i<32;i++) {
        EEPROM.write(i+1, AES_KEY[i]);
    }
}
void loop() {
}

Just replace the AES_KEY value with your own and run this sketch one time to set the key in EEPROM.