Keep the colleague's microbu-esp32c5 tree in this repository
obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#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 */
|
||||
Reference in New Issue
Block a user