GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
Galileo_OSNMA.h
Go to the documentation of this file.
1/*!
2 * \file Galileo_OSNMA.h
3 * \brief Galileo OSNMA message constants
4 * \author Carles Fernandez, 2023. cfernandez(at)cttc.es
5 *
6 *
7 * -----------------------------------------------------------------------------
8 *
9 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10 * This file is part of GNSS-SDR.
11 *
12 * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
13 * SPDX-License-Identifier: GPL-3.0-or-later
14 *
15 * -----------------------------------------------------------------------------
16 */
17
18#ifndef GNSS_SDR_GALILEO_OSNMA_H
19#define GNSS_SDR_GALILEO_OSNMA_H
20
21#include <cstddef>
22#include <cstdint>
23#include <string>
24#include <unordered_map>
25#include <utility>
26#include <vector>
27
28/** \addtogroup Core
29 * \{ */
30/** \addtogroup System_Parameters
31 * \{ */
32
33constexpr size_t SIZE_DSM_BLOCKS_BYTES = 13;
34
35// OSNMA User ICD, Issue 1.1, Table 1
36const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_1 = {
37 {0, std::string("Reserved")},
38 {1, std::string("Test")},
39 {2, std::string("Operational")},
40 {3, std::string("Don't use")}}; // key: nmas, value: nmas status
41
42
43// OSNMA User ICD, Issue 1.1, Table 2
44const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_2 = {
45 {0, std::string("Reserved")},
46 {1, std::string("Nominal")},
47 {2, std::string("End of Chain (EOC)")},
48 {3, std::string("Chain Revoked (CREV)")},
49 {4, std::string("New Public Key (NPK)")},
50 {5, std::string("Public Key Revoked (PKREV)")},
51 {6, std::string("New Merkle Tree (NMT)")},
52 {7, std::string("Alert Message (AM)")}}; // key: cpks, value: cpks status
53
54// OSNMA User ICD for the Test Phase, Issue 1.0, Table 3
55const std::unordered_map<uint8_t, std::pair<uint16_t, uint16_t>> OSNMA_TABLE_3 = {
56 {0, {0, 0}},
57 {1, {0, 0}},
58 {2, {0, 0}},
59 {3, {0, 0}},
60 {4, {0, 0}},
61 {5, {0, 0}},
62 {6, {0, 0}},
63 {7, {13, 1352}},
64 {8, {14, 1456}},
65 {9, {15, 1560}},
66 {10, {16, 1664}},
67 {11, {0, 0}},
68 {12, {0, 0}},
69 {13, {0, 0}},
70 {14, {0, 0}},
71 {15, {0, 0}}}; // key: nb_dp, value: {num_blocks, l_dp_bits}
72
73const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_5 = {
74 {0, std::string("Reserved")},
75 {1, std::string("ECDSA P-256")},
76 {2, std::string("Reserved")},
77 {3, std::string("ECDSA P-521")},
78 {4, std::string("OAM")},
79 {5, std::string("Reserved")},
80 {6, std::string("Reserved")},
81 {7, std::string("Reserved")},
82 {8, std::string("Reserved")},
83 {9, std::string("Reserved")},
84 {10, std::string("Reserved")},
85 {11, std::string("Reserved")},
86 {12, std::string("Reserved")},
87 {13, std::string("Reserved")},
88 {14, std::string("Reserved")},
89 {15, std::string("Reserved")}}; // key: nptk, value: message
90
91const std::unordered_map<std::string, uint16_t> OSNMA_TABLE_6 = {
92 {std::string("ECDSA P-256"), 264},
93 {std::string("ECDSA P-521"), 536}};
94
95// OSNMA User ICD, Issue 1.1, Table 7
96const std::unordered_map<uint8_t, std::pair<uint16_t, uint16_t>> OSNMA_TABLE_7 = {
97 {0, {0, 0}},
98 {1, {7, 728}},
99 {2, {8, 832}},
100 {3, {9, 936}},
101 {4, {10, 1040}},
102 {5, {11, 1144}},
103 {6, {12, 1248}},
104 {7, {13, 1352}},
105 {8, {14, 1456}},
106 {9, {0, 0}},
107 {10, {0, 0}},
108 {11, {0, 0}},
109 {12, {0, 0}},
110 {13, {0, 0}},
111 {14, {0, 0}},
112 {15, {0, 0}}}; // key: nb_dk, value: {num_blocks, l_dk_bits}
113
114const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_8 = {
115 {0, std::string("SHA-256")},
116 {1, std::string("Reserved")},
117 {2, std::string("SHA3-256")},
118 {3, std::string("Reserved")}}; // key: hs, value: hash_function
119
120const std::unordered_map<uint8_t, uint16_t> OSNMA_TABLE_10 = {
121 {0, 96},
122 {1, 104},
123 {2, 112},
124 {3, 120},
125 {4, 128},
126 {5, 160},
127 {6, 192},
128 {7, 224},
129 {8, 256},
130 {9, 0},
131 {10, 0},
132 {11, 0},
133 {12, 0},
134 {13, 0},
135 {15, 0},
136 {15, 0}}; // key: ks, value: lk_bits
137
138const std::unordered_map<uint8_t, uint8_t> OSNMA_TABLE_11 = {
139 {0, 0},
140 {1, 0},
141 {2, 0},
142 {3, 0},
143 {4, 0},
144 {5, 20},
145 {6, 24},
146 {7, 28},
147 {8, 32},
148 {9, 40},
149 {10, 0},
150 {11, 0},
151 {12, 0},
152 {13, 0},
153 {14, 0},
154 {15, 0},
155};
156
157const std::unordered_map<std::string, uint16_t> OSNMA_TABLE_15 = {
158 {std::string("ECDSA P-256"), 512},
159 {std::string("ECDSA P-521"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits}
160
161const std::string PEMFILE_DEFAULT("./OSNMA_PublicKey.pem");
162const std::string CRTFILE_DEFAULT("./OSNMA_PublicKey_20240115100000_newPKID_1.crt");
163const std::string MERKLEFILE_DEFAULT("./OSNMA_MerkleTree_20240115100000_newPKID_1.xml");
164const std::string KROOTFILE_DEFAULT("./OSNMA_DSM_KROOT_NMAHeader.bin");
165
166class Mack_lookup
167{
168public:
169 Mack_lookup() = default;
170 Mack_lookup(uint8_t msg_,
171 uint8_t nt_,
172 const std::vector<std::string>& s1_,
173 const std::vector<std::string>& s2_) : msg(msg_),
174 nt(nt_),
175 sequence1(s1_),
176 sequence2(s2_) {};
177 uint8_t msg{};
178 uint8_t nt{};
179 std::vector<std::string> sequence1;
180 std::vector<std::string> sequence2;
181};
182
183const std::unordered_map<uint8_t, Mack_lookup> OSNMA_TABLE_16 = {
184 {27, {2, 6, {"00S", "00E", "00E", "00E", "12S", "00E"}, {"00S ", "00E", "00E", "04S", "12S", "00E"}}},
185 {28, {2, 10, {"00S", "00E", "00E", "00E", "00S", "00E", "00E", "12S", "00E", "00E"}, {"00S", "00E", "00E", "00S", "00E", "00E", "04S", "12S", "00E", "00E"}}},
186 {31, {2, 5, {"00S", "00E", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "04S"}}},
187 {33, {2, 6, {"00S", "00E", "04S", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "00E", "12E"}}},
188 {34, {2, 6, {"00S", "FLX", "04S", "FLX", "12S", "00E"}, {"00S", "FLX", "00E", "12S", "00E", "12E"}}},
189 {35, {2, 6, {"00S", "FLX", "04S", "FLX", "12S", "FLX"}, {"00S", "FLX", "FLX", "12S", "FLX", "FLX"}}},
190 {36, {2, 5, {"00S", "FLX", "04S", "FLX", "12S"}, {"00S", "FLX", "00E", "12S", "12E"}}},
191 {37, {2, 5, {"00S", "00E", "04S", "00E", "12S"}, {"00S", "00E", "00E", "12S", "12E"}}},
192 {38, {2, 5, {"00S", "FLX", "04S", "FLX", "12S"}, {"00S", "FLX", "FLX", "12S", "FLX"}}},
193 {39, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "00E", "12S"}}},
194 {40, {2, 4, {"00S", "00E", "04S", "12S"}, {"00S", "00E", "00E", "12E"}}},
195 {41, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "FLX", "12S"}}}};
196
197/** \} */
198/** \} */
199#endif // GNSS_SDR_GALILEO_OSNMA_H