20 #ifndef lime_double_ratchet_protocol_hpp
21 #define lime_double_ratchet_protocol_hpp
27 namespace double_ratchet_protocol {
68 template <
typename Curve>
69 constexpr
size_t headerSize(uint8_t messageType) noexcept {
85 template <
typename Curve>
86 constexpr
size_t X3DHinitSize(
bool haveOPk,
typename std::enable_if_t<!std::is_base_of_v<genericKEM, Curve>,
bool> =
true) noexcept {
98 template <
typename Algo>
99 constexpr
size_t X3DHinitSize(
bool haveOPk,
typename std::enable_if_t<std::is_base_of_v<genericKEM, Algo>,
bool> =
true) noexcept {
108 template <
typename Curve>
110 template <
typename Algo>
112 template <
typename Curve>
114 template <
typename Algo>
117 template <
typename Curve>
122 #ifdef EC25519_ENABLED
125 extern template bool parseMessage_get_X3DHinit<C255>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
131 extern template bool parseMessage_get_X3DHinit<C448>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
136 #ifdef EC25519_ENABLED
139 extern template bool parseMessage_get_X3DHinit<C255K512>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
143 extern template bool parseMessage_get_X3DHinit<C255MLK512>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
148 extern template bool parseMessage_get_X3DHinit<C448MLK1024>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
150 #endif //HAVE_BCTBXPQ
155 #endif // lime_double_ratchet_protocol_hpp
static constexpr size_t ssize(void)
provide a static size function to be able to call the function not on an object
Definition: lime_crypto_primitives.hpp:105
static constexpr size_t ssize(void)
provide a static size function to be able to call the function not on an object
Definition: lime_crypto_primitives.hpp:59
void buildMessage_X3DHinit(std::vector< uint8_t > &message, const DSA< Curve, lime::DSAtype::publicKey > &Ik, const X< Curve, lime::Xtype::publicKey > &Ek, const uint32_t SPk_id, const uint32_t OPk_id, const bool OPk_flag) noexcept
build an X3DH init message to insert in DR header EC only version
Definition: lime_double_ratchet_protocol.cpp:87
Definition: lime_double_ratchet.hpp:46
Base buffer definition for KEM data structure.
Definition: lime_crypto_primitives.hpp:102
constexpr size_t headerSize(uint8_t messageType) noexcept
return the size of the double ratchet packet header
Definition: lime_double_ratchet_protocol.hpp:69
DR_message_type
DR message type byte bit mapping.
Definition: lime_double_ratchet_protocol.hpp:48
static constexpr size_t ssize(void)
provide a static size function to be able to call the function not on an object
Definition: lime_crypto_primitives.hpp:151
constexpr size_t X3DHinitSize(bool haveOPk, typename std::enable_if_t<!std::is_base_of_v< genericKEM, Curve >, bool >=true) noexcept
return the size of the X3DH init packet included in the double ratchet packet header ...
Definition: lime_double_ratchet_protocol.hpp:86
void parseMessage_X3DHinit(const std::vector< uint8_t >message, DSA< Curve, lime::DSAtype::publicKey > &Ik, X< Curve, lime::Xtype::publicKey > &Ek, uint32_t &SPk_id, uint32_t &OPk_id, bool &OPk_flag) noexcept
Parse the X3DH init message and extract peer Ik, peer Ek, self SPk id and seld OPk id if present This...
Definition: lime_double_ratchet_protocol.cpp:166
DR_X3DH_OPk_flag
haveOPk byte from X3DH init message mapping
Definition: lime_double_ratchet_protocol.hpp:56
constexpr size_t DRPkIndexSize
Definition: lime_defines.hpp:81
bool parseMessage_get_X3DHinit(const std::vector< uint8_t > &message, std::vector< uint8_t > &X3DH_initMessage) noexcept
check the message for presence of X3DH init in the header, extract it if there is one ...
Definition: lime_double_ratchet_protocol.cpp:248
constexpr uint8_t DR_v01
Definition: lime_double_ratchet_protocol.hpp:30