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,90 @@
|
||||
#ifndef PUBLIC_KEY_HPP_DRZFSERF
|
||||
#define PUBLIC_KEY_HPP_DRZFSERF
|
||||
|
||||
#include <vanetza/security/v2/ecc_point.hpp>
|
||||
#include <boost/variant/variant.hpp>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
namespace security
|
||||
{
|
||||
namespace v2
|
||||
{
|
||||
|
||||
/// SymmetricAlgorithm specified in TS 103 097 v1.2.1, section 4.2.3
|
||||
enum class SymmetricAlgorithm : uint8_t
|
||||
{
|
||||
AES128_CCM = 0
|
||||
};
|
||||
|
||||
/// PublicKeyAlgorithm specified in TS 103 097 v1.2.1, section 4.2.2
|
||||
enum class PublicKeyAlgorithm : uint8_t
|
||||
{
|
||||
ECDSA_NISTP256_With_SHA256 = 0,
|
||||
ECIES_NISTP256 = 1
|
||||
};
|
||||
|
||||
/// ecdsa_nistp256_with_sha256 specified in TS 103 097 v1.2.1, section 4.2.4
|
||||
struct ecdsa_nistp256_with_sha256
|
||||
{
|
||||
EccPoint public_key;
|
||||
};
|
||||
|
||||
/// ecies_nistp256 specified in TS 103 097 v1.2.1, section 4.2.4
|
||||
struct ecies_nistp256
|
||||
{
|
||||
SymmetricAlgorithm supported_symm_alg;
|
||||
EccPoint public_key;
|
||||
};
|
||||
|
||||
/// Profile specified in TS 103 097 v1.2.1, section 4.2.4
|
||||
using PublicKey = boost::variant<ecdsa_nistp256_with_sha256, ecies_nistp256>;
|
||||
|
||||
/**
|
||||
* \brief Determines PublicKeyAlgorithm to a given PublicKey
|
||||
* \param public_key
|
||||
* \return algorithm type
|
||||
*/
|
||||
PublicKeyAlgorithm get_type(const PublicKey&);
|
||||
|
||||
/**
|
||||
* \brief Calculates size of a PublicKey
|
||||
* \param public_key
|
||||
* \return number of octets needed to serialize the PublicKey
|
||||
*/
|
||||
size_t get_size(const PublicKey&);
|
||||
|
||||
/**
|
||||
* \brief Deserializes a PublicKey from a binary archive
|
||||
* \param ar with a serialized PublicKey at the beginning
|
||||
* \param public_key to save deserialized values in
|
||||
* \return size of the deserialized publicKey
|
||||
*/
|
||||
size_t deserialize(InputArchive&, PublicKey&);
|
||||
|
||||
/**
|
||||
* \brief Serializes a PublicKey into a binary archive
|
||||
* \param ar to serialize in
|
||||
* \param public_key to serialize
|
||||
*/
|
||||
void serialize(OutputArchive&, const PublicKey&);
|
||||
|
||||
/**
|
||||
* \brief Determines field size related to algorithm
|
||||
* \param public_key_algorithm
|
||||
* \return required buffer size for related fields
|
||||
* */
|
||||
std::size_t field_size(PublicKeyAlgorithm);
|
||||
|
||||
/**
|
||||
* \brief Determines field size related to algorithm
|
||||
* \param symmetric_algorithm
|
||||
* \return required buffer size for related fields
|
||||
*/
|
||||
std::size_t field_size(SymmetricAlgorithm);
|
||||
|
||||
} // namespace v2
|
||||
} // namespace security
|
||||
} // namespace vanetza
|
||||
|
||||
#endif /* PUBLIC_KEY_HPP_DRZFSERF */
|
||||
Reference in New Issue
Block a user