diff --git a/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp b/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
index bf10152a61458dd759f67fac2cb4315a019ea385..e7c740abc1293aaf3a57d449652ecda1b4260a67 100644
--- a/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
@@ -111,7 +111,7 @@ void AudioSrtpSession::initializeLocalMasterKey(void)
     if((err = RAND_bytes(random_key, _localMasterKeyLength)) != 1)
         _debug("Error occured while generating cryptographically strong pseudo-random key");
 
-    memcpy(_localMasterKey, random_key, _localMasterKeyLength);
+    memcpy(_localMasterKey, mk, _localMasterKeyLength);
 
     return;
 }
@@ -129,7 +129,7 @@ void AudioSrtpSession::initializeLocalMasterSalt(void)
     if((err = RAND_bytes(random_key, _localMasterSaltLength)) != 1)
         _debug("Error occured while generating cryptographically strong pseudo-random key");
 
-    memcpy(_localMasterSalt, random_key, _localMasterSaltLength);
+    memcpy(_localMasterSalt, ms, _localMasterSaltLength);
 
     return;