Compare commits
3 Commits
2a6db822ff
...
6256b6ef33
Author | SHA1 | Date | |
---|---|---|---|
|
6256b6ef33 | ||
|
bd5a8d52cc | ||
|
be274132d6 |
31
include/configurations/EthernetConfiguration.h
Normal file
31
include/configurations/EthernetConfiguration.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#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];
|
||||||
|
|
||||||
|
};
|
12
include/configurations/KeyConfiguration.h
Normal file
12
include/configurations/KeyConfiguration.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
struct KeyConfiguration {
|
||||||
|
|
||||||
|
const uint8_t* remoteKey;
|
||||||
|
|
||||||
|
const uint8_t* localKey;
|
||||||
|
|
||||||
|
uint32_t challengeExpiryMs;
|
||||||
|
};
|
@ -4,43 +4,8 @@
|
|||||||
#include "servo.h"
|
#include "servo.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
|
#include "configurations/EthernetConfiguration.h"
|
||||||
struct EthernetConfiguration {
|
#include "configurations/KeyConfiguration.h"
|
||||||
|
|
||||||
// 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 {
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "relay/interface/CryptoSource.h"
|
#include "relay/interface/CryptoSource.h"
|
||||||
#include "ESP32NoiseSource.h"
|
#include "ESP32NoiseSource.h"
|
||||||
|
|
||||||
class ESP32CryptoSource: CryptoSource {
|
class ESP32CryptoSource: public CryptoSource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#include "relay/interface/StorageSource.h"
|
#include "relay/interface/StorageSource.h"
|
||||||
|
|
||||||
class ESP32StorageSource: StorageSource {
|
class ESP32StorageSource: public StorageSource {
|
||||||
|
|
||||||
bool writeByteAtIndex(uint8_t byte, uint16_t index) override;
|
bool writeByteAtIndex(uint8_t byte, uint16_t index) override;
|
||||||
|
|
||||||
|
@ -10,10 +10,18 @@
|
|||||||
struct PrivateKey {
|
struct PrivateKey {
|
||||||
|
|
||||||
/// @brief The size of a private key
|
/// @brief The size of a private key
|
||||||
static const int size = 32;
|
static constexpr 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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,10 +30,18 @@ struct PrivateKey {
|
|||||||
struct PublicKey {
|
struct PublicKey {
|
||||||
|
|
||||||
/// @brief The size of a public key
|
/// @brief The size of a public key
|
||||||
static const int size = 32;
|
static constexpr 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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +50,7 @@ struct PublicKey {
|
|||||||
struct Signature {
|
struct Signature {
|
||||||
|
|
||||||
/// @brief The size of a message signature
|
/// @brief The size of a message signature
|
||||||
static const int size = 64;
|
static constexpr int size = 64;
|
||||||
|
|
||||||
uint8_t bytes[size];
|
uint8_t bytes[size];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user