-
Notifications
You must be signed in to change notification settings - Fork 18
/
crd.h
65 lines (47 loc) · 1.08 KB
/
crd.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/** User Input Button api */
#ifndef _CRD_H_
#define _CRD_H_
#include <stdint.h>
#include <avr/pgmspace.h>
#define MAX_CRED_FLASH_SIZE (2048)
#define CRD_START_STR "[CREDENTIALS]"
typedef struct
{
uint16_t name;
uint16_t line1;
uint16_t hop;
uint16_t line2;
uint16_t submit;
uint16_t next;
} credentialFlash_t;
typedef struct
{
uint16_t name; // here we will store name addr
uint16_t next; // here we will store next credential
uint16_t encrypt;
} credentialEncryptedFlash_t;
typedef enum credPosition
{
CRD_USER = 0,
CRD_HOP,
CRD_PASS,
CRD_SUBMIT,
CRD_END
} credPosition_t;
extern void noekeon_decrypt(void);
extern void noekeon_encrypt(void);
typedef struct
{
uint8_t plain[16];
uint8_t key[16];
} cipher_t;
extern cipher_t cipher;
// Credential structure
extern const uint8_t credentials[MAX_CRED_FLASH_SIZE] PROGMEM;
/* Public functions */
void CRD_fsm(uint8_t button);
void CRD_fsmStart(void);
void CRD_Init(void);
void CRD_apply(void);
void CRD_printDetail(credPosition_t start, credPosition_t stop);
#endif /* _CRD_H_*/