Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements #1981

Merged
merged 3 commits into from
Jun 19, 2024
Merged

Minor improvements #1981

merged 3 commits into from
Jun 19, 2024

Conversation

sjaeckel
Copy link
Member

@sjaeckel sjaeckel commented Jun 19, 2024

Some minor improvements of the code and fix a crash when creating a new OMEMO session (as in "setup OMEMO for an account").

@sjaeckel sjaeckel requested a review from jubalh June 19, 2024 13:55
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
libsignal does this properly, so there wouldn't be a real double free, but
it will `abort()`.

Instead of destroying the identity key on disconnect, already destroy it
after it has been put into the libsignal 'ratchet identity key pair'.

In the case where the key pair is initially generated, the public
and private parts are only `ref()`'ed once in [0].
In the case where the key pair is read from the disk, the public
and private parts are `ref()`'ed twice, first when decoded in [1] resp.
[2] and a second time in [3].

When `omemo_on_disconnect()` is called we were `unref()`'ing the parts
twice, before this patch. First in [4], a second time in [5] resp. [6].

Now we do the second `unref()` already when loading.

[0] `signal_protocol_key_helper_generate_identity_key_pair()`
[1] `curve_decode_point()`
[2] `curve_decode_private_point()`
[3] `ratchet_identity_key_pair_create()`
[4] `ratchet_identity_key_pair_destroy()`
[5] `ec_private_key_destroy()`
[6] `ec_public_key_destroy()`

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
@jubalh jubalh merged commit b6c2aa5 into master Jun 19, 2024
5 checks passed
@sjaeckel sjaeckel deleted the minor-improvements branch June 19, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants