summaryrefslogtreecommitdiff
path: root/controller/fw/src/crypto.h
blob: 05a3c0d2b0eb4ec74e673dfe639586a1a7578987 (plain)
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
#ifndef __CRYPTO_H__
#define __CRYPTO_H__

#include <stdint.h>

#define PRESIG_MSG_LEN 16
#define OOB_TRIGGER_LEN PRESIG_MSG_LEN

enum trigger_domain {
    TRIGGER_DOMAIN_ALL,
    TRIGGER_DOMAIN_VENDOR,
    TRIGGER_DOMAIN_SERIES,
    TRIGGER_DOMAIN_COUNTRY,
    TRIGGER_DOMAIN_REGION,
    _TRIGGER_DOMAIN_COUNT
};

extern const char *presig_domain_strings[_TRIGGER_DOMAIN_COUNT];
extern uint8_t presig_keys[_TRIGGER_DOMAIN_COUNT][PRESIG_MSG_LEN];
extern int presig_height;
extern uint8_t presig_bundle_id[16];
extern uint64_t bundle_timestamp;

extern void oob_trigger_activated(enum trigger_domain domain, int height);

int oob_message_received(uint8_t msg[static OOB_TRIGGER_LEN]);
int verify_trigger(const uint8_t inkey[PRESIG_MSG_LEN], int *height_out, int *domain_out);

#endif /* __CRYPTO_H__ */