aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-01-10Store a flag indicating if the sender key is verifiedRichard van der Hoff
2017-01-09Implement importing group session dataRichard van der Hoff
olm_import_inbound_group_session, which reads the format written by olm_export_inbound_group_session to initialise a group session.
2017-01-06Enable exporting inbound group session keysRichard van der Hoff
A pair of functions which allow you to export the megolm keys for an inbound group session, so that an application can save/restore them.
2016-10-24Return the base64-encoded length of picklesRichard van der Hoff
make olm_pickle_* return the lengths of the base64-encoded pickles, rather than the raw pickle. (From the application's POV, the format of the pickle is opaque: it doesn't even know that it is base64-encoded. So returning the length of the raw pickle is particularly unhelpful.)
2016-10-21Clear random buf in olm_init_outbound_group_sessionRichard van der Hoff
All the other methods clear their random inputs. This one needs to do the same, to reduce the risk of the randomness being used elsewhere and leaking key info.
2016-10-21Merge pull request #31 from matrix-org/markjh/groupmessageindexMark Haines
Return the message index when decrypting group messages.
2016-10-20Add NULL check for message_index pointerMark Haines
2016-10-20Return the message index when decrypting group messages.Mark Haines
Applications can use the index to detect replays of the same message.
2016-10-19Fix a buffer bounds check when decoding group messagesRichard van der Hoff
Fixes a segfault when a group message had exactly the length of the mac + signature. Also tweak skipping of unknown tags to avoid an extra trip around the loop.
2016-09-13Merge pull request #23 from matrix-org/markjh/remove_message_indexMark Haines
Remove the messsage index from olm_init_inbound_group_session
2016-09-13Remove the messsage index from olm_init_inbound_group_session since it is ↵Mark Haines
read from the session_key
2016-09-13Add a olm_inbound_group_session_id methodMark Haines
2016-09-13``if`` is not the same as ``for``Mark Haines
2016-09-13Comment on the encoding of the message counter.Mark Haines
2016-09-13Use the ed22519 public key as the group session id.Mark Haines
Some clients expect the session id to be globally unique, so allowing the end devices to pick the session id will cause problems. Include the current ratchet index with the initial keys, this decreases the risk that the client will supply the wrong index causing problems. Sign the initial keys with the ratchet ed25519 key, this reduces the risk of a client claiming a session that they didn't create.
2016-09-06Sign megolm messagesRichard van der Hoff
Add ed25519 keys to the inbound and outbound sessions, and use them to sign and verify megolm messages. We just stuff the ed25519 public key in alongside the megolm session key (and add a version byte), to save adding more boilerplate to the JS/python/etc layers.
2016-09-05Convert ed25519 pickling functions to CRichard van der Hoff
... so that I can use them from the group session bits.
2016-09-05Convert AES functions to plain CRichard van der Hoff
2016-09-05Convert Ed25519 and Curve25519 functions to plain CRichard van der Hoff
2016-09-05Merge pull request #15 from matrix-org/rav/has_received_messageRichard van der Hoff
OlmSession.has_received_message
2016-09-04OlmSession.has_received_messageRichard van der Hoff
I find myself wanting to know if an OlmSession is in the pre-key state or not, to help debugging at the application level.
2016-09-02Create new constants for key lengths, etcRichard van der Hoff
We were using olm::KEY_LENGTH for everything under the sun which happened to be 32 bytes long, and making a bunch of assumptions in the process. Create a bunch of new constants (as C #defines rather than C++ consts so that I can use them in another forthcoming refactor).
2016-09-01Fix Ed25519 keypair generationRichard van der Hoff
Ed25519 private keys, it turns out, have 64 bytes, not 32. We were previously generating only 32 bytes (which is all that is required to generate the public key), and then using the public key as the upper 32 bytes when generating the per-message session key. This meant that everything appeared to work, but the security of the private key was severely compromised. By way of fixes: * Use the correct algorithm for generating the Ed25519 private key, and store all 512 bits of it. * Update the account pickle format and refuse to load the old format (since we should consider it compromised). * Bump the library version, and add a function to retrieve the library version, so that applications can verify that they are linked against a fixed version of the library. * Remove the curve25519_{sign, verify} functions which were unused and of dubious quality.
2016-06-30PR feedbackRichard van der Hoff
* write V1 pickles on the master branch * the logging branch is going to write v0x80000001
2016-06-30Make space in the session pickle for chain indexRichard van der Hoff
Keeping track of the chain index is a useful thing to do, but is only required if we've enabled diagnostics. Extend the session pickle format to make a space for it, so that pickles can be transferred between the logging_enabled branch and the master branch without loss of information. Also add some tests for session pickling which explicitly check that we can unpickle both formats of pickle.
2016-06-30Remove unused 'chain_index' from RatchetRichard van der Hoff
This was introduced when I was experimenting with support for logging progress in Olm. That is now relegated to the logging_enabled branch, so this should probably be removed. This also fixes the incompatibility of session pickles from the current master branch with those from olm 0.1.0.
2016-05-25Remove session_id from group messagesRichard van der Hoff
Putting the session_id inside the packed message body makes it hard to extract so that we can decide which session to use. We don't think there is any advantage to having thes sesion_id protected by the HMACs, so we're going to move it to the JSON framing.
2016-05-25Compile some of the crypto libs directlyRichard van der Hoff
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-25Merge branch 'rav/more_group_chat/1'Richard van der Hoff
2016-05-25Add a comment explaining Mark's latest fixRichard van der Hoff
2016-05-25Fix an integer wrap around bug and add a couple more testsMark Haines
2016-05-24Fix handling of integer wraparound in megolm.cRichard van der Hoff
2016-05-24megolm_advance_to: Remove excessive optimisationRichard van der Hoff
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-24megolm.c: rewrite counter updateRichard van der Hoff
We no longer need to keep track of intermediate values of the counter, which means we can update it much more easily.
2016-05-24megolm.c: Remove spurious arguments to rehash_partRichard van der Hoff
These were left over from when rehash_part did a bunch of logging.
2016-05-24Separate base64ing from the rest of msg encodingRichard van der Hoff
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-24Update megolm_cipher as a global structRichard van der Hoff
Initialise megolm_cipher via the preprocessor macro, instead of with a function.
2016-05-24Build the crypto libs as C99Richard van der Hoff
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-24Use _olm_unset instead of memsetRichard van der Hoff
memset is at risk of being optimised away, so use _olm_unset instead.
2016-05-24Avoid relying on uint -> int casting behaviourRichard van der Hoff
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-24Fix up some names, and protobuf tagsRichard van der Hoff
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-24Support for pickling inbound group sessionsRichard van der Hoff
2016-05-24Implement decrypting inbound group messagesRichard van der Hoff
Includes creation of inbound sessions, etc
2016-05-24Implement functions to get the state of outbound sessionRichard van der Hoff
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-24Implement pickling/unpickling for outbound group sessionsRichard van der Hoff
2016-05-24Implementation of an outbound group sessionRichard van der Hoff
2016-05-24Implementation of the megolm ratchetRichard van der Hoff
2016-05-24Factor out pickle_encoding from olm.cppRichard van der Hoff
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-24Factor out olm_error_to_string to a separate fileRichard van der Hoff
I want to be able to use this functionality from elsewhere, so factor it out to its own file.
2016-05-24Merge branch 'rav/c_bindings'Richard van der Hoff