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,107 @@
|
||||
#ifndef SIGNER_INFO_HPP_9K6GXK4R
|
||||
#define SIGNER_INFO_HPP_9K6GXK4R
|
||||
|
||||
#include <vanetza/security/v2/basic_elements.hpp>
|
||||
#include <vanetza/security/v2/public_key.hpp>
|
||||
#include <boost/variant/recursive_wrapper.hpp>
|
||||
#include <boost/variant/variant.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
namespace security
|
||||
{
|
||||
namespace v2
|
||||
{
|
||||
|
||||
struct Certificate;
|
||||
|
||||
/// described in TS 103 097 v1.2.1, section 4.2.11
|
||||
enum class SignerInfoType : uint8_t
|
||||
{
|
||||
Self = 0, // nothing -> nullptr_t
|
||||
Certificate_Digest_With_SHA256 = 1, // HashedId8
|
||||
Certificate = 2, // Certificate
|
||||
Certificate_Chain = 3, // std::list<Certificate>
|
||||
Certificate_Digest_With_Other_Algorithm = 4 // CertificateDigestWithOtherAlgorithm
|
||||
};
|
||||
|
||||
/// described in TS 103 097 v1.2.1, section 4.2.10
|
||||
struct CertificateDigestWithOtherAlgorithm
|
||||
{
|
||||
PublicKeyAlgorithm algorithm;
|
||||
HashedId8 digest;
|
||||
};
|
||||
|
||||
/// described in TS 103 097 v1.2.1, section 4.2.10
|
||||
using SignerInfo = boost::variant<
|
||||
std::nullptr_t,
|
||||
HashedId8,
|
||||
boost::recursive_wrapper<Certificate>,
|
||||
std::list<Certificate>,
|
||||
CertificateDigestWithOtherAlgorithm
|
||||
>;
|
||||
|
||||
/**
|
||||
* \brief Determines SignerInfoType of SignerInfo
|
||||
* \param SignerInfo
|
||||
* \return SignerInfoType
|
||||
*/
|
||||
SignerInfoType get_type(const SignerInfo&);
|
||||
|
||||
/**
|
||||
* \brief Calculates size of an CertificateDigestWithOtherAlgorithm
|
||||
* \param CertificateDigestWithOtherAlgorithm
|
||||
* \return number of octets needed to serialize the CertificateDigestWithOtherAlgorithm
|
||||
*/
|
||||
size_t get_size(const CertificateDigestWithOtherAlgorithm&);
|
||||
|
||||
/**
|
||||
* \brief Calculates size of an SignerInfo
|
||||
* \param SignerInfo
|
||||
* \return number of octets needed to serialize the SignerInfo
|
||||
*/
|
||||
size_t get_size(const SignerInfo&);
|
||||
|
||||
/**
|
||||
* \brief Serializes an CertificateDigestWithOtherAlgorithm into a binary archive
|
||||
*/
|
||||
void serialize(OutputArchive&, const CertificateDigestWithOtherAlgorithm&);
|
||||
|
||||
/**
|
||||
* \brief Serializes an SignerInfo into a binary archive
|
||||
*/
|
||||
void serialize(OutputArchive&, const SignerInfo&);
|
||||
|
||||
/**
|
||||
* \brief Deserializes an CertificateDigestWithOtherAlgorithm from a binary archive
|
||||
* \param archive with a CertificateDigestWithOtherAlgorithm at the beginning
|
||||
* \param CertificateDigestWithOtherAlgorithm to deserialize
|
||||
* \return size of the deserialized CertificateDigestWithOtherAlgorithm
|
||||
*/
|
||||
size_t deserialize(InputArchive&, CertificateDigestWithOtherAlgorithm&);
|
||||
|
||||
/**
|
||||
* \brief Deserializes an SignerInfo from a binary archive
|
||||
* \param archive with a SignerInfo at the beginning
|
||||
* \param SignerInfo to deserialize
|
||||
* \return size of the deserialized SignerInfo
|
||||
*/
|
||||
size_t deserialize(InputArchive&, SignerInfo&);
|
||||
|
||||
/**
|
||||
* \brief Deserialize SignerInfo of a Certificate from a binary archive
|
||||
* This function rejects SignerInfo types which are invalid for certificates.
|
||||
* \param ar archive with a (legal) SignerInfo at the beginning
|
||||
* \param info SignerInfo to deserialize
|
||||
* \return size of the deserialized SignerInfo
|
||||
*/
|
||||
size_t deserialize_certificate_signer(InputArchive& ar, SignerInfo& info);
|
||||
|
||||
} // namespace v2
|
||||
} // namespace security
|
||||
} // namespace vanetza
|
||||
|
||||
#endif /* SIGNER_INFO_HPP_9K6GXK4R */
|
||||
Reference in New Issue
Block a user