/*
Welcome to the BSidesTLV 2024 "Wokwi for Embedded System Security Research" entrance challenge.
To get the registration secret you need to write some code to communicate with the vault chip.

The vault chip is connected via the SPI interface (https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi/all).
The chip supports 3 commands:
VAULT_READ_CHALLENGE - reads a 16 byte challenge from the vault chip.
VAULT_WRITE_RESPONSE - write a 16 byte response to the vault chip.
VAULT_READ_SECRET - read a 16 byte secret(textual) from the vault.
                    This only works if the vault has been unlocked.
                    If the device is locked the bytes will all be 0x00.

To get the secret you must get the first get the challenge from the chip. 
Then perform an exclusive or operation between each byte and the complement of the bytes index (reponse[i] = challenge[i] xor not(i)).
Next you will need to write the response back to the chip.
If the previous steps were performed correctly you should now be able to request the secret from the chip.
*/

#include <SPI.h>
#include <stdlib.h>

typedef enum {
  VAULT_READ_CHALLENGE = 0xC0,
  VAULT_WRITE_RESPONSE = 0xD1,
  VAULT_READ_SECRET = 0XF3
} command_t;



void setup() {
}

void loop() {
}
Loading chip...chip-bsides-vault