Commit Graph

46 Commits (b989db011738897e20d143417b08435b9b6955a3)

Author SHA1 Message Date
Hubert Chathi b989db0117 track if fallback keys were published 2021-11-23 22:35:10 +00:00
Hubert Chathi d84c1af882 East const for consistency 2021-08-06 17:36:01 -04:00
Hubert Chathi 4d6c3ba8d1 make account const in create_outbound_session 2021-08-06 17:29:56 -04:00
Denis Kasak b70e0b06df Differentiate between malformed pickle objects and trailing junk data.
Adds the OLM_PICKLE_EXTRA_DATA error code. We fail with this code when
the pickle object looks right except for some unexpected trailing bytes
which we didn't process.
2021-07-31 01:27:43 +00:00
Denis Kasak d704f4bd3c Fail when an unpickle succeeds but has extra junk data at the end.
Also adds tests to ensure this is working.
2021-07-31 01:27:43 +00:00
Denis Kasak bdd73c5c32 Fix unpickling error handling. 2021-07-31 01:27:43 +00:00
Hubert Chathi 37c8e14e53 make functions const where possible 2021-06-16 23:22:25 -04:00
Hubert Chathi 7263c4221b add functions to get the error codes rather than error strings 2021-06-16 22:40:14 -04:00
Hubert Chathi 171044f3fc add support for fallback keys 2020-08-14 17:29:41 -04:00
David Baker b482321213 Pass in a buffer to olm_session_describe
instead of having a static one, as that could end up taking up a
lot of memory if your app keeps olm sessions hanging about.
2019-10-04 11:43:40 +01:00
David Baker 39a1ee0b18 Add olm_session_describe
As a way to dump the state of an olm session, ie. the chain indicies,
so we can debug why olm sessions break and get out of sync.
2019-10-01 11:14:16 +01:00
manuroe 9d81046f90 Fix warnings reported by LLVM 2018-06-27 12:25:27 -04: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 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 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
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 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 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 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 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 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 e7a2af1ede Add a basic logging implementation 2016-04-26 12:30:18 +01: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 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
Mark Haines a59fbdfe7f Add a test for pickling and unpickling sessions, fix off by one error when unpickling sessions 2015-07-14 11:32:11 +01:00
Mark Haines 2e49a6f41e Clear the random buffers once they've been used. Add methods for clearing the account and session object once they've been used 2015-07-10 18:29:14 +01:00
Mark Haines 5ad929104e Version the pickled objects and check for errors when unpickling them 2015-07-10 18:00:18 +01:00
Mark Haines b6e248c9a5 Output simpler JSON for the account keys, don't sign the JSON but instead provide a olm_account_sign method so that the user of the library can sign the JSON themselves 2015-07-10 11:57:53 +01:00
Mark Haines 373acefde7 Add c bindings for the methods for managing one time keys 2015-07-09 18:35:54 +01:00
Mark Haines 0e988237f6 Don't pass a key id when creating a new outbound session 2015-07-08 16:04:18 +01:00
Mark Haines 532dc0d4e7 Change the JSON format for one time keys to include what algorithm they are for 2015-07-08 15:30:34 +01:00
Mark Haines dceae043b3 Remove the RemoteKey type since it wasn't being used 2015-07-08 14:57:55 +01:00
Mark Haines 5291ec78b5 Send the public part of the one time key rather than passing an identifier 2015-07-08 14:53:25 +01:00
Mark Haines 3a382aec59 Encode the account keys as a signed JSON object 2015-07-07 16:42:03 +01:00
Mark Haines f1cd5613f6 Remove the last resort one time key 2015-07-07 09:01:38 +01:00
Matthew Hodgson 09d4125ff1 Rename axolotlpp as olm to avoid confusion with Axolotl-the-spec and Axolotl-the-OWS-libraries at moxie's request 2015-06-27 01:15:23 +02:00