-
Notifications
You must be signed in to change notification settings - Fork 0
/
mask_rom.h
87 lines (61 loc) · 1.67 KB
/
mask_rom.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef MASK_ROM_H
#define MASK_ROM_H
#include <string.h>
#include <stdint.h>
#include <malloc.h>
#include <stdlib.h>
#include <memory.h>
#define __REACHABILITY_CHECK __CPROVER_assert(0, "Reachability check, should always \033[0;31mFAIL\033[0m");
#define MAX_ROM_EXTS 1
#define RSA_SIZE 96
#define PMP_REGIONS 16
#define MAX_IMAGE_LENGTH 2 //necessary constraint in order to terminate CBMC verification
//Represents a signature. Needed for CBMC OBJECT_SIZE to see if signature is of ok size
typedef struct signature_t{
int32_t value[RSA_SIZE];
//something else
} signature_t;
//Represents a public key
typedef struct pub_key_t{
int32_t exponent;
int32_t modulus[RSA_SIZE];
//something else
} pub_key_t;
//Struct representing rom_ext_manifest
typedef struct rom_ext_manifest_t{
uint32_t identifier;
signature_t signature;
//public part of signature key
pub_key_t pub_signature_key;
uint32_t image_length;
char* image_code;
} rom_ext_manifest_t;
//Returned by rom_ext_manifests_to_try
typedef struct rom_exts_manifests_t {
int size;
rom_ext_manifest_t rom_exts_mfs[MAX_ROM_EXTS];
} rom_exts_manifests_t;
//Represents boot policy
typedef struct boot_policy_t {
int identifier;
//which rom_ext_slot to boot
int rom_ext_slot;
//what to do if all ROM Ext are invalid
char* fail;
//what to do if the ROM Ext unexpectedly returns
char* fail_rom_ext_terminated;
} boot_policy_t;
//Represents a pmp region
typedef struct __PMP_region_t {
int identifier;
//Locked, Read, Write, Execute
int R;
int W;
int E;
int L;
} __PMP_region_t;
typedef struct __PMP_regions_t {
//There are 16 PMP regions (0...15)
__PMP_region_t pmp_regions[PMP_REGIONS];
} __PMP_regions_t;
#endif