obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
84 lines
1.9 KiB
C++
84 lines
1.9 KiB
C++
#ifndef CFE4DC34_AD31_47E8_9EB2_1B98C6FB0887
|
|
#define CFE4DC34_AD31_47E8_9EB2_1B98C6FB0887
|
|
|
|
#include <vanetza/common/byte_buffer.hpp>
|
|
#include <boost/variant/variant.hpp>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace security
|
|
{
|
|
|
|
// forward declarations
|
|
struct PublicKey;
|
|
namespace ecdsa256 { struct PublicKey; }
|
|
|
|
/// X_Coordinate_Only specified in TS 103 097 v1.2.1 in section 4.2.5
|
|
struct X_Coordinate_Only
|
|
{
|
|
ByteBuffer x;
|
|
};
|
|
|
|
/// Compressed_Lsb_Y_0 specified in TS 103 097 v1.2.1 in section 4.2.5
|
|
struct Compressed_Lsb_Y_0
|
|
{
|
|
ByteBuffer x;
|
|
};
|
|
|
|
/// Compressed_Lsb_Y_1 specified in TS 103 097 v1.2.1 in section 4.2.5
|
|
struct Compressed_Lsb_Y_1
|
|
{
|
|
ByteBuffer x;
|
|
};
|
|
|
|
/// Uncompressed specified in TS 103 097 v1.2.1 in section 4.2.5
|
|
struct Uncompressed
|
|
{
|
|
ByteBuffer x;
|
|
ByteBuffer y;
|
|
};
|
|
|
|
/// EccPoint specified in TS 103 097 v1.2.1 in section 4.2.5
|
|
using EccPoint = boost::variant<
|
|
X_Coordinate_Only,
|
|
Compressed_Lsb_Y_0,
|
|
Compressed_Lsb_Y_1,
|
|
Uncompressed
|
|
>;
|
|
|
|
/**
|
|
* \brief calculate byte length of ECC point structure
|
|
* \param ecc_point
|
|
* \return length in bytes
|
|
*/
|
|
std::size_t get_length(const EccPoint& ecc_point);
|
|
|
|
/**
|
|
* \brief Convert EccPoint for signature calculation
|
|
* Uses ecc_point.x as relevant field for signatures.
|
|
*
|
|
* \param ecc_point
|
|
* \return binary representation of ECC point
|
|
*/
|
|
ByteBuffer convert_for_signing(const EccPoint& ecc_point);
|
|
|
|
/**
|
|
* \brief Convert a public key into an ECC point, preserving its compression
|
|
* \param public_key public key (uncompressed or compressed)
|
|
* \return ECC point matching the key's own point format
|
|
*/
|
|
EccPoint make_ecc_point(const PublicKey& public_key);
|
|
|
|
/**
|
|
* \brief Compressed ECC point from public key
|
|
* \param public_key
|
|
* \return compressed ECC point
|
|
*/
|
|
EccPoint compress_public_key(const PublicKey& public_key);
|
|
EccPoint compress_public_key(const ecdsa256::PublicKey& public_key);
|
|
|
|
} // namespace security
|
|
} // namespace vanetza
|
|
|
|
#endif /* CFE4DC34_AD31_47E8_9EB2_1B98C6FB0887 */
|