Mark Haines
19a7fb5df5
Fix an integer wrap around bug and add a couple more tests
2016-05-25 15:00:05 +01:00
Richard van der Hoff
01ea3d4b9a
Fix handling of integer wraparound in megolm.c
2016-05-24 17:52:35 +01:00
Richard van der Hoff
1f31427139
megolm_advance_to: Remove excessive optimisation
...
There was some slightly overcomplex logic designed to save a couple of hash
operations when R(0) and R(1) were advanced, but the extra code was hard to
understand and didn't save much.
2016-05-24 17:38:43 +01:00
Richard van der Hoff
ef8d24f483
megolm.c: rewrite counter update
...
We no longer need to keep track of intermediate values of the counter, which
means we can update it much more easily.
2016-05-24 17:33:41 +01:00
Richard van der Hoff
f3c0dd76d7
megolm.c: Remove spurious arguments to rehash_part
...
These were left over from when rehash_part did a bunch of logging.
2016-05-24 17:03:42 +01:00
Richard van der Hoff
1b15465c42
Separate base64ing from the rest of msg encoding
...
Factor the actual message encoding/decoding and encrypting/decrypting out to
separate functions from the top-level functions which do the base64-wrangling.
This is particularly helpful in the 'outbound' code-path where the offsets
required to allow room to base64-encode make the flow hard to see when it's all inline.
2016-05-24 16:23:19 +01:00
Richard van der Hoff
a919a149fb
Update megolm_cipher as a global struct
...
Initialise megolm_cipher via the preprocessor macro, instead of with a
function.
2016-05-24 14:54:01 +01:00
Richard van der Hoff
fa1e9446ac
Use _olm_unset instead of memset
...
memset is at risk of being optimised away, so use _olm_unset instead.
2016-05-24 13:40:21 +01:00
Richard van der Hoff
173cbe112c
Avoid relying on uint -> int casting behaviour
...
The behaviour when casting from a uint32_t which has overflowed (so has the top
bit set) to int32_t is implementation-defined, so let's avoid relying on it.
2016-05-24 13:40:21 +01:00
Richard van der Hoff
fc4756ddf1
Fix up some names, and protobuf tags
...
Make names (of session_key and message_index) more consistent.
Use our own protobuf tags rather than trying to piggyback on the one-to-one
structure.
2016-05-24 13:40:21 +01:00
Richard van der Hoff
a073d12d83
Support for pickling inbound group sessions
2016-05-24 13:40:21 +01:00
Richard van der Hoff
39ad75314b
Implement decrypting inbound group messages
...
Includes creation of inbound sessions, etc
2016-05-24 13:39:34 +01:00
Richard van der Hoff
8b1514c0a6
Implement functions to get the state of outbound session
...
We need to be able to inspect an outbound session so that we can tell our peer
how to set up an inbound session.
2016-05-24 13:39:34 +01:00
Richard van der Hoff
c058554132
Implement pickling/unpickling for outbound group sessions
2016-05-24 13:39:34 +01:00
Richard van der Hoff
caaed796ad
Implementation of an outbound group session
2016-05-24 13:39:34 +01:00
Richard van der Hoff
68d3c7bfa9
Implementation of the megolm ratchet
2016-05-24 13:39:34 +01:00
Richard van der Hoff
42a300fc62
Factor out pickle_encoding from olm.cpp
...
We don't need to have all of the top-level pickling functions in olm.cpp;
factor out the utilities to support it to pickle_encoding.cpp (and make sure
that they have plain-C bindings).
2016-05-24 13:39:32 +01:00
Richard van der Hoff
256bce10fc
Factor out olm_error_to_string to a separate file
...
I want to be able to use this functionality from elsewhere, so factor it out to
its own file.
2016-05-24 13:35:28 +01:00
Richard van der Hoff
2e7800cf65
Merge branch 'rav/c_bindings'
2016-05-24 13:33:33 +01:00
Richard van der Hoff
2fd28a6682
Rewrite _olm_cipher_aes_sha_256 initialisation
...
Replace the init-static-var dance with some preprocessor macros
2016-05-24 12:06:47 +01:00
Richard van der Hoff
d4a3c8dbaa
Remove 'destruct' from cipher_ops
...
We never delete a cipher, and the destruct op is empty, so it's a bit pointless
2016-05-24 09:56:01 +01:00
Mark Haines
b1c5732fc8
Fix bug in bounds check when parsing
2016-05-23 19:37:58 +01:00
Richard van der Hoff
444ef1f706
Prefix for internal symbols
...
Give a load of internal symbols "_olm_" prefixes. This better delineates the
public and private interfaces in the module, and helps avoid internal symbols
leaking out and possibly being abused.
2016-05-23 18:55:06 +01:00
Richard van der Hoff
c57b2b71c5
C bindings for base64 functions
2016-05-23 18:55:06 +01:00
Richard van der Hoff
a1855b99b9
C binding for olm::unset
2016-05-23 18:55:05 +01:00
Richard van der Hoff
07b33acee5
C bindings for pickle functions
2016-05-23 18:55:05 +01:00
Richard van der Hoff
294cf482ea
Convert cipher.hh to plain C
2016-05-23 18:55:05 +01:00
Richard van der Hoff
f9139dfa6a
Convert error.hh to plain C
2016-05-23 18:55:05 +01:00
Richard van der Hoff
e533b0dc8e
Give SHA256 functions C bindings
2016-05-23 18:55:05 +01:00
Richard van der Hoff
4f1bb49d20
Rename olm.hh to olm.h
2016-05-23 18:55:05 +01:00
Richard van der Hoff
182f33f8ae
Complete fixes for olm_*_last_error
...
Should have been in the previous commit :/
2016-05-23 18:54:18 +01:00
Richard van der Hoff
f69577ad99
fix range check in olm_*_last_errror
2016-05-23 18:53:14 +01:00
Richard van der Hoff
c8c5f35bb4
crypto.cpp: Fix comments
...
These seem to be the wrong way around.
2016-05-20 15:37:33 +01:00
Richard van der Hoff
acae4e8438
Remove functions which return strings
...
We don't want anything which does dynamic memory allocation in the library.
2016-05-20 15:07:10 +01:00
Richard van der Hoff
3965320a9c
Remove logging functionality
...
Concerns have been raised that including logging functionality makes it harder
to audit the implementation to ensure that no secret information is leaked. We
are therefore removing it from the master branch.
2016-05-16 11:13:54 +01:00
Richard van der Hoff
b3db0e6ee1
translate logging.cpp to C
2016-05-16 11:05:57 +01:00
Richard van der Hoff
48cb5f925d
Add olm::log_enabled_for
2016-05-16 11:04:26 +01:00
Richard van der Hoff
11dbf2aab3
Fix a bunch of compiler warnings, and turn on warnings.
2016-04-26 18:10:13 +01:00
Richard van der Hoff
9848f84452
Add some logging to help understand what's going on
2016-04-26 17:55:26 +01:00
Richard van der Hoff
e7a2af1ede
Add a basic logging implementation
2016-04-26 12:30:18 +01:00
Richard van der Hoff
25953b350b
Use header files where possible
...
This fixes an incorrect re-declaration of ed25519_sign.
Implement header files for some of the other library bits so that we don't need
to declare functions in crypto.cpp.
2015-12-03 17:08:04 +00:00
Mark Haines
b318055185
Replace hard coded references to the 32-byte key length with a constant, add utilities for copying data to and from fixed sized arrays
2015-08-19 17:32:06 +01:00
Mark Haines
159faa1e2b
Make the internal functions static, remove some unused internal functions
2015-08-18 17:09:55 +01:00
Mark Haines
158f7ee891
Fix crash where the message length was shorter than the length of the mac
2015-08-07 19:33:48 +01:00
Mark Haines
a4b2927884
Initialise the length fields of the reader struct in decode_message, even if the message is invalid, fixes a crash where the message was too short
2015-08-07 18:58:42 +01:00
Mark Haines
76ecd85c2c
Fix a crash when decoding messages that are too short
2015-08-07 18:25:21 +01:00
Mark Haines
39c1f3b355
Add methods for computing sha256 hashes and validating ed25519 signatures
2015-07-24 14:29:52 +01:00
Mark Haines
3468886e27
Add method getting a session id. Update the python and javascript bindings
2015-07-16 11:45:20 +01:00
Mark Haines
89d9b972a6
Add versions of olm_session_create_inbound and olm_session_matches_inbound which take the curve25519 identity key of the remote device we think the message is from as an additional argument
2015-07-16 10:45:10 +01:00
Mark Haines
137aa31e95
olm_account_last_error and olm_clear_account should take an Account not a Session
2015-07-15 13:24:26 +01:00