Commit Graph

257 Commits (2fc83aa9aca1ce84b3c425a670cdf6a3a8886b34)

Author SHA1 Message Date
Richard van der Hoff 2fc83aa9ac Sign megolm messages
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-06 15:26:26 +01:00
Richard van der Hoff 50cd2b2a43 Clean up some typos
Remove redundant args from some js funcs, and fix a comment typo
2016-09-06 14:06:43 +01:00
Richard van der Hoff 7c84ce8098 Merge pull request #18 from matrix-org/rav/pickle_ed25519_in_c
Convert ed25519 pickling functions to C
2016-09-06 11:08:04 +01:00
Richard van der Hoff 8912d13b0b Merge pull request #17 from matrix-org/rav/group_session_error_handling
Fix error handling for group sessions
2016-09-06 11:07:53 +01:00
Richard van der Hoff c2b51207ee Fix error handling for group sessions
Fix a couple of places where we were using the wrong method to get the last
error.
2016-09-05 19:42:04 +01:00
Richard van der Hoff 617f9b1696 remove js package before building 2016-09-05 18:42:18 +01:00
Richard van der Hoff e7996e5984 pack the js after building 2016-09-05 18:40:37 +01:00
Richard van der Hoff 099757dc8f Build the JS wrappers on jenkins 2016-09-05 16:35:22 +01:00
Richard van der Hoff 833ecd3c73 Convert ed25519 pickling functions to C
... so that I can use them from the group session bits.
2016-09-05 12:59:12 +01:00
Richard van der Hoff c09aa77c4a Avoid ldconfig in the Makefile
... because OSX doesn't support it.
2016-09-05 11:56:53 +01:00
Richard van der Hoff 057ab15c1a Merge pull request #14 from matrix-org/rav/convert_crypto_to_c
Convert crypto.hh into C-compatible interface
2016-09-05 10:42:09 +01:00
Richard van der Hoff 69f269ffaf Convert AES functions to plain C 2016-09-05 10:40:39 +01:00
Richard van der Hoff f0acf6582f Convert Ed25519 and Curve25519 functions to plain C 2016-09-05 10:40:39 +01:00
Richard van der Hoff 2aad4cfa86 Merge pull request #15 from matrix-org/rav/has_received_message
OlmSession.has_received_message
2016-09-05 10:38:41 +01:00
Richard van der Hoff fee1748c60 Merge pull request #16 from matrix-org/rav/fix_megolm_utf8
Fix megolm decryption of UTF-8
2016-09-05 10:37:55 +01:00
Richard van der Hoff 9d16d82089 Merge pull request #13 from matrix-org/rav/split_out_key_lengths
Create new constants for key lengths, etc
2016-09-05 10:36:43 +01:00
Richard van der Hoff 1d4c13c798 Fix megolm decryption of UTF-8
Repeat the fix from b10f90d for megolm messages.

It turns out that the 'length' argument to 'Pointer_stringify' doesn't work if
the input includes characters >= 128.

Rather than try to figure out which methods can return UTF-8, and which always
return plain ascii, replace all uses of Pointer_stringify with a 'length'
argument with the version that expects a NULL-terminated input, and extend the
buffer by a byte to allow space for a null-terminator.

In the case of decrypt, we need to add the null ourself.

Fixes https://github.com/vector-im/vector-web/issues/2078.
2016-09-05 00:49:36 +01:00
Richard van der Hoff 2e9021c2e7 OlmSession.has_received_message
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-04 23:41:10 +01:00
Richard van der Hoff 39212987bd Create new constants for key lengths, etc
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-02 15:11:14 +01:00
Richard van der Hoff 0c3f527dfd Bump version in package.json
... to match the Makefile
2016-09-01 14:31:34 +01:00
Richard van der Hoff e3664ef1d2 Merge branch 'rav/ed25519_fix' 2016-09-01 14:12:38 +01:00
Richard van der Hoff 214e932806 Merge branch 'rav/ed25519_fix' 2016-09-01 14:06:57 +01:00
Richard van der Hoff f7c428d62c update changelog
pre-1.0.0 was broken too
2016-09-01 14:00:26 +01:00
Richard van der Hoff 0c462cff11 Fix Ed25519 keypair generation
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-09-01 13:35:23 +01:00
Matthew Hodgson f2906ac0e7 refer to Double Ratchet in readme 2016-07-16 20:56:29 +01:00
Richard van der Hoff f03febb772 Document the release process 2016-07-11 14:51:04 +01:00
Richard van der Hoff d30db7b5c0 Makefile rules to build the rst into html 2016-07-11 14:50:49 +01:00
Richard van der Hoff f3b9c3bbbb Prepare 1.0.0 release 2016-07-11 12:50:11 +01:00
Richard van der Hoff f2151c0287 Merge branch 'rav/fix_decrypt_utf8' 2016-07-06 22:33:14 +01:00
Richard van der Hoff 939aa747dd JS: make sure returned strings are null-terminated
It turns out that the 'length' argument to 'Pointer_stringify' doesn't work if
the input includes characters >= 128.

Rather than try to figure out which methods can return UTF-8, and which always
return plain ascii, replace all uses of Pointer_stringify with a 'length'
argument with the version that expects a NULL-terminated input, and extend the
buffer by a byte to allow space for a null-terminator.

In the case of decrypt, we need to add the null ourself.

Fixes https://github.com/vector-im/vector-web/issues/1719.
2016-07-06 22:32:51 +01:00
Emmanuel Gil Peyrot c8d00665b3 Add an install and an install-debug targets
This makes the user able to use the familiar `make install` syntax, and
allows overriding of the default directories using the DESTDIR and
PREFIX variables, for example:
 make DESTDIR=packaging PREFIX=/usr install
2016-07-05 23:21:28 +01:00
Emmanuel Gil Peyrot 06cdb3f75e Specify the soname in the library and its name
This provides users of this library the guarantee that the ABI will
stay stable when MAJOR will reach 1, and will stay backwards compatible
for the entire duration of the 1.x.y branch.

It does require the maintainers to always update the version in the
Makefile at every ABI change.
2016-07-05 23:21:22 +01:00
Richard van der Hoff d8b24acb77 PR feedback
* write V1 pickles on the master branch
* the logging branch is going to write v0x80000001
2016-06-30 14:01:02 +01:00
Richard van der Hoff 8dd3c182ee Make space in the session pickle for chain index
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-30 11:38:01 +01:00
Richard van der Hoff 757c422578 Remove unused 'chain_index' from Ratchet
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-06-30 11:31:36 +01:00
Richard van der Hoff 803672931a Put a signature on sent group messages
It's important that group messages be signed by the sender, rather than by a
secret derived from the shared secret.
2016-05-26 18:01:02 +01:00
Richard van der Hoff 7c5ab63fd8 js group demo: use a remoteOps object
To make sure that we don't sneakily use methods which we wouldn't be able to
for remote users, expose an interface object which contains the remote
interface.
2016-05-26 17:14:33 +01:00
Richard van der Hoff 952a3e15cf Merge branch 'rav/group_chat_js_bindings' 2016-05-26 13:58:14 +01:00
Richard van der Hoff 389a181ea8 javascript/olm_inbound_group_session.js: fix length arg
message.length counts codepoints; we need bytes.
2016-05-26 13:57:09 +01:00
Mark Haines 09b8c3d7bc Merge remote-tracking branch 'matrix/master' 2016-05-26 13:27:23 +01:00
Mark Haines bfeb554e86 Add a fuzzer for olm_group_decrypt 2016-05-26 13:25:34 +01:00
Richard van der Hoff 315fbfc921 Add a demo for group messaging via the JS bindings 2016-05-25 17:48:01 +01:00
Richard van der Hoff 013f27f3dc Javascript bindings for group sessions 2016-05-25 17:48:01 +01:00
Richard van der Hoff 708fddd747 Remove session_id from group messages
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-25 17:42:32 +01:00
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