Compare commits

..

No commits in common. "6256b6ef339196bc4a60e6c601c29f6e0fc7688e" and "2a6db822ffdc0277607d70091be02afb4b7dced1" have entirely different histories.

6 changed files with 42 additions and 66 deletions

View File

@ -1,31 +0,0 @@
#pragma once
#include <stdint.h>
struct EthernetConfiguration {
// The MAC address of the ethernet connection
uint8_t macAddress[6];
// The master-in slave-out pin of the SPI connection for the Ethernet module
int8_t spiPinMiso;
// The master-out slave-in pin of the SPI connection for the Ethernet module
int8_t spiPinMosi;
// The slave clock pin of the SPI connection for the Ethernet module
int8_t spiPinSclk;
// The slave-select pin of the SPI connection for the Ethernet module
int8_t spiPinSS;
unsigned long dhcpLeaseTimeoutMs;
unsigned long dhcpLeaseResponseTimeoutMs;
// The static IP address to assign if DHCP fails
uint8_t manualIp[4];
// The IP address of the DNS server, if DHCP fails
uint8_t manualDnsAddress[4];
};

View File

@ -1,12 +0,0 @@
#pragma once
#include <stdint.h>
struct KeyConfiguration {
const uint8_t* remoteKey;
const uint8_t* localKey;
uint32_t challengeExpiryMs;
};

View File

@ -4,8 +4,43 @@
#include "servo.h" #include "servo.h"
#include "message.h" #include "message.h"
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
#include "configurations/EthernetConfiguration.h"
#include "configurations/KeyConfiguration.h" struct EthernetConfiguration {
// The MAC address of the ethernet connection
uint8_t macAddress[6];
// The master-in slave-out pin of the SPI connection for the Ethernet module
int8_t spiPinMiso;
// The master-out slave-in pin of the SPI connection for the Ethernet module
int8_t spiPinMosi;
// The slave clock pin of the SPI connection for the Ethernet module
int8_t spiPinSclk;
// The slave-select pin of the SPI connection for the Ethernet module
int8_t spiPinSS;
unsigned long dhcpLeaseTimeoutMs;
unsigned long dhcpLeaseResponseTimeoutMs;
// The static IP address to assign if DHCP fails
uint8_t manualIp[4];
// The IP address of the DNS server, if DHCP fails
uint8_t manualDnsAddress[4];
};
struct KeyConfiguration {
const uint8_t* remoteKey;
const uint8_t* localKey;
uint32_t challengeExpiryMs;
};
class SesameController: public ServerConnectionCallbacks { class SesameController: public ServerConnectionCallbacks {

View File

@ -3,7 +3,7 @@
#include "relay/interface/CryptoSource.h" #include "relay/interface/CryptoSource.h"
#include "ESP32NoiseSource.h" #include "ESP32NoiseSource.h"
class ESP32CryptoSource: public CryptoSource { class ESP32CryptoSource: CryptoSource {
public: public:

View File

@ -1,7 +1,7 @@
#include "relay/interface/StorageSource.h" #include "relay/interface/StorageSource.h"
class ESP32StorageSource: public StorageSource { class ESP32StorageSource: StorageSource {
bool writeByteAtIndex(uint8_t byte, uint16_t index) override; bool writeByteAtIndex(uint8_t byte, uint16_t index) override;

View File

@ -10,18 +10,10 @@
struct PrivateKey { struct PrivateKey {
/// @brief The size of a private key /// @brief The size of a private key
static constexpr int size = 32; static const int size = 32;
uint8_t bytes[size]; uint8_t bytes[size];
bool isUnset() {
for (uint8_t i = 0; i < size; i += 1) {
if (bytes[i] != 0) {
return false;
}
}
return true;
}
}; };
/** /**
@ -30,18 +22,10 @@ struct PrivateKey {
struct PublicKey { struct PublicKey {
/// @brief The size of a public key /// @brief The size of a public key
static constexpr int size = 32; static const int size = 32;
uint8_t bytes[size]; uint8_t bytes[size];
bool isUnset() {
for (uint8_t i = 0; i < size; i += 1) {
if (bytes[i] != 0) {
return false;
}
}
return true;
}
}; };
/** /**
@ -50,7 +34,7 @@ struct PublicKey {
struct Signature { struct Signature {
/// @brief The size of a message signature /// @brief The size of a message signature
static constexpr int size = 64; static const int size = 64;
uint8_t bytes[size]; uint8_t bytes[size];