Commit graph

1041 commits

Author SHA1 Message Date
manuroe
4be7cc367b OLMKit: Forgot to implement pickle v2 for OLMSession 2021-02-19 12:00:03 +01:00
manuroe
b69b56d0bb OLMKit: New pickle version using a pickle key provided externally
Improve ObjC wrappers so that they can use a pickle key provided by the olm lib user.

This new behavior is optional to not break existing usage.

It is retro compatible and use pickle versioning already in place. 
Existing key will be unpickled with pickle v1 and pickled with pickle v2 if an external pickle key is provided.
2021-02-19 09:23:36 +01:00
Damir Jelić
f46577a06a sas: Introduce a new calculate mac function to fix the base64 issue
Since it's important to keep backwards compatibility introduce a new
function to calculate the MAC using a SAS object.

Modifying the existing functions would break compatibility with older
releases of libolm.
2021-02-02 16:58:28 +01:00
Damir Jelić
4e927eb1cf sas: Fix the base64 encoding of the MAC.
When calculating the MAC for a message using olm_sas_calculate_mac() and
olm_sas_calculate_mac_long_kdf() the resulting MAC will be base64
encoded using _olm_encode_base64().

The _olm_encode_base64() method requires an input buffer and output
buffer to be passed alongside the input length. The method is called
with the same buffer, containing the MAC, for the input buffer as well
as for the output buffer. This results in an incorrectly base64 encoded
MAC.

For example the byte array:
    [121, 105, 187, 19, 37, 94, 119, 248, 224, 34, 94, 29, 157, 5,
     15, 230, 246, 115, 236, 217, 80, 78, 56, 200, 80, 200, 82, 158,
     168, 179, 10, 230]

will be encoded as  eWm7NyVeVmXgbVhnYlZobllsWm9ibGxzV205aWJHeHo
instead of as       eWm7EyVed/jgIl4dnQUP5vZz7NlQTjjIUMhSnqizCuY

Notice the different value at the 10th character.

The correct result can be independently checked using Python for
example:

>>> from base64 import b64encode
>>> mac = [121, 105, 187, 19, 37, 94, 119, 248, 224, 34, 94, 29, 157, \
           5, 15, 230, 246, 115, 236, 217, 80, 78, 56, 200, 80, 200, \
           82, 158, 168, 179, 10, 230]
>>> b64encode(bytearray(mac)).rstrip(b"=")
>>> b'eWm7EyVed/jgIl4dnQUP5vZz7NlQTjjIUMhSnqizCuY'

This happens because the encode_base64() method that is used does not support
in-place encoding in the general case. This is because the remainder for a 32
bit input will always be 2 (32 % 6 == 2).

The remainder will be used over here:
c01164f001/src/base64.cpp (L74)

The logic that gets executed if a remainder exists depends on the original input
values, since those already got in-place encoded the whole block will behave
differently if the input buffer is the same as the output buffer.
2021-01-31 12:56:32 +01:00
Hubert Chathi
c01164f001 add link to nim binding 2021-01-14 12:40:52 -05:00
Tobias Furuholm
541a2bf6fd Fix length calculation of fallback key json 2020-11-24 13:47:27 -05:00
Richard van der Hoff
b9771dae61 DH ratchet sequence diagram 2020-11-23 18:33:26 +00:00
Richard van der Hoff
11d34f79af update double-ratchet diagrams 2020-11-23 18:33:26 +00:00
Hubert Chathi
1fd8d2978f fix typo 2020-11-23 13:17:08 -05:00
Hubert Chathi
64b8bc11cb use the right version in the changelog 2020-10-29 16:35:17 -04:00
Hubert Chathi
8efa0ec17d Use current source directory in CMake. Thanks to Gorgurov Alexey. 2020-10-29 16:26:06 -04:00
Hubert Chathi
c5ab3ecbf2 Merge branch 'patch-1' into 'master'
Update index.d.ts; specify PRIVATE_KEY_LENGTH const export

See merge request matrix-org/olm!15
2020-10-14 01:43:31 +00:00
Michael Telatynski
7768c3219f Update index.d.ts; specify PRIVATE_KEY_LENGTH const export 2020-10-13 21:44:20 +00:00
Hubert Chathi
c4d737c86c bump version numbers and update changelog 2020-10-06 17:39:48 -04:00
Hubert Chathi
60d451bbbe all the (un)pickles take a Uint8Array 2020-10-06 17:28:52 -04:00
Hubert Chathi
4d17aa4f05 bump version numbers and update changelog 2020-10-06 15:08:10 -04:00
Hubert Chathi
d4afebc883 fix typo 2020-10-06 14:47:43 -04:00
Lukas Lihotzki
030e506c00 use stackAlloc instead of allocate 2020-10-06 12:02:17 +02:00
Lukas Lihotzki
22f85d3f3d simplify Makefile (olm_legacy.js) 2020-10-06 09:48:15 +02:00
Lukas Lihotzki
6611165bff do not pollute the global object 2020-10-03 03:46:15 +02:00
Lukas Lihotzki
add885c874 add test_mem target for valgrind memcheck 2020-10-01 15:40:22 +02:00
Lukas Lihotzki
be0c31894a fix memory leaks in tests 2020-10-01 15:39:48 +02:00
Lukas Lihotzki
73a9ced64e simplify Makefile 2020-09-26 18:24:58 +02:00
Lukas Lihotzki
ac61190bb3 fix build with emscripten 2.0.4 2020-09-26 18:23:50 +02:00
Hubert Chathi
0fd315d54c Merge branch 'python_other_key_set' into 'master'
remove other_key checks from Python binding since it's done in C now

See merge request matrix-org/olm!14
2020-09-24 18:56:19 +00:00
Hubert Chathi
0e6ec3062d remove other_key checks from Python binding since it's done in C now 2020-09-24 18:56:19 +00:00
Hubert Chathi
ec5ff1e032 also check that the pubkey is set when calculating the MAC 2020-09-23 16:47:00 -04:00
Hubert Chathi
78d9cbabb7 set their_key_set flag explicitly on init 2020-09-23 16:11:37 -04:00
Saúl Ibarra Corretgé
2ef1f6f4fc SAS: add olm_sas_is_their_key_set
Also make olm_sas_generate_bytes fail if their key wasn't set.
2020-09-23 15:27:55 -04:00
Hubert Chathi
4bae4134eb partially unindent R_{i,j} derivation
so that we're under GitLab's 1000 character limit for rendering maths
2020-09-17 17:46:37 -04:00
Hubert Chathi
84841a19e2 fix exponents in megolm spec 2020-09-17 17:43:00 -04:00
Hubert Chathi
3cd6b15853 Merge branch 'uhoreg/fallback' into 'master'
add support for fallback keys

See merge request matrix-org/olm!13
2020-09-17 21:42:25 +00:00
Hubert Chathi
c47c6ca399 fix style 2020-09-16 16:14:23 -04:00
Hubert Chathi
c45f19f12d Merge branch 'master' into uhoreg/fallback 2020-09-01 15:57:20 -04:00
Hubert Chathi
89050dc0b6 allow some things to be Uint8Array, and fix some TypeScript declarations 2020-08-31 10:50:33 -04:00
Hubert Chathi
171044f3fc add support for fallback keys 2020-08-14 17:29:41 -04:00
Saúl Ibarra Corretgé
a0284c2ba3 Fix group demo to work with > 2 users
Add 4 by default, and make sure OT keys are not reused.
2020-07-04 16:59:26 -04:00
Hubert Chathi
8a958beb48 bump version info for release 2020-06-11 11:47:50 -04:00
Hubert Chathi
9349c1b82b changelog for release 2020-06-11 11:47:39 -04:00
Hubert Chathi
6fea6898d4 update release instructions 2020-06-11 11:47:24 -04:00
Hubert Chathi
c9a183a7c5 add list of bindings 2020-06-11 11:25:52 -04:00
Hubert Chathi
efd17631b1 move -o option before source files, for better compatibility with LLVM 2020-05-19 15:10:24 -04:00
Hubert Chathi
ad173bc798 Merge branch 'matthew/js-fixes' into 'master'
Fix JS demos, which had bitrotted

See merge request matrix-org/olm!12
2020-05-19 15:08:27 +00:00
Matthew Hodgson
ddd140b23d fix group demo to work with Olm.init() 2020-05-16 17:11:54 +01:00
Matthew Hodgson
14c1db02fe fix 1:1 demo to work with Olm.init() 2020-05-16 17:10:32 +01:00
Matthew Hodgson
fdf25eb3ba spell out error msg if you don't Olm.init 2020-05-16 17:10:18 +01:00
Matthew Hodgson
83bf351a34 fix build on latest emscripten 2020-05-16 17:10:02 +01:00
Matthew Hodgson
5a9fdd85cb remove overzealous -D param to install which breaks build on macOS 2020-05-15 03:06:08 +01:00
Hubert Chathi
05a7af8db1 add a note about calling Olm.init 2020-05-13 19:05:19 -04:00
Hubert Chathi
281c5aac21 fix type signature of unpickle in Inbound/OutboundGroupSession
Thanks to Dominic Fischer for spotting.
2020-05-07 18:01:52 -04:00