Commit Graph

213 Commits (ee8172d882e853e737ac7e8b00fb760f21e80bfe)

Author SHA1 Message Date
Richard van der Hoff ee8172d882 Compile some of the crypto libs directly
sha256.c and aes.c contain conflicting declarations, so we need to compile them
as separate units. This requires a bit more Makefile-shuffling; the build
directory now includes 'src' or 'lib' as appropriate, and we just mkdir -p
before each compilation.
2016-05-25 17:08:44 +01:00
Richard van der Hoff 27b57c8d88 Merge branch 'rav/more_group_chat/1' 2016-05-25 15:46:50 +01:00
Richard van der Hoff fae8dacab5 Add a comment explaining Mark's latest fix 2016-05-25 15:44:39 +01:00
Richard van der Hoff 54d43010c8 Merge branch 'rav/jenkins_build' 2016-05-25 15:33:33 +01:00
Mark Haines 19a7fb5df5 Fix an integer wrap around bug and add a couple more tests 2016-05-25 15:00:05 +01:00
Mark Haines 024685f3db Merge branch 'markjh/fuzzingII' 2016-05-25 14:32:03 +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 8d55954ce1 Avoid use of jq in test_olm
I want to use test_olm.sh on jenkins, which lacks jq. Hence, add support to
olm.main to get id and one-time keys individually.
2016-05-24 16:50:26 +01:00
Richard van der Hoff ed039d331c Merge branch 'master' into rav/jenkins_build 2016-05-24 16:30:23 +01:00
Richard van der Hoff 8d31f42b1e Build the tests with -g
think this got lost when mark added separate release/debug builds
2016-05-24 16:28:14 +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 a49d7284f3 add a script for jenkins to run 2016-05-24 14:45:32 +01:00
Richard van der Hoff 15cb4ec0c0 Build the crypto libs as C99
Some of the crypto libs rely on UINT64_C, which in glibc 2.17 and earlier was
not defined for C++ code (see
https://sourceware.org/bugzilla/show_bug.cgi?id=15366).
2016-05-24 14:41:49 +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 846ab858a6 Python wrapper: support for inbound group sessions 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 e545ad7eaf Outbound group session support in the python wrappers 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 e21d5cb222 Fix warnings and set -Werror 2016-05-23 18:08:22 +01:00
Richard van der Hoff ea130cae0d Merge branch 'rav/refactor_python_wrappers' 2016-05-23 18:03:32 +01:00
Mark Haines f47aabd094 Add support for building fuzzers using american fuzzy lop
Builds fuzzers using http://lcamtuf.coredump.cx/afl/
2016-05-23 17:32:24 +01:00
Mark Haines aacf115468 Fix make clean to remove the library and all the .d files 2016-05-23 16:35:34 +01:00
Mark Haines 502bd9e10e Move comment to correct location 2016-05-23 16:31:33 +01:00
Mark Haines 2e986c512e Don't use $^ cause that includes the header files 2016-05-23 16:23:57 +01:00