diff options
author | pedroGitt <pedro.contreiras@amdocs.com> | 2016-11-23 00:04:58 +0100 |
---|---|---|
committer | pedroGitt <pedro.contreiras@amdocs.com> | 2016-11-23 00:04:58 +0100 |
commit | 7a6897642baa8fc5d9d9f14c80fc4f201cfe2173 (patch) | |
tree | 9325a7d7d3ac40747f49af22378dcf9bc5c0dd0b /src/outbound_group_session.c | |
parent | c725a561a283f508e68516ded86d141214f5ea06 (diff) | |
parent | f6c05be8c5d35e725a8a2ed5ad661398ac9f8cd2 (diff) |
Merge remote-tracking branch 'origin/master' into pedroc/android_e2e_dev
Diffstat (limited to 'src/outbound_group_session.c')
-rw-r--r-- | src/outbound_group_session.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/outbound_group_session.c b/src/outbound_group_session.c index 4e4561a..ae45694 100644 --- a/src/outbound_group_session.c +++ b/src/outbound_group_session.c @@ -154,20 +154,23 @@ size_t olm_init_outbound_group_session_random_length( size_t olm_init_outbound_group_session( OlmOutboundGroupSession *session, - uint8_t const * random, size_t random_length + uint8_t *random, size_t random_length ) { + const uint8_t *random_ptr = random; + if (random_length < olm_init_outbound_group_session_random_length(session)) { /* Insufficient random data for new session */ session->last_error = OLM_NOT_ENOUGH_RANDOM; return (size_t)-1; } - megolm_init(&(session->ratchet), random, 0); - random += MEGOLM_RATCHET_LENGTH; + megolm_init(&(session->ratchet), random_ptr, 0); + random_ptr += MEGOLM_RATCHET_LENGTH; - _olm_crypto_ed25519_generate_key(random, &(session->signing_key)); - random += ED25519_RANDOM_LENGTH; + _olm_crypto_ed25519_generate_key(random_ptr, &(session->signing_key)); + random_ptr += ED25519_RANDOM_LENGTH; + _olm_unset(random, random_length); return 0; } |