Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
dceae043
Commit
dceae043
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Remove the RemoteKey type since it wasn't being used
parent
5291ec78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/olm/session.hh
+2
-9
2 additions, 9 deletions
include/olm/session.hh
src/olm.cpp
+2
-2
2 additions, 2 deletions
src/olm.cpp
src/session.cpp
+12
-16
12 additions, 16 deletions
src/session.cpp
with
16 additions
and
27 deletions
include/olm/session.hh
+
2
−
9
View file @
dceae043
...
...
@@ -21,18 +21,11 @@ namespace olm {
class
Account
;
struct
RemoteKey
{
std
::
uint32_t
id
;
Curve25519PublicKey
key
;
};
enum
struct
MessageType
{
PRE_KEY
=
0
,
MESSAGE
=
1
,
};
struct
Session
{
Session
();
...
...
@@ -42,7 +35,7 @@ struct Session {
bool
received_message
;
Remote
Key
alice_identity_key
;
Curve25519Public
Key
alice_identity_key
;
Curve25519PublicKey
alice_base_key
;
Curve25519PublicKey
bob_one_time_key
;
std
::
uint32_t
bob_one_time_key_id
;
...
...
@@ -52,7 +45,7 @@ struct Session {
std
::
size_t
new_outbound_session
(
Account
const
&
local_account
,
Curve25519PublicKey
const
&
identity_key
,
Remote
Key
const
&
one_time_key
,
Curve25519Public
Key
const
&
one_time_key
,
std
::
uint8_t
const
*
random
,
std
::
size_t
random_length
);
...
...
This diff is collapsed.
Click to expand it.
src/olm.cpp
+
2
−
2
View file @
dceae043
...
...
@@ -435,7 +435,7 @@ size_t olm_create_outbound_session(
return
std
::
size_t
(
-
1
);
}
olm
::
Curve25519PublicKey
identity_key
;
olm
::
Remote
Key
one_time_key
;
olm
::
Curve25519Public
Key
one_time_key
;
olm
::
decode_base64
(
from_c
(
their_identity_key
),
their_identity_key_length
,
...
...
@@ -443,7 +443,7 @@ size_t olm_create_outbound_session(
);
olm
::
decode_base64
(
from_c
(
their_one_time_key
),
their_one_time_key_length
,
one_time_key
.
key
.
public_key
one_time_key
.
public_key
);
return
from_c
(
session
)
->
new_outbound_session
(
...
...
This diff is collapsed.
Click to expand it.
src/session.cpp
+
12
−
16
View file @
dceae043
...
...
@@ -59,7 +59,7 @@ std::size_t olm::Session::new_outbound_session_random_length() {
std
::
size_t
olm
::
Session
::
new_outbound_session
(
olm
::
Account
const
&
local_account
,
olm
::
Curve25519PublicKey
const
&
identity_key
,
olm
::
Remote
Key
const
&
one_time_key
,
olm
::
Curve25519Public
Key
const
&
one_time_key
,
std
::
uint8_t
const
*
random
,
std
::
size_t
random_length
)
{
if
(
random_length
<
new_outbound_session_random_length
())
{
...
...
@@ -74,22 +74,21 @@ std::size_t olm::Session::new_outbound_session(
olm
::
curve25519_generate_key
(
random
+
32
,
ratchet_key
);
received_message
=
false
;
alice_identity_key
.
id
=
0
;
alice_identity_key
.
key
=
local_account
.
identity_keys
.
curve25519_key
;
alice_identity_key
=
local_account
.
identity_keys
.
curve25519_key
;
alice_base_key
=
base_key
;
bob_one_time_key
=
one_time_key
.
key
;
bob_one_time_key
=
one_time_key
;
std
::
uint8_t
shared_secret
[
96
];
olm
::
curve25519_shared_secret
(
local_account
.
identity_keys
.
curve25519_key
,
one_time_key
.
key
,
shared_secret
one_time_key
,
shared_secret
);
olm
::
curve25519_shared_secret
(
base_key
,
identity_key
,
shared_secret
+
32
);
olm
::
curve25519_shared_secret
(
base_key
,
one_time_key
.
key
,
shared_secret
+
64
base_key
,
one_time_key
,
shared_secret
+
64
);
ratchet
.
initialise_as_alice
(
shared_secret
,
96
,
ratchet_key
);
...
...
@@ -144,7 +143,7 @@ std::size_t olm::Session::new_inbound_session(
return
std
::
size_t
(
-
1
);
}
std
::
memcpy
(
alice_identity_key
.
key
.
public_key
,
reader
.
identity_key
,
32
);
std
::
memcpy
(
alice_identity_key
.
public_key
,
reader
.
identity_key
,
32
);
std
::
memcpy
(
alice_base_key
.
public_key
,
reader
.
base_key
,
32
);
std
::
memcpy
(
bob_one_time_key
.
public_key
,
reader
.
one_time_key
,
32
);
olm
::
Curve25519PublicKey
ratchet_key
;
...
...
@@ -162,7 +161,7 @@ std::size_t olm::Session::new_inbound_session(
std
::
uint8_t
shared_secret
[
96
];
olm
::
curve25519_shared_secret
(
our_one_time_key
->
key
,
alice_identity_key
.
key
,
shared_secret
our_one_time_key
->
key
,
alice_identity_key
,
shared_secret
);
olm
::
curve25519_shared_secret
(
local_account
.
identity_keys
.
curve25519_key
,
...
...
@@ -190,7 +189,7 @@ bool olm::Session::matches_inbound_session(
bool
same
=
true
;
same
=
same
&&
0
==
std
::
memcmp
(
reader
.
identity_key
,
alice_identity_key
.
key
.
public_key
,
KEY_LENGTH
reader
.
identity_key
,
alice_identity_key
.
public_key
,
KEY_LENGTH
);
same
=
same
&&
0
==
std
::
memcmp
(
reader
.
base_key
,
alice_base_key
.
public_key
,
KEY_LENGTH
...
...
@@ -267,7 +266,7 @@ std::size_t olm::Session::encrypt(
writer
.
one_time_key
,
bob_one_time_key
.
public_key
,
KEY_LENGTH
);
std
::
memcpy
(
writer
.
identity_key
,
alice_identity_key
.
key
.
public_key
,
KEY_LENGTH
writer
.
identity_key
,
alice_identity_key
.
public_key
,
KEY_LENGTH
);
std
::
memcpy
(
writer
.
base_key
,
alice_base_key
.
public_key
,
KEY_LENGTH
...
...
@@ -361,8 +360,7 @@ std::size_t olm::pickle_length(
)
{
std
::
size_t
length
=
0
;
length
+=
olm
::
pickle_length
(
value
.
received_message
);
length
+=
olm
::
pickle_length
(
value
.
alice_identity_key
.
id
);
length
+=
olm
::
pickle_length
(
value
.
alice_identity_key
.
key
);
length
+=
olm
::
pickle_length
(
value
.
alice_identity_key
);
length
+=
olm
::
pickle_length
(
value
.
alice_base_key
);
length
+=
olm
::
pickle_length
(
value
.
bob_one_time_key
);
length
+=
olm
::
pickle_length
(
value
.
bob_one_time_key_id
);
...
...
@@ -376,8 +374,7 @@ std::uint8_t * olm::pickle(
Session
const
&
value
)
{
pos
=
olm
::
pickle
(
pos
,
value
.
received_message
);
pos
=
olm
::
pickle
(
pos
,
value
.
alice_identity_key
.
id
);
pos
=
olm
::
pickle
(
pos
,
value
.
alice_identity_key
.
key
);
pos
=
olm
::
pickle
(
pos
,
value
.
alice_identity_key
);
pos
=
olm
::
pickle
(
pos
,
value
.
alice_base_key
);
pos
=
olm
::
pickle
(
pos
,
value
.
bob_one_time_key
);
pos
=
olm
::
pickle
(
pos
,
value
.
bob_one_time_key_id
);
...
...
@@ -391,8 +388,7 @@ std::uint8_t const * olm::unpickle(
Session
&
value
)
{
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
received_message
);
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
alice_identity_key
.
id
);
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
alice_identity_key
.
key
);
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
alice_identity_key
);
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
alice_base_key
);
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
bob_one_time_key
);
pos
=
olm
::
unpickle
(
pos
,
end
,
value
.
bob_one_time_key_id
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment