From 79da7787ffa3ac852f81fc1b672c04a641b36492 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 10 Aug 2024 11:31:15 +0200 Subject: [PATCH] Move files (#24) * Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 * Avoid code duplication in CMake modules * Update clang-tidy job * Clang Tidy fixes * Improve efficiency of Concurrent_Map and Concurrent_Queue classes * Fix segmentation fault if the SignalSource implementation is not available * Moved decimation factor count variable to the class * Avoid possible runtime error when PVT.enable_rx_clock_correction=true * Fix formatting * Fix clang-tidy job * Move receiver-related classes to src/core/libs * Uniformize cmake module names * Fix formatting * Make clang-tidy happy * Fix crypto benchmarks * Fixes for old systems * Instantiate sources only once --------- Co-authored-by: cesaaargm Co-authored-by: Xavier Guerrero-Pau --- .gitignore | 10 ++- CMakeLists.txt | 2 +- cmake/Modules/FindGNURADIO.cmake | 2 + ...nssSdrCrypto.cmake => GnsssdrCrypto.cmake} | 0 .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 2 +- .../signal_source/libs/ad936x_iio_custom.cc | 40 +++++---- src/core/libs/CMakeLists.txt | 43 ++++++---- .../gnss_crypto.cc | 6 +- .../{system_parameters => libs}/gnss_crypto.h | 2 +- .../osnma_helper.cc | 0 .../osnma_helper.h | 2 +- .../osnma_nav_data_manager.cc | 75 +++++++++------- .../osnma_nav_data_manager.h | 46 ++++++---- src/core/monitor/gnss_synchro_monitor.cc | 2 +- src/core/monitor/gnss_synchro_monitor.h | 3 +- src/core/receiver/concurrent_map.h | 40 ++++----- src/core/receiver/concurrent_queue.h | 61 ++++++------- src/core/receiver/gnss_block_factory.cc | 1 + src/core/receiver/gnss_flowgraph.cc | 13 ++- src/core/system_parameters/CMakeLists.txt | 10 --- src/core/system_parameters/osnma_data.h | 44 ++++++---- src/tests/benchmarks/CMakeLists.txt | 2 +- src/tests/benchmarks/benchmark_crypto.cc | 86 ++++++------------- 23 files changed, 260 insertions(+), 232 deletions(-) rename cmake/Modules/{GnssSdrCrypto.cmake => GnsssdrCrypto.cmake} (100%) rename src/core/{system_parameters => libs}/gnss_crypto.cc (99%) rename src/core/{system_parameters => libs}/gnss_crypto.h (99%) rename src/core/{system_parameters => libs}/osnma_helper.cc (100%) rename src/core/{system_parameters => libs}/osnma_helper.h (97%) rename src/core/{system_parameters => libs}/osnma_nav_data_manager.cc (83%) rename src/core/{system_parameters => libs}/osnma_nav_data_manager.h (61%) diff --git a/.gitignore b/.gitignore index dd9645f6d..4a50387fa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,11 +15,17 @@ src/utils/nav-listener/build .cproject .idea cmake-build-debug/ +cmake-build-release/ /install .DS_Store .pydevproject .vscode/ .vs/ Testing/ -/build/* -/cmake-build-release/* \ No newline at end of file +GSDR* +PVT_* +HAS_* +gnss_sdr_pvt.nmea +build-debug/ +build-release/ + diff --git a/CMakeLists.txt b/CMakeLists.txt index eb113bad3..e8dfc5825 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2215,7 +2215,7 @@ endif() ################################################################################ # OpenSSL https://www.openssl.org/ or GnuTLS - https://www.gnutls.org/ ################################################################################ -include(GnssSdrCrypto) +include(GnsssdrCrypto) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index cfaf51764..d976d0e28 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -366,8 +366,10 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) ) if(CMAKE_VERSION VERSION_GREATER 3.13) target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) + target_link_libraries(Gnuradio::runtime INTERFACE Log4cpp::log4cpp) else() set_target_properties(Gnuradio::filter PROPERTIES INTERFACE_LINK_LIBRARIES Log4cpp::log4cpp) + set_target_properties(Gnuradio::runtime PROPERTIES INTERFACE_LINK_LIBRARIES Log4cpp::log4cpp) endif() endif() if(${_uses_spdlog}) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnsssdrCrypto.cmake similarity index 100% rename from cmake/Modules/GnssSdrCrypto.cmake rename to cmake/Modules/GnsssdrCrypto.cmake diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 109b935c7..2ffe95d24 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -2228,7 +2228,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item d_gnss_observables_map_t1 = d_gnss_observables_map; // ### select the rx_time and interpolate observables at that time - if (!d_gnss_observables_map_t0.empty()) + if (!d_gnss_observables_map_t0.empty() && !d_gnss_observables_map_t1.empty()) { const auto t0_int_ms = static_cast(d_gnss_observables_map_t0.cbegin()->second.RX_time * 1000.0); const uint32_t adjust_next_obs_interval_ms = d_observable_interval_ms - t0_int_ms % d_observable_interval_ms; diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 2869081f2..72461bafd 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -13,6 +13,7 @@ * ----------------------------------------------------------------------------- */ #include "ad936x_iio_custom.h" +#include "display.h" #include #include #include @@ -44,6 +45,7 @@ ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) n_channels = 0; } + ad936x_iio_custom::~ad936x_iio_custom() { // disable TX @@ -59,11 +61,13 @@ void ad936x_iio_custom::set_gnsstime_queue(std::shared_ptr> queue) { Pps_queue = std::move(queue); } + bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::string board_type) { // Find devices @@ -125,7 +129,6 @@ bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::str return false; } - phy = iio_context_find_device(ctx, "ad9361-phy"); if (phy == NULL) @@ -328,7 +331,6 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, configure_params(dds_dev, params_dds); } - return true; } @@ -345,6 +347,7 @@ bool ad936x_iio_custom::check_device() } } + bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, std::string &value) { struct iio_channel *chn = 0; @@ -386,6 +389,7 @@ bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, } } + bool ad936x_iio_custom::read_die_temp(double &temp_c) { std::string temp_mC_str; @@ -410,6 +414,8 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) return false; } } + + bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, @@ -425,7 +431,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, double lo_attenuation_db_, bool high_side_lo_, int tx_lo_channel_) - { if (check_device() == false) return false; @@ -610,14 +615,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Warning: rf_port_select write returned: " << ret << "\n"; no_errors = false; } - // ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_); // if (ret < 0) // { // std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n"; // no_errors = false; // } - long long set_rf_bw; ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw); if (ret < 0) @@ -630,7 +633,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Info: rf_bandwidth read returned: " << set_rf_bw << " Hz \n"; } - if (setRXGain(0, gain_mode_rx0_, rf_gain_rx0_) == false) { std::cerr << "Info: setRXGain read returned false \n"; @@ -662,14 +664,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Warning: rf_port_select write returned: " << ret << "\n"; no_errors = false; } - // ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_); // if (ret < 0) // { // std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n"; // no_errors = false; // } - long long set_rf_bw; ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw); if (ret < 0) @@ -702,6 +702,7 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, return no_errors; } + bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) { if (check_device() == false) return false; @@ -747,6 +748,7 @@ bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) return true; } + bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain_dB) { if (check_device() == false) return false; @@ -779,6 +781,7 @@ bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain } } + double ad936x_iio_custom::get_rx_gain(int ch_num) { if (check_device() == false) return -1; @@ -817,6 +820,7 @@ bool ad936x_iio_custom::calibrate([[maybe_unused]] int ch, [[maybe_unused]] doub return true; } + void ad936x_iio_custom::monitor_thread_fn() { uint32_t val; @@ -849,11 +853,12 @@ void ad936x_iio_custom::monitor_thread_fn() // } else { if (val & 4) { - std::cout << "WARNING: IIO status register reported overflow!\n"; - LOG(INFO) << "WARNING: IIO status register reported overflow!"; + std::cout + << TEXT_BOLD_RED + << "WARNING: IIO status register reported overflow!\n"; + LOG(WARNING) << "WARNING: IIO status register reported overflow!"; } - /* Clear bits */ if (val) { @@ -867,6 +872,7 @@ void ad936x_iio_custom::monitor_thread_fn() return; } + void ad936x_iio_custom::stop_record() { receive_samples = false; @@ -915,6 +921,7 @@ void ad936x_iio_custom::PlutoTxEnable(bool txon) } } + void ad936x_iio_custom::setPlutoGpo(int p) { char pins[11]; @@ -953,7 +960,6 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) // 1 Enable // X Enable Mask if Identifier=0xF - if (check_device() == false) return false; // int plutoGpo = 0; int ret; @@ -1006,6 +1012,8 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return true; } + + void ad936x_iio_custom::get_PPS_timestamp() { GnssTime tow; @@ -1042,7 +1050,6 @@ void ad936x_iio_custom::get_PPS_timestamp() // record pps rise samplestamp associated to the absolute sample counter // PPS rising edge must be associated with the corresponding uBlox time message (tx once a second) - if (GnssTime_queue->timed_wait_and_pop(tow, 2000) == false) { if (receive_samples == true) @@ -1073,6 +1080,8 @@ void ad936x_iio_custom::get_PPS_timestamp() } } } + + bool ad936x_iio_custom::start_sample_rx(bool ppsmode) { // using queues of smart pointers to preallocated buffers @@ -1118,9 +1127,7 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) // start sample overflow detector overflow_monitor_thread = std::thread(&ad936x_iio_custom::monitor_thread_fn, this); - // start PPS and GNSS Time capture thread - if (ppsmode == true) { capture_time_thread = std::thread(&ad936x_iio_custom::get_PPS_timestamp, this); @@ -1128,16 +1135,19 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) return true; } + void ad936x_iio_custom::pop_sample_buffer(std::shared_ptr ¤t_buffer) { used_buffers.wait_and_pop(current_buffer); } + void ad936x_iio_custom::push_sample_buffer(std::shared_ptr ¤t_buffer) { free_buffers.push(current_buffer); } + void ad936x_iio_custom::capture(const std::vector &channels) { if (check_device() == false) return; diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 0396b1e25..cb77ec515 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -9,36 +9,42 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${GNSSSDR_SOURCE_DIR}/docs/protobuf/ add_subdirectory(supl) set(CORE_LIBS_SOURCES - ini.cc - INIReader.cc - string_converter.cc - gnss_sdr_supl_client.cc - gnss_sdr_sample_counter.cc - channel_status_msg_receiver.cc channel_event.cc + channel_status_msg_receiver.cc command_event.cc galileo_e6_has_msg_receiver.cc + galileo_tow_map.cc + gnss_crypto.cc + gnss_sdr_sample_counter.cc + gnss_sdr_supl_client.cc + ini.cc + INIReader.cc nav_message_monitor.cc nav_message_udp_sink.cc - galileo_tow_map.cc + osnma_helper.cc osnma_msg_receiver.cc + osnma_nav_data_manager.cc + string_converter.cc ) set(CORE_LIBS_HEADERS + channel_event.h + channel_status_msg_receiver.h + command_event.h + galileo_tow_map.h + gnss_crypto.h + gnss_sdr_sample_counter.h + gnss_sdr_supl_client.h ini.h INIReader.h - string_converter.h - gnss_sdr_supl_client.h - gnss_sdr_sample_counter.h - channel_status_msg_receiver.h - channel_event.h - command_event.h + nav_message_monitor.h nav_message_packet.h nav_message_udp_sink.h - serdes_nav_message.h - nav_message_monitor.h - galileo_tow_map.h + osnma_helper.h osnma_msg_receiver.h + osnma_nav_data_manager.h + serdes_nav_message.h + string_converter.h ) if(ENABLE_FPGA) @@ -96,6 +102,7 @@ target_link_libraries(core_libs PRIVATE algorithms_libs Boost::serialization + Boost::system Pugixml::pugixml ) @@ -123,6 +130,10 @@ target_include_directories(core_libs ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) +# links to the appropriate library and defines +# USE_GNUTLS_FALLBACK, USE_OPENSSL_3, or USE_OPENSSL_111 accordingly. +link_to_crypto_dependencies(core_libs) + if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/libs/gnss_crypto.cc similarity index 99% rename from src/core/system_parameters/gnss_crypto.cc rename to src/core/libs/gnss_crypto.cc index d92a62224..cbe4785ff 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/libs/gnss_crypto.cc @@ -205,7 +205,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag { if (!have_public_key()) { - LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; + LOG(WARNING) << "Signature verification error: Public key is not available"; return false; } std::vector digest = this->compute_SHA_256(message); @@ -344,7 +344,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag { if (!have_public_key()) { - LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; + LOG(WARNING) << "Signature verification error: Public key is not available"; return false; } @@ -797,7 +797,7 @@ std::string Gnss_Crypto::get_public_key_type() const { if (d_PublicKeyType.empty()) { - return std::string("Unknown"); + return {"Unknown"}; } return d_PublicKeyType; } diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/libs/gnss_crypto.h similarity index 99% rename from src/core/system_parameters/gnss_crypto.h rename to src/core/libs/gnss_crypto.h index e197d61d0..b308f820b 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/libs/gnss_crypto.h @@ -31,7 +31,7 @@ /** \addtogroup Core * \{ */ -/** \addtogroup System_Parameters +/** \addtogroup Core_Receiver_Library * \{ */ /*! diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/libs/osnma_helper.cc similarity index 100% rename from src/core/system_parameters/osnma_helper.cc rename to src/core/libs/osnma_helper.cc diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/libs/osnma_helper.h similarity index 97% rename from src/core/system_parameters/osnma_helper.h rename to src/core/libs/osnma_helper.h index c6b367664..a7b2cc332 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/libs/osnma_helper.h @@ -25,7 +25,7 @@ /** \addtogroup Core * \{ */ -/** \addtogroup System_Parameters +/** \addtogroup Core_Receiver_Library * \{ */ class Osnma_Helper diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/libs/osnma_nav_data_manager.cc similarity index 83% rename from src/core/system_parameters/osnma_nav_data_manager.cc rename to src/core/libs/osnma_nav_data_manager.cc index 9d5017aec..6d8a16113 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.cc +++ b/src/core/libs/osnma_nav_data_manager.cc @@ -1,23 +1,22 @@ /*! -* \file osnma_nav_data_manager.cc -* \brief Class for Galileo OSNMA navigation data management -* \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ + * \file osnma_nav_data_manager.cc + * \brief Class for Galileo OSNMA navigation data management + * \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ #include "osnma_nav_data_manager.h" #if USE_GLOG_AND_GFLAGS #include // for DLOG -#include #else #include #endif @@ -54,18 +53,20 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& if (have_PRNd_nav_data(tag.second.PRN_d)) { std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; - for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { std::string nav_data; if (tag.second.ADKD == 0 || tag.second.ADKD == 12) { nav_data = tow_it.second.get_ephemeris_data(); } - else if (tag.second.ADKD == 4){ + else if (tag.second.ADKD == 4) + { nav_data = tow_it.second.get_utc_data(); } // find associated OSNMA_NavData - if (tag.second.nav_data == nav_data){ + if (tag.second.nav_data == nav_data) + { _satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; } } @@ -138,16 +139,17 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) { auto prn_it = _satellite_nav_data.find(tag.PRN_d); - if (prn_it == _satellite_nav_data.end()){ + if (prn_it == _satellite_nav_data.end()) + { return ""; } // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition - if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30) + if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30) { if (tag.ADKD == 0 || tag.ADKD == 12) { @@ -156,9 +158,8 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) return tow_it.second.get_ephemeris_data(); } } - else if(tag.ADKD == 4) + else if (tag.ADKD == 4) { - if (!tow_it.second.get_utc_data().empty()) { return tow_it.second.get_utc_data(); @@ -179,17 +180,22 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) */ bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { - if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ + if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()) + { for (auto& data_timestamp : _satellite_nav_data[PRNd]) { - if (nav_bits.size() == EPH_SIZE){ - if (data_timestamp.second.get_ephemeris_data() == nav_bits){ + if (nav_bits.size() == EPH_SIZE) + { + if (data_timestamp.second.get_ephemeris_data() == nav_bits) + { data_timestamp.second.update_last_received_timestamp(TOW); return true; } } - else if (nav_bits.size() == UTC_SIZE){ - if (data_timestamp.second.get_utc_data() == nav_bits){ + else if (nav_bits.size() == UTC_SIZE) + { + if (data_timestamp.second.get_utc_data() == nav_bits) + { data_timestamp.second.update_last_received_timestamp(TOW); return true; } @@ -208,15 +214,16 @@ bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const { auto prn_it = _satellite_nav_data.find(t.PRN_d); - if (prn_it == _satellite_nav_data.end()){ + if (prn_it == _satellite_nav_data.end()) + { return false; } // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition - if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30) + if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30) { if (t.ADKD == 0 || t.ADKD == 12) { @@ -240,10 +247,12 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const void OSNMA_nav_data_Manager::print_status() { - for (const auto& satellite : _satellite_nav_data){ + for (const auto& satellite : _satellite_nav_data) + { LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first; const auto& tow_data = satellite.second; - for (const auto& nav_data : tow_data) { + for (const auto& nav_data : tow_data) + { LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase << std::bitset<10>(nav_data.second.IOD_nav) << ", TOW_start=" diff --git a/src/core/system_parameters/osnma_nav_data_manager.h b/src/core/libs/osnma_nav_data_manager.h similarity index 61% rename from src/core/system_parameters/osnma_nav_data_manager.h rename to src/core/libs/osnma_nav_data_manager.h index 98b3d523f..6a64416d1 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.h +++ b/src/core/libs/osnma_nav_data_manager.h @@ -1,27 +1,32 @@ /*! -* \file osnma_nav_data_manager.h -* \brief Class for Galileo OSNMA navigation data management -* \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ + * \file osnma_nav_data_manager.h + * \brief Class for Galileo OSNMA navigation data management + * \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ #ifndef GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H #define GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H #include "osnma_data.h" // NavData -#include // uint32_t +#include // uint32_t #include -#include #include +#include + +/** \addtogroup Core + * \{ */ +/** \addtogroup Core_Receiver_Library + * \{ */ /** * @class OSNMA_nav_data_Manager @@ -29,11 +34,12 @@ * @details It does good stuff * @remarks throw it whatever, it will improve it. Does good stuff */ -class OSNMA_nav_data_Manager{ +class OSNMA_nav_data_Manager +{ public: OSNMA_nav_data_Manager() = default; bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); - bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); + bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); bool have_nav_data(const Tag& t) const; void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list std::string get_navigation_data(const Tag& t); @@ -41,6 +47,7 @@ public: void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); std::vector get_verified_data(); void print_status(); + private: bool have_PRNd_nav_data(uint32_t PRNd); @@ -50,4 +57,7 @@ private: const uint16_t UTC_SIZE{141}; const uint16_t MAX_ALLOWED_SIZE{150}; // arbitrary maximum for the navigation data container }; + +/** \} */ +/** \} */ #endif // GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 502a5ed48..98526fe60 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -46,6 +46,7 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, : gr::block("gnss_synchro_monitor", gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), gr::io_signature::make(0, 0, 0)), + count(0), d_nchannels(n_channels), d_decimation_factor(decimation_factor) { @@ -73,7 +74,6 @@ int gnss_synchro_monitor::general_work(int noutput_items __attribute__((unused)) for (int channel_index = 0; channel_index < d_nchannels; channel_index++) { // Loop through each item in each input stream channel - int count = 0; for (int item_index = 0; item_index < ninput_items[channel_index]; item_index++) { // Use the count variable to limit how many items are sent per channel diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index b45b7cc5b..64749a001 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -71,9 +71,10 @@ private: const std::vector& udp_addresses, bool enable_protobuf); + std::unique_ptr udp_sink_ptr; + int count; int d_nchannels; int d_decimation_factor; - std::unique_ptr udp_sink_ptr; }; diff --git a/src/core/receiver/concurrent_map.h b/src/core/receiver/concurrent_map.h index 330ab02ef..d16a963d7 100644 --- a/src/core/receiver/concurrent_map.h +++ b/src/core/receiver/concurrent_map.h @@ -36,52 +36,48 @@ template */ class Concurrent_Map { - typedef typename std::map::iterator Data_iterator; // iterator is scope dependent public: void write(int key, Data const& data) { - std::unique_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); + std::lock_guard lock(the_mutex); + auto data_iter = the_map.find(key); if (data_iter != the_map.end()) { data_iter->second = data; // update } else { - the_map.insert(std::pair(key, data)); // insert SILENTLY fails if the item already exists in the map! + the_map.insert(std::pair(key, data)); // insert does not overwrite if the item already exists in the map! } - lock.unlock(); } - std::map get_map_copy() + std::map get_map_copy() const& { - std::unique_lock lock(the_mutex); - std::map map_aux = the_map; - lock.unlock(); - return map_aux; + std::lock_guard lock(the_mutex); + return the_map; // This implicitly creates a copy } - size_t size() + std::map get_map_copy() && { - std::unique_lock lock(the_mutex); - size_t size_ = the_map.size(); - lock.unlock(); - return size_; + std::lock_guard lock(the_mutex); + return std::move(the_map); } - bool read(int key, Data& p_data) + size_t size() const { - std::unique_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); + std::lock_guard lock(the_mutex); + return the_map.size(); + } + + bool read(int key, Data& p_data) const + { + std::lock_guard lock(the_mutex); + auto data_iter = the_map.find(key); if (data_iter != the_map.end()) { p_data = data_iter->second; - lock.unlock(); return true; } - lock.unlock(); return false; } diff --git a/src/core/receiver/concurrent_queue.h b/src/core/receiver/concurrent_queue.h index ac7be0f17..ed4e68b0a 100644 --- a/src/core/receiver/concurrent_queue.h +++ b/src/core/receiver/concurrent_queue.h @@ -19,9 +19,10 @@ #include #include +#include #include #include -#include +#include /** \addtogroup Core * \{ */ @@ -33,48 +34,53 @@ template /*! * \brief This class implements a thread-safe std::queue - * - * Thread-safe object queue which uses the library - * boost_thread to perform MUTEX based on the code available at - * https://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html */ class Concurrent_Queue { public: - void push(Data const& data) + void push(const Data& data) { - std::unique_lock lock(the_mutex); - the_queue.push(data); - lock.unlock(); + { + std::lock_guard lock(the_mutex); + the_queue.push(data); + } the_condition_variable.notify_one(); } - bool empty() const + void push(Data&& data) { - std::unique_lock lock(the_mutex); - return the_queue.empty(); + { + std::lock_guard lock(the_mutex); + the_queue.push(std::move(data)); + } + the_condition_variable.notify_one(); } - size_t size() const + bool empty() const noexcept { - std::unique_lock lock(the_mutex); + return size() == 0; + } + + size_t size() const noexcept + { + std::lock_guard lock(the_mutex); return the_queue.size(); } void clear() { - std::unique_lock lock(the_mutex); - the_queue = std::queue(); + std::lock_guard lock(the_mutex); + std::queue().swap(the_queue); } bool try_pop(Data& popped_value) { - std::unique_lock lock(the_mutex); + std::lock_guard lock(the_mutex); if (the_queue.empty()) { return false; } - popped_value = the_queue.front(); + popped_value = std::move(the_queue.front()); the_queue.pop(); return true; } @@ -82,26 +88,21 @@ public: void wait_and_pop(Data& popped_value) { std::unique_lock lock(the_mutex); - while (the_queue.empty()) - { - the_condition_variable.wait(lock); - } - popped_value = the_queue.front(); + the_condition_variable.wait(lock, [this] { return !the_queue.empty(); }); + popped_value = std::move(the_queue.front()); the_queue.pop(); } bool timed_wait_and_pop(Data& popped_value, int wait_ms) { std::unique_lock lock(the_mutex); - if (the_queue.empty()) + if (!the_condition_variable.wait_for(lock, + std::chrono::milliseconds(wait_ms), + [this] { return !the_queue.empty(); })) { - the_condition_variable.wait_for(lock, std::chrono::milliseconds(wait_ms)); - if (the_queue.empty()) - { - return false; - } + return false; } - popped_value = the_queue.front(); + popped_value = std::move(the_queue.front()); the_queue.pop(); return true; } diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1a48e0a7f..dda8452a8 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -113,6 +113,7 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" +#include // for exit #include // for exception #include // for cerr #include // for move diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index b0e3dc418..0d1606924 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -49,6 +49,7 @@ #include // for transform, sort, unique #include // for floor #include // for size_t +#include // for exit #include // for exception #include // for operator<< #include // for insert_iterator, inserter @@ -144,9 +145,9 @@ void GNSSFlowgraph::init() sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated); // Avoid segmentation fault caused by wrong configuration - if (sources_count_ == 2 && block_factory->GetSignalSource(configuration_.get(), queue_.get(), 0)->implementation() == "Multichannel_File_Signal_Source") + if (sources_count_ == 2 && configuration_->property("SignalSource.implementation", std::string("")) == "Multichannel_File_Signal_Source") { - std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuraiion file\n"; + std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuration file\n"; std::cout << " if you are using the Multichannel_File_Signal_Source implementation.\n"; sources_count_ = 1; } @@ -156,7 +157,13 @@ void GNSSFlowgraph::init() for (int i = 0; i < sources_count_; i++) { DLOG(INFO) << "Creating source " << i; - sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i)); + auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), i); + if (!check_not_nullptr) + { + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + sig_source_.push_back(std::move(check_not_nullptr)); if (enable_fpga_offloading_ == false) { auto& src = sig_source_.back(); diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 5e42732c7..f2c5efce1 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -7,7 +7,6 @@ set(SYSTEM_PARAMETERS_SOURCES gnss_almanac.cc - gnss_crypto.cc gnss_ephemeris.cc gnss_satellite.cc gnss_signal.cc @@ -31,13 +30,10 @@ set(SYSTEM_PARAMETERS_SOURCES reed_solomon.cc osnma_data.cc osnma_dsm_reader.cc - osnma_helper.cc - osnma_nav_data_manager.cc ) set(SYSTEM_PARAMETERS_HEADERS gnss_almanac.h - gnss_crypto.h gnss_ephemeris.h gnss_satellite.h gnss_signal.h @@ -98,8 +94,6 @@ set(SYSTEM_PARAMETERS_HEADERS Galileo_OSNMA.h osnma_data.h osnma_dsm_reader.h - osnma_helper.h - osnma_nav_data_manager.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) @@ -142,10 +136,6 @@ target_include_directories(core_system_parameters ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) -# links to the appropriate library and defines -# USE_GNUTLS_FALLBACK, USE_OPENSSL_3, or USE_OPENSSL_111 accordingly. -link_to_crypto_dependencies(core_system_parameters) - if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(core_system_parameters diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 052a23921..7bf85862c 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -40,6 +40,7 @@ public: bool reserved{}; }; + class DSM_dsm_header { public: @@ -48,6 +49,7 @@ public: uint8_t dsm_block_id{}; }; + class MACK_header { public: @@ -57,6 +59,7 @@ public: uint8_t cop{}; }; + class MACK_tag_info { public: @@ -66,6 +69,7 @@ public: uint8_t cop{}; }; + class MACK_tag_and_info { public: @@ -75,6 +79,7 @@ public: uint32_t counter; // CTR }; + class DSM_PKR_message { public: @@ -89,6 +94,7 @@ public: uint8_t npktid{}; }; + class DSM_KROOT_message { public: @@ -112,6 +118,7 @@ public: uint8_t towh_k{}; }; + class MACK_message { public: @@ -124,33 +131,38 @@ public: uint32_t PRNa; }; + class OSNMA_NavData { public: - OSNMA_NavData(): nav_data_id(id_counter++){} - bool have_this_bits(std::string nav_data); - bool add_nav_data(const std::string& nav_data); - void update_last_received_timestamp(uint32_t TOW); - const uint32_t nav_data_id; - uint32_t verified_bits{0}; - uint32_t get_tow_sf0() const {return TOW_sf0;} - void set_tow_sf0(int value) {TOW_sf0 = value;} - uint32_t last_received_TOW{0}; - uint32_t IOD_nav{0}; + OSNMA_NavData() : nav_data_id(id_counter++) {} + std::string get_utc_data() const; std::string get_ephemeris_data() const; - void set_ephemeris_data(std::string value) {d_ephemeris_iono = value;} - void set_utc_data(std::string value) {d_utc = value;} + uint32_t get_tow_sf0() const { return TOW_sf0; } + + const uint32_t nav_data_id; + + bool have_this_bits(std::string nav_data); + bool add_nav_data(const std::string& nav_data); bool verified{false}; + + void update_last_received_timestamp(uint32_t TOW); + void set_tow_sf0(int value) { TOW_sf0 = value; } + void set_ephemeris_data(std::string value) { d_ephemeris_iono = value; } + void set_utc_data(std::string value) { d_utc = value; } + + uint32_t verified_bits{0}; + uint32_t last_received_TOW{0}; + uint32_t IOD_nav{0}; uint32_t PRNd{0}; uint32_t ADKD{}; + private: std::string d_ephemeris_iono{""}; std::string d_utc{""}; uint32_t TOW_sf0{0}; - - - uint32_t static id_counter; + static uint32_t id_counter; }; /*! @@ -224,6 +236,8 @@ public: uint32_t skipped; std::string nav_data; }; + /** \} */ /** \} */ + #endif // GNSS_SDR_OSNMA_DATA_H diff --git a/src/tests/benchmarks/CMakeLists.txt b/src/tests/benchmarks/CMakeLists.txt index 74607d1a1..2d79f4d06 100644 --- a/src/tests/benchmarks/CMakeLists.txt +++ b/src/tests/benchmarks/CMakeLists.txt @@ -111,7 +111,7 @@ endif() add_benchmark(benchmark_atan2 Gnuradio::runtime) add_benchmark(benchmark_copy) -add_benchmark(benchmark_crypto core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_crypto core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) diff --git a/src/tests/benchmarks/benchmark_crypto.cc b/src/tests/benchmarks/benchmark_crypto.cc index 2adc95348..ec1945ab9 100644 --- a/src/tests/benchmarks/benchmark_crypto.cc +++ b/src/tests/benchmarks/benchmark_crypto.cc @@ -106,26 +106,12 @@ void bm_verify_ecdsa_p256(benchmark::State& state) 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - // PEM format + // compressed ECDSA P-256 format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, - 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, - 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, - 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, - 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, - 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, - 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, - 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, - 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, - 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, - 0x2B, 0x37, 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, - 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, - 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, - 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, - 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, - 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, - 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, - 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, + 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, + 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, + 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); @@ -146,50 +132,34 @@ void bm_verify_ecdsa_p521(benchmark::State& state) // Message to be verified std::vector message = { - 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64}; + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // "Hello world\n" - // Public key in PEM format + // Public key in compressed X format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, - 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, - 0x2D, 0x2D, 0x0A, 0x4D, 0x49, 0x47, 0x62, 0x4D, 0x42, 0x41, 0x47, 0x42, - 0x79, 0x71, 0x47, 0x53, 0x4D, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, - 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, 0x6A, 0x41, 0x34, 0x47, 0x47, 0x41, - 0x41, 0x51, 0x41, 0x6F, 0x35, 0x76, 0x77, 0x66, 0x6E, 0x47, 0x57, 0x47, - 0x33, 0x44, 0x63, 0x59, 0x75, 0x2B, 0x2F, 0x61, 0x58, 0x47, 0x32, 0x7A, - 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0A, 0x48, 0x36, 0x4C, 0x76, - 0x4F, 0x4C, 0x76, 0x49, 0x51, 0x6A, 0x61, 0x2B, 0x6A, 0x74, 0x57, 0x73, - 0x70, 0x4F, 0x38, 0x37, 0x6F, 0x50, 0x32, 0x4E, 0x6D, 0x72, 0x34, 0x6E, - 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4D, 0x37, 0x6A, 0x49, 0x69, - 0x46, 0x38, 0x47, 0x70, 0x6B, 0x75, 0x58, 0x6A, 0x75, 0x4E, 0x7A, 0x34, - 0x72, 0x61, 0x56, 0x4F, 0x65, 0x49, 0x4D, 0x42, 0x77, 0x45, 0x2B, 0x61, - 0x0A, 0x30, 0x4C, 0x76, 0x7A, 0x37, 0x69, 0x54, 0x4D, 0x5A, 0x46, 0x41, - 0x41, 0x51, 0x64, 0x2B, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, - 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, 0x5A, 0x35, 0x77, - 0x30, 0x38, 0x51, 0x4F, 0x43, 0x58, 0x2F, 0x75, 0x46, 0x65, 0x2B, 0x30, - 0x78, 0x52, 0x78, 0x4C, 0x64, 0x2F, 0x33, 0x36, 0x42, 0x4E, 0x74, 0x63, - 0x74, 0x69, 0x2F, 0x45, 0x4C, 0x0A, 0x4B, 0x31, 0x35, 0x67, 0x2B, 0x4B, - 0x32, 0x71, 0x67, 0x2F, 0x6C, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4D, 0x2B, - 0x51, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, - 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x00, 0x28, 0x35, 0xBB, 0xE9, 0x24, 0x59, 0x4E, 0xF0, + 0xE3, 0xA2, 0xDB, 0xC0, 0x49, 0x30, 0x60, 0x7C, 0x61, 0x90, + 0xE4, 0x03, 0xE0, 0xC7, 0xB8, 0xC2, 0x62, 0x37, 0xF7, 0x58, + 0x56, 0xBE, 0x63, 0x5C, 0x97, 0xF7, 0x53, 0x64, 0x7E, 0xE1, + 0x0C, 0x07, 0xD3, 0x97, 0x8D, 0x58, 0x46, 0xFD, 0x6E, 0x06, + 0x44, 0x01, 0xA7, 0xAA, 0xC4, 0x95, 0x13, 0x5D, 0xC9, 0x77, + 0x26, 0xE9, 0xF8, 0x72, 0x0C, 0xD3, 0x88}; // ECDSA P-521 signature, raw format std::vector signature = { - 0x01, 0x7B, 0x59, 0xAC, 0x3A, 0x03, 0x5C, 0xB4, 0x07, 0xCD, - 0xC1, 0xEB, 0xBE, 0xE5, 0xA6, 0xCB, 0xDA, 0x0A, 0xFF, 0x4D, - 0x38, 0x61, 0x16, 0x0F, 0xB3, 0x77, 0xE5, 0x8A, 0xDC, 0xF3, - 0xFD, 0x79, 0x38, 0x1E, 0xE8, 0x08, 0x3D, 0x5D, 0xBC, 0xC2, - 0x80, 0x6E, 0xE9, 0x2B, 0xC3, 0xEF, 0x07, 0x3D, 0x0C, 0x82, - 0x4C, 0x9B, 0x7A, 0x5C, 0x2E, 0xD5, 0x46, 0xBD, 0x22, 0x21, - 0x13, 0x8A, 0xB2, 0xCA, 0x96, 0x3D, 0x01, 0xBA, 0x2A, 0xC4, - 0x3F, 0xDB, 0x66, 0x3C, 0x40, 0x26, 0xD9, 0xBC, 0x26, 0xD5, - 0x57, 0xD4, 0xBD, 0x15, 0x16, 0x88, 0x21, 0x3B, 0xAA, 0x07, - 0x89, 0xEF, 0x29, 0x8F, 0x2F, 0x85, 0x76, 0x58, 0x9D, 0xCA, - 0x00, 0xCC, 0xC8, 0x30, 0x88, 0x31, 0x99, 0xC1, 0x94, 0xB9, - 0xAF, 0x91, 0xDC, 0xC4, 0x6F, 0x19, 0x2B, 0x12, 0xA2, 0x82, - 0xA5, 0x66, 0x5E, 0x4B, 0xBB, 0xDF, 0x65, 0x81, 0x52, 0x14, - 0x01, 0xD7}; + 0x01, 0x5C, 0x23, 0xC0, 0xBE, 0xAD, 0x1E, 0x44, 0x60, 0xD4, + 0xE0, 0x81, 0x38, 0xF2, 0xBA, 0xF5, 0xB5, 0x37, 0x5A, 0x34, + 0xB5, 0xCA, 0x6B, 0xC8, 0x0F, 0xCD, 0x75, 0x1D, 0x5E, 0xC0, + 0x8A, 0xD3, 0xD7, 0x79, 0xA7, 0xC1, 0xB8, 0xA2, 0xC6, 0xEA, + 0x5A, 0x7D, 0x60, 0x66, 0x50, 0x97, 0x37, 0x6C, 0xF9, 0x0A, + 0xF6, 0x3D, 0x77, 0x9A, 0xE2, 0x19, 0xF7, 0xF9, 0xDD, 0x52, + 0xC4, 0x0F, 0x98, 0xAA, 0xA2, 0xA4, 0x01, 0xC9, 0x41, 0x0B, + 0xD0, 0x25, 0xDD, 0xC9, 0x7C, 0x3F, 0x70, 0x32, 0x23, 0xCF, + 0xFE, 0x37, 0x67, 0x3A, 0xBC, 0x0B, 0x76, 0x16, 0x82, 0x83, + 0x27, 0x3D, 0x1D, 0x19, 0x15, 0x78, 0x08, 0x2B, 0xD4, 0xA7, + 0xC2, 0x0F, 0x11, 0xF4, 0xDD, 0xE5, 0x5A, 0x5D, 0x04, 0x8D, + 0x6D, 0x5E, 0xC4, 0x1F, 0x54, 0x44, 0xA9, 0x13, 0x34, 0x71, + 0x0F, 0xF7, 0x57, 0x9A, 0x9F, 0x2E, 0xF4, 0x97, 0x7D, 0xAE, + 0x28, 0xEF}; d_crypto->set_public_key(publicKey);