Commit 4a3b5f1e authored by johan's avatar johan

Build using clang too

parent 07017dc1
......@@ -38,9 +38,9 @@ using namespace::lime;
namespace lime {
/* Set of constants used as input is several uses of HKDF like function */
/* They MUST be different */
const std::array<std::uint8_t,2> hkdf_rk_info{0x03, 0x01}; //it already includes the expansion index (0x01) used in kdf_rk
const std::array<std::uint8_t,1> hkdf_ck_info{0x02};
const std::array<std::uint8_t,1> hkdf_mk_info{0x01};
const std::array<std::uint8_t,2> hkdf_rk_info{{0x03, 0x01}}; //it already includes the expansion index (0x01) used in kdf_rk
const std::array<std::uint8_t,1> hkdf_ck_info{{0x02}};
const std::array<std::uint8_t,1> hkdf_mk_info{{0x01}};
/****************************************************************************/
/* Helpers functions not part of DR class */
......@@ -160,7 +160,7 @@ namespace lime {
*/
template <typename Curve>
DR<Curve>::DR(lime::Db *localStorage, const DRChainKey &SK, const SharedADBuffer &AD, const X<Curve> &peerPublicKey, long int peerDid, const std::vector<uint8_t> &X3DH_initMessage)
:m_DHr{peerPublicKey},m_DHr_valid{true}, m_DHs{},m_RK{SK},m_CKs{0},m_CKr{0},m_Ns(0),m_Nr(0),m_PN(0),m_sharedAD{AD},m_mkskipped{},
:m_DHr{peerPublicKey},m_DHr_valid{true}, m_DHs{},m_RK{SK},m_CKs{},m_CKr{},m_Ns(0),m_Nr(0),m_PN(0),m_sharedAD{AD},m_mkskipped{},
m_RNG{bctbx_rng_context_new()},m_dbSessionId{0},m_usedNr{0},m_usedDHid{0},m_localStorage{localStorage},m_dirty{DRSessionDbStatus::dirty},m_peerDid{peerDid},
m_active_status{true}, m_X3DH_initMessage{X3DH_initMessage}
{
......@@ -194,7 +194,7 @@ namespace lime {
*/
template <typename Curve>
DR<Curve>::DR(lime::Db *localStorage, const DRChainKey &SK, const SharedADBuffer &AD, const KeyPair<X<Curve>> &selfKeyPair, long int peerDid)
:m_DHr{},m_DHr_valid{false},m_DHs{selfKeyPair},m_RK{SK},m_CKs{0},m_CKr{0},m_Ns(0),m_Nr(0),m_PN(0),m_sharedAD{AD},m_mkskipped{},
:m_DHr{},m_DHr_valid{false},m_DHs{selfKeyPair},m_RK{SK},m_CKs{},m_CKr{},m_Ns(0),m_Nr(0),m_PN(0),m_sharedAD{AD},m_mkskipped{},
m_RNG{bctbx_rng_context_new()},m_dbSessionId{0},m_usedNr{0},m_usedDHid{0},m_localStorage{localStorage},m_dirty{DRSessionDbStatus::dirty},m_peerDid{peerDid},
m_active_status{true}, m_X3DH_initMessage{}
{ }
......@@ -209,7 +209,7 @@ namespace lime {
*/
template <typename Curve>
DR<Curve>::DR(lime::Db *localStorage, long sessionId)
:m_DHr{},m_DHr_valid{true},m_DHs{},m_RK{0},m_CKs{0},m_CKr{0},m_Ns(0),m_Nr(0),m_PN(0),m_sharedAD{0},m_mkskipped{},
:m_DHr{},m_DHr_valid{true},m_DHs{},m_RK{},m_CKs{},m_CKr{},m_Ns(0),m_Nr(0),m_PN(0),m_sharedAD{},m_mkskipped{},
m_RNG{bctbx_rng_context_new()},m_dbSessionId{sessionId},m_usedNr{0},m_usedDHid{0},m_localStorage{localStorage},m_dirty{DRSessionDbStatus::clean},m_peerDid{0},
m_active_status{false}, m_X3DH_initMessage{}
{
......
......@@ -102,8 +102,8 @@ namespace lime {
Lime(Lime<Curve> &a) = delete; // can't copy a session, force usage of shared pointers
Lime<Curve> &operator=(Lime<Curve> &a) = delete; // can't copy a session
void publish_user(const limeCallback &callback);
void delete_user(const limeCallback &callback);
void publish_user(const limeCallback &callback) override;
void delete_user(const limeCallback &callback) override;
void encrypt(std::shared_ptr<const std::string> recipientUserId, std::shared_ptr<std::vector<recipientData>> recipients, std::shared_ptr<const std::vector<uint8_t>> plainMessage, std::shared_ptr<std::vector<uint8_t>> cipherMessage, const limeCallback &callback) override;
bool decrypt(const std::string &recipientUserId, const std::string &senderDeviceId, const std::vector<uint8_t> &cipherHeader, const std::vector<uint8_t> &cipherMessage, std::vector<uint8_t> &plainMessage) override;
......
......@@ -76,10 +76,8 @@ namespace lime {
}
#endif
/* instanciate the template specialisation */
/* template instanciations for Curves 25519 and 448, done */
#ifdef EC255_ENABLED
template bctbx_ECDHContext_t *ECDHInit<C255>(void);
template bctbx_EDDSAContext_t *EDDSAInit<C255>(void);
template class X<C255>;
template class ED<C255>;
template class KeyPair<X<C255>>;
......@@ -87,8 +85,6 @@ namespace lime {
#endif
#ifdef EC448_ENABLED
template bctbx_ECDHContext_t *ECDHInit<C448>(void);
template bctbx_EDDSAContext_t *EDDSAInit<C448>(void);
template class X<C448>;
template class ED<C448>;
template class KeyPair<X<C448>>;
......
......@@ -127,8 +127,6 @@ namespace lime {
template <> bctbx_ECDHContext_t *ECDHInit<C255>(void);
template <> bctbx_EDDSAContext_t *EDDSAInit<C255>(void);
/* ask any file including lime_keys.hpp to not instantiate the follownings as it is done in lime_keys.cpp*/
extern template bctbx_ECDHContext_t *ECDHInit<C255>(void);
extern template bctbx_EDDSAContext_t *EDDSAInit<C255>(void);
extern template class X<C255>;
extern template class ED<C255>;
extern template class KeyPair<X<C255>>;
......@@ -140,8 +138,6 @@ namespace lime {
template <> bctbx_ECDHContext_t *ECDHInit<C448>(void);
template <> bctbx_EDDSAContext_t *EDDSAInit<C448>(void);
/* ask any file including lime_keys.hpp to not instantiate the follownings as it is done in lime_keys.cpp*/
extern template bctbx_ECDHContext_t *ECDHInit<C448>(void);
extern template bctbx_EDDSAContext_t *EDDSAInit<C448>(void);
extern template class X<C448>;
extern template class ED<C448>;
extern template class KeyPair<X<C448>>;
......
......@@ -34,6 +34,7 @@ namespace lime {
/* Encrypt/Decrypt */
virtual void encrypt(std::shared_ptr<const std::string> recipientUserId, std::shared_ptr<std::vector<recipientData>> recipients, std::shared_ptr<const std::vector<uint8_t>> plainMessage, std::shared_ptr<std::vector<uint8_t>> cipherMessage, const limeCallback &callback) = 0;
virtual bool decrypt(const std::string &recipientUserId, const std::string &senderDeviceId, const std::vector<uint8_t> &cipherHeader, const std::vector<uint8_t> &cipherMessage, std::vector<uint8_t> &plainMessage) = 0;
virtual void publish_user(const limeCallback &callback) = 0;
virtual void delete_user(const limeCallback &callback) = 0;
virtual ~LimeGeneric() {};
};
......
......@@ -46,7 +46,7 @@ namespace lime {
}
});
m_users_cache.insert({userId, std::move(insert_LimeUser(m_db_access, userId, x3dhServerUrl, curve, m_http_provider, managerCreateCallback))});
m_users_cache.insert({userId, insert_LimeUser(m_db_access, userId, x3dhServerUrl, curve, m_http_provider, managerCreateCallback)});
}
void LimeManager::delete_user(const std::string &userId, const limeCallback &callback) {
......
......@@ -53,7 +53,7 @@ static const std::string AD{"alice@sip.linphone.org;opaque=user:epid:UghFocauauC
* All delayed messaged are received in their order of sending at the end of message stack processing
*/
template <typename Curve>
static void dr_skippedMessages_basic_test(const uint8_t period=1, const uint8_t skip_period=1000, const uint8_t skip_length=0, const uint8_t skip_delay=0, const std::string db_filename="dr_skipped_message_basic_tmp") {
static void dr_skippedMessages_basic_test(const uint8_t period=1, const uint8_t skip_period=255, const uint8_t skip_length=0, const uint8_t skip_delay=0, const std::string db_filename="dr_skipped_message_basic_tmp") {
std::shared_ptr<DR<Curve>> alice, bob;
std::shared_ptr<lime::Db> aliceLocalStorage, bobLocalStorage;
std::string aliceFilename(db_filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment