Commit Graph

628 Commits (4e94dfc7e057776b0d1aafbeb72c8dad7918d988)

Author SHA1 Message Date
Konstantinos Sideris 4e94dfc7e0 Add CMake support
The library can now be installed using CMake v3.0+.

Below is an example configuration.

1. Generate configuation

cmake -H. -Bbuild
    -GNinja
    -DCMAKE_BUILD_TYPE=Release // The default profile.
    -DCMAKE_INSTALL_PREFIX=/usr/local/
    -DBUILD_SHARED_LIBS=ON
    -DOLM_TESTS=1
    -DOLM_FUZZERS=1

2. Build & install the targets

cmake --build build --config Release --target install

3. Run the tests

cd build/test && ctest .

The library can also be used as a dependency with CMake using

find_package(Olm::Olm REQUIRED)
target_link_libraries(my_exe Olm::Olm)

Signed-off-by: Konstantinos Sideris <sideris.konstantin@gmail.com>
2018-10-12 16:22:03 -04:00
Hubert Chathi af86a9a8b8 clear out plaintext buffers in Android SDK where possible 2018-10-12 15:55:36 -04:00
David Baker b1130fb77f
Merge pull request #61 from matrix-org/dbkr/pk_private_export_import
Work with PkDecryption keys by their private keys
2018-10-12 08:24:45 +01:00
David Baker 50ed20f61e Merge remote-tracking branch 'origin/master' into dbkr/pk_private_export_import 2018-10-12 08:22:57 +01:00
David Baker b2d91f55ec
Merge pull request #62 from matrix-org/dbkr/ci2
CircleCI Build Support
2018-10-12 08:13:45 +01:00
David Baker fac1d52dfe Add aliases for deprecated functions 2018-10-11 18:16:39 +01:00
David Baker e73ebcea67 Merge remote-tracking branch 'origin/master' into dbkr/pk_private_export_import 2018-10-10 20:15:40 +01:00
David Baker 82534708a3 Merge remote-tracking branch 'origin/master' into dbkr/ci2 2018-10-10 20:08:55 +01:00
David Baker 3cfcf1615d
Merge pull request #57 from matrix-org/dbkr/wasm
WebAssembly support
2018-10-10 20:07:19 +01:00
David Baker 1dbb060c44 Add note about passing through env var with docker 2018-10-10 19:41:12 +01:00
Hubert Chathi 44f78cf4fe
Merge branch 'master' into dbkr/wasm 2018-10-09 17:38:32 -04:00
David Baker 713e9aeb4d Build on mac 2018-10-05 15:35:21 -04:00
Hubert Chathi 2cbba061c3
Merge branch 'master' into dbkr/ci2 2018-10-05 14:54:29 -04:00
Hubert Chathi f6e3f7f44a
Merge branch 'master' into dbkr/pk_private_export_import 2018-10-05 14:52:01 -04:00
Hubert Chathi 0a25ec137f
Merge branch 'master' into dbkr/wasm 2018-10-05 10:50:01 -04:00
Hubert Chathi 173339ae9a add more comments describing the pk encrypt/decrypt functions 2018-10-05 10:35:09 -04:00
Hubert Chathi bad14db8da remove unneeded polyfill 2018-10-05 10:35:09 -04:00
Hubert Chathi 8520168e0b fix some code style issues and typos 2018-10-05 10:35:09 -04:00
David Baker 602c00a8d6 Dual-build wasm and asm.js olm 2018-10-04 20:09:54 +01:00
David Baker 031eb2dc75 ...in the right dir 2018-10-03 16:26:17 +01:00
David Baker 8161fa51a8 run npm install 2018-10-03 16:24:21 +01:00
David Baker 877166dedc Merge branch 'dbkr/wasm' into dbkr/ci2 2018-10-03 16:22:13 +01:00
David Baker 3e775938e5 Replace the impenetrable line of perl with python
Mostly because the standard emscripten docker image does not have
libjson-perl, but python always comes with json. But also because
it was impenetrable.
2018-10-03 16:06:15 +01:00
David Baker b1beadacee CircleCI config file 2018-10-03 15:59:45 +01:00
David Baker e521ee84c5 Add an export for the length of a private key 2018-10-02 19:21:05 +01:00
David Baker 9b652bb127
Merge pull request #58 from matrix-org/dbkr/method_consistency
Call appropriate wrapper function
2018-10-02 12:10:29 +01:00
David Baker 8635d68ba8 Add other breaking change 2018-10-02 12:09:33 +01:00
David Baker 0346145a81 Work with PkDecryption keys by their private keys
Change interface to allow the app to get the private part of the
key and instantiate a decryption object from just the private part
of the key.

Changes the function generating a key from random bytes to be
initialising a key with a private key (because it's exactly the
same thing). Exports & imports private key parts as ArrayBuffer at
JS level rather than base64 assuming we are moving that way in
general.
2018-10-02 12:02:56 +01:00
David Baker 00384ba87a Merge remote-tracking branch 'origin/master' into dbkr/wasm 2018-10-02 10:15:14 +01:00
David Baker 04f58bb0c9
Merge pull request #59 from matrix-org/dbkr/fix_trailing_newlines
Remove trailing letter 'K's from the test pubkeys
2018-10-02 10:04:14 +01:00
David Baker 2835110cee Remove trailing letter 'K's from the test pubkeys
base64 encoded newlines somehow?
2018-10-01 20:01:47 +01:00
David Baker b51d75392b Merge remote-tracking branch 'origin/master' into dbkr/wasm 2018-10-01 16:14:39 +01:00
David Baker 0ad32c9896 Call appropriate wrapper function
Don't think this matters since there's no PkEncryption /
PkDecryption object being passed, but for the sake of consistency
2018-10-01 13:22:04 +01:00
Matthew Hodgson 8f6e0557ee oops, fix typo - thanks to @dest4 2018-09-27 18:45:00 +01:00
David Baker c4a3918686 Support passing olm options into init() 2018-09-26 16:38:39 +01:00
David Baker 498562fa65 Breking change 2018-09-25 18:03:31 +01:00
David Baker dfbe8a4796 Return same promise if init() called many times
So we only init the library once.
2018-09-25 17:48:17 +01:00
David Baker 263b94428a Another day, another interface
Change the interface again, hopefully this time a bit more normal.
Now we wrap the emscripten module completely and just expose the
high level objects.

The olm library export is now imported as normal (ie. returns
a module rather than a function returning a module) but has an
`init` method which *must* be called. This returns a promise
which resolves when the module is ready. It also rejects if the
module failed to set up, unlike before (and unlike the
promise-not-a-promise that emscripten returns).

Generally catch failures to init the module.
2018-09-25 17:13:29 +01:00
David Baker f29d8cdd7b Also ship the wasm file 2018-09-21 16:39:04 +01:00
David Baker 5e87db615a Make OLM_OPTIONS work again
The closure compiler was just renaming the variable so it never
would have picked them up. Make it an extern so it knows what to do.
2018-09-21 16:35:17 +01:00
David Baker 122867c45c WebAssembly support!
Quite a lot going on in this PR:
 * Updates to support recent emscripten, switching to WASM which is now the default
 * Use emscripten's MODULARIZE option rather than wrapping it ourself, since doing
   so in pre-post js doesn't work anymore.
 * Most changes are moving the emscripten runtime functions to top-level
   calls rather than in the Module object.
 * Get rid of duplicated NULL_BYTE_PADDING_LENGTH
 * Fix ciphertext_length used without being declared
 * Fix things that caused the closure compiler to error, eg. using
   OLM_OPTIONS without a declaration.
 * Wait until module is inited to do OLM_ERROR = olm_error()

The main BREAKING CHANGE here is that the module now needs to initialise
asyncronously (because it has to load the wasm file). require()ing olm
now gives a function which needs to be called to create an instance.
The resulting object has a promise-like then() method that can be used
to detect when the module is ready. (We could use MODULARIZE_INSTANCE
to return the module directly as before, rather than the function,
but then we don't get the .then() method).
2018-09-21 16:01:51 +01:00
David Baker d6cd18df40
Merge pull request #55 from matrix-org/dbkr/pk_key_length
Fix output buffer length check
2018-09-20 11:30:27 +01:00
David Baker 65d4ac19c8 Fix output buffer length check
...when generating a key in PkDecryption.

The pubkey is base64ed on the output, so will be longer.
2018-09-19 14:10:12 +01:00
Hubert Chathi ed02c217e6 update address for sending feedback for olm 2018-08-15 22:03:48 -04:00
Richard van der Hoff 0dc27f73c4 Request patches to olm@matrix.org 2018-07-09 11:53:13 +01:00
Hubert Chathi 98e8ee1b0d prepare 2.3.0 2018-07-04 15:24:44 -04:00
Hubert Chathi dac2c1064e use void in type signatures for functions with no arguments 2018-06-28 17:13:52 -04:00
Hubert Chathi f709b062bb add functions for pickling/unpickling a decryption object 2018-06-28 17:10:36 -04:00
Hubert Chathi 3ed0ec226c add termination 2018-06-28 17:03:46 -04:00
Hubert Chathi b91c77721d improve public key encryption unit test 2018-06-28 15:11:53 -04:00