diff options
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/KeyStream.cpp')
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/KeyStream.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/KeyStream.cpp b/protocols/WhatsApp/src/WhatsAPI++/KeyStream.cpp index f4741729a7..d027cb9c86 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/KeyStream.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/KeyStream.cpp @@ -14,9 +14,19 @@ using namespace Utilities;
-KeyStream::KeyStream(unsigned char* _key, unsigned char* _keyMac) :
+KeyStream::KeyStream() :
seq(0)
{
+ HMAC_CTX_init(&hmac);
+}
+
+KeyStream::~KeyStream()
+{
+ HMAC_CTX_cleanup(&hmac);
+}
+
+void KeyStream::init(unsigned char* _key, unsigned char* _keyMac)
+{
memcpy(key, _key, 20);
memcpy(keyMac, _keyMac, 20);
@@ -24,13 +34,6 @@ KeyStream::KeyStream(unsigned char* _key, unsigned char* _keyMac) : unsigned char drop[768];
RC4(&this->rc4, sizeof(drop), drop, drop);
-
- HMAC_CTX_init(&hmac);
-}
-
-KeyStream::~KeyStream()
-{
- HMAC_CTX_cleanup(&hmac);
}
void KeyStream::keyFromPasswordAndNonce(const std::string& pass, const std::vector<unsigned char>& nonce, unsigned char *out)
|