-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathencryption.h
More file actions
30 lines (26 loc) · 1.17 KB
/
encryption.h
File metadata and controls
30 lines (26 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef ENCRYPTION_H
#define ENCRYPTION_H
#include <Arduino.h>
#include <stdint.h>
bool deriveSessionKey(const uint8_t* master_key, const uint8_t* client_nonce,
const uint8_t* server_nonce, uint8_t* session_key);
void deriveSessionId(const uint8_t* session_key, const uint8_t* client_nonce,
const uint8_t* server_nonce, uint8_t* session_id);
void getAuthDeviceIdBytes(uint8_t* device_id);
bool isEncryptionEnabled();
bool isAuthenticated();
void clearEncryptionSession();
bool checkEncryptionSessionTimeout();
void updateEncryptionSessionActivity();
bool verifyNonceReplay(uint8_t* nonce);
void getCurrentNonce(uint8_t* nonce);
void incrementNonceCounter();
bool handleAuthenticate(uint8_t* data, uint16_t len);
bool decryptCommand(uint8_t* ciphertext, uint16_t ciphertext_len, uint8_t* plaintext,
uint16_t* plaintext_len, uint8_t* nonce, uint8_t* auth_tag, uint16_t command_header);
bool encryptResponse(uint8_t* plaintext, uint16_t plaintext_len, uint8_t* ciphertext,
uint16_t* ciphertext_len, uint8_t* nonce, uint8_t* auth_tag);
String getChipIdHex();
void secureEraseConfig();
void checkResetPin();
#endif