1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 11:40:33 +00:00

[TAS-232 ] [FEAT] verify tag m0

* add new constructor to Tag for Tag0
* minor reporting and comments.
* forgot an include from fix5 merge
* gitignore release folder
This commit is contained in:
cesaaargm 2024-07-03 18:45:40 +02:00
parent 9c7e0589d3
commit aede664b5a
4 changed files with 28 additions and 16 deletions

3
.gitignore vendored
View File

@ -21,4 +21,5 @@ cmake-build-debug/
.vscode/
.vs/
Testing/
/build/*
/build/*
/cmake-build-release/*

View File

@ -601,14 +601,10 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr<OSNMA
}
// update the structure with newly coming NavData
d_osnma_data.d_nav_data.init(osnma_msg); // TODO refactor it
// add_satellite_data(osnma_msg->PRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place
// DEBUG PARSING MACK MESSAGES WHEN DSM-KROOT NOT YET AVAILABLE
// d_osnma_data.d_dsm_kroot_message.ts = 9;
// d_osnma_data.d_dsm_kroot_message.ks = 4;
// d_osnma_data.d_dsm_kroot_message.kroot = std::vector<uint8_t>(16);
d_osnma_data.d_nav_data.init(osnma_msg);
if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10
{ // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future
{// TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future
read_mack_header();
d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly.
d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0;
@ -911,6 +907,9 @@ void osnma_msg_receiver::process_mack_message()
{
if (d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end())
{
// add tag0 first
Tag tag0 (*mack);
d_tags_awaiting_verify.insert(std::pair<uint32_t, Tag>(mack->TOW, tag0));
bool ret = verify_macseq(*mack);
if (ret || d_flag_debug)
{
@ -1001,6 +1000,7 @@ void osnma_msg_receiver::process_mack_message()
}
else if (it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0)
{
// TODO - I dont understand logic. This needs to be reviewed.
// case 1: adkd=12 and t.Tow + 300 < current TOW
// case 2: adkd=0/4 and t.Tow + 30 < current TOW
// case 3: any adkd and t.Tow > current TOW
@ -1087,7 +1087,6 @@ bool osnma_msg_receiver::verify_tag(Tag& tag)
// << tag.tag_id
// << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase
// << tag.received_tag << std::dec;
// TODO case tag0, to be verified here?, PRNd not needed for it
// build message
std::vector<uint8_t> m = build_message(tag);
@ -1428,10 +1427,6 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack)
{
applicable_sequence = sq2;
}
else
{
LOG(WARNING) << "Galileo OSNMA: Mismatch in the GST verification.";
}
if (mack.tag_and_info.size() != applicable_sequence.size() - 1)
{
LOG(WARNING) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!";
@ -1450,7 +1445,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack)
else if (mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i + 1]))
{
LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table.";
return false; // C: suffices one incorrect to abort and not process the rest of the tags
return false; // TODO macseq shall be individual to each tag, a wrongly verified macseq should not discard the whole MACK tags
}
}

View File

@ -171,7 +171,7 @@ public:
SUCCESS,
FAIL,
UNVERIFIED};
Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR)
Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR) // standard tag constructor, for tags within Tag&Info field
: tag_id(id_counter++),
TOW(TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing
WN(WN),
@ -186,7 +186,21 @@ public:
skipped(0)
{
}
Tag(const MACK_message& mack) // constructor for Tag0
: tag_id(id_counter++),
TOW(mack.TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing
WN(mack.WN),
PRNa(mack.PRNa),
CTR(1),
status(UNVERIFIED),
received_tag(mack.header.tag0),
computed_tag(0),
PRN_d(mack.PRNa), // Tag0 are self-authenticating
ADKD(0),
cop(mack.header.cop),
skipped(0)
{
}
const uint32_t tag_id;
uint32_t TOW;
uint32_t WN;

View File

@ -7,6 +7,7 @@
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h> // for LOG
#include <filesystem>
#else
#include <absl/log/log.h>
#endif
@ -557,6 +558,7 @@ void OsnmaMsgReceiverTest::initializeGoogleLog()
FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs";
if (FLAGS_log_dir.empty())
{
std::cout << "Logging will be written at "
<< std::filesystem::temp_directory_path()
<< '\n'