• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H16-Sep-2021-2825

android/H03-May-2022-11,4227,550

cmake/H16-Sep-2021-128

docs/H03-May-2022-781598

fuzzing/H16-Sep-2021-658494

include/H16-Sep-2021-3,6211,579

javascript/H03-May-2022-270220

lib/H16-Sep-2021-11,4108,654

python/H03-May-2022-3,6892,480

src/H16-Sep-2021-5,8684,534

tests/H03-May-2022-2,8142,052

tracing/H16-Sep-2021-244207

xcode/H16-Sep-2021-4,6723,546

.editorconfigH A D16-Sep-2021212 1511

.gitignoreH A D16-Sep-2021487 3635

.gitlab-ci.ymlH A D16-Sep-2021796 4942

CHANGELOG.rstH A D16-Sep-202115.2 KiB361258

CONTRIBUTING.mdH A D16-Sep-20213 KiB6851

LICENSEH A D16-Sep-20219.9 KiB178150

MakefileH A D16-Sep-202114.7 KiB412302

OLMKit.podspecH A D16-Sep-20212.2 KiB6444

Package.swiftH A D16-Sep-20211.4 KiB5348

README.mdH A D16-Sep-20216.8 KiB231164

Windows64.cmakeH A D16-Sep-2021970 3022

common.mkH A D16-Sep-202134 53

exports.pyH A D16-Sep-2021374 1912

jenkins.shH A D16-Sep-2021164 159

lib_exports.shH A D16-Sep-2021207 41

libolm.versionH A D16-Sep-202170 54

olm.pc.inH A D16-Sep-2021310 119

version_script.verH A D16-Sep-2021156 108

README.md

1# Olm
2
3An implementation of the Double Ratchet cryptographic ratchet described by
4https://whispersystems.org/docs/specifications/doubleratchet/, written in C and
5C++11 and exposed as a C API.
6
7The specification of the Olm ratchet can be found in [docs/olm.md](docs/olm.md).
8
9This library also includes an implementation of the Megolm cryptographic
10ratchet, as specified in [docs/megolm.md](docs/megolm.md).
11
12## Building
13
14To build olm as a shared library run either:
15
16```bash
17cmake . -Bbuild
18cmake --build build
19```
20
21or:
22
23```bash
24make
25```
26
27Using cmake is the preferred method for building the shared library; the
28Makefile may be removed in the future.
29
30To run the tests when using cmake, run:
31
32```bash
33cd build/tests
34ctest .
35```
36To run the tests when using make, run:
37
38```bash
39make test
40```
41
42To build the JavaScript bindings, install emscripten from http://kripken.github.io/emscripten-site/ and then run:
43
44```bash
45make js
46```
47
48Note that if you run emscripten in a docker container, you need to pass through
49the EMCC_CLOSURE_ARGS environment variable.
50
51To build the android project for Android bindings, run:
52
53```bash
54cd android
55./gradlew clean assembleRelease
56```
57
58To build the Xcode workspace for Objective-C bindings, run:
59
60```bash
61cd xcode
62pod install
63open OLMKit.xcworkspace
64```
65
66To build the Python bindings, first build olm as a shared library as above, and
67then run:
68
69```bash
70cd python
71make
72```
73
74to make both the Python 2 and Python 3 bindings.  To make only one version, use
75``make olm-python2`` or ``make olm-python3`` instead of just ``make``.
76
77To build olm as a static library (which still needs libstdc++ dynamically) run
78either:
79
80```bash
81cmake . -Bbuild -DBUILD_SHARED_LIBS=NO
82cmake --build build
83```
84
85or
86
87```bash
88make static
89```
90
91The library can also be used as a dependency with CMake using:
92
93```cmake
94find_package(Olm::Olm REQUIRED)
95target_link_libraries(my_exe Olm::Olm)
96```
97
98## Bindings
99
100libolm can be used in different environments using bindings. In addition to the
101JavaScript, Python, Java (Android), and Objective-C bindings included in this
102repository, some bindings are (in alphabetical order):
103
104- [cl-megolm](https://github.com/K1D77A/cl-megolm) (MIT) Common Lisp bindings
105- [dart-olm](https://gitlab.com/famedly/company/frontend/libraries/dart-olm) (AGPLv3) Dart bindings
106- [Dhole/go-olm](https://github.com/Dhole/go-olm) (Apache-2.0) Go bindings
107- [jOlm](https://github.com/brevilo/jolm) (Apache-2.0) Java bindings
108- [libQtOlm](https://gitlab.com/b0/libqtolm/) (GPLv3) Qt bindings
109- [matrix-kt](https://github.com/Dominaezzz/matrix-kt) (Apache-2.0) Kotlin
110  library for Matrix, including Olm methods
111- [maunium.net/go/mautrix/crypto/olm](https://github.com/tulir/mautrix-go/tree/master/crypto/olm)
112  (Apache-2.0) fork of Dhole/go-olm
113- [nim-olm](https://gitea.com/BarrOff/nim-olm) (MIT) Nim bindings
114- [olm-sys](https://gitlab.gnome.org/BrainBlasted/olm-sys) (Apache-2.0) Rust
115  bindings
116
117Note that bindings may have a different license from libolm, and are *not*
118endorsed by the Matrix.org Foundation C.I.C.
119
120## Release process
121
122First: bump version numbers in ``common.mk``, ``CMakeLists.txt``,
123``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``, ``Package.swift``,
124and ``android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java`` in function ``getVersion()```.
125
126Also, ensure the changelog is up to date, and that everything is committed to
127git.
128
129It's probably sensible to do the above on a release branch (``release-vx.y.z``
130by convention), and merge back to master once the release is complete.
131
132```bash
133make clean
134
135# build and test C library
136make test
137
138# build and test JS wrapper
139make js
140(cd javascript && \
141     npm run test && \
142     sha256sum olm.js olm_legacy.js olm.wasm > checksums.txt && \
143     gpg -b -a -u F75FDC22C1DE8453 checksums.txt && \
144     npm publish)
145
146VERSION=x.y.z
147git tag $VERSION -s
148git push --tags
149
150# OLMKit CocoaPod release
151# Make sure the version OLMKit.podspec is the same as the git tag
152# (this must be checked before git tagging)
153pod spec lint OLMKit.podspec --use-libraries --allow-warnings
154pod trunk push OLMKit.podspec --use-libraries --allow-warnings
155# Check the pod has been successully published with:
156pod search OLMKit
157```
158
159Python and JavaScript packages are published to the registry at
160<https://gitlab.matrix.org/matrix-org/olm/-/packages>.  The GitLab
161documentation contains instructions on how to set up twine (Python) and npm
162(JavaScript) to upload to the registry.
163
164
165## Design
166
167Olm is designed to be easy port to different platforms and to be easy
168to write bindings for.
169
170It was originally implemented in C++, with a plain-C layer providing the public
171API. As development has progressed, it has become clear that C++ gives little
172advantage, and new functionality is being added in C, with C++ parts being
173rewritten as the need ariases.
174
175### Error Handling
176
177All C functions in the API for olm return ``olm_error()`` on error.
178This makes it easy to check for error conditions within the language bindings.
179
180### Random Numbers
181
182Olm doesn't generate random numbers itself. Instead the caller must
183provide the random data. This makes it easier to port the library to different
184platforms since the caller can use whatever cryptographic random number
185generator their platform provides.
186
187### Memory
188
189Olm avoids calling malloc or allocating memory on the heap itself.
190Instead the library calculates how much memory will be needed to hold the
191output and the caller supplies a buffer of the appropriate size.
192
193### Output Encoding
194
195Binary output is encoded as base64 so that languages that prefer unicode
196strings will find it easier to handle the output.
197
198### Dependencies
199
200Olm uses pure C implementations of the cryptographic primitives used by
201the ratchet. While this decreases the performance it makes it much easier
202to compile the library for different architectures.
203
204## Contributing
205
206Please see [CONTRIBUTING.md](CONTRIBUTING.md) when making contributions to the library.
207
208## Security assessment
209
210Olm 1.3.0 was independently assessed by NCC Group's Cryptography Services
211Practive in September 2016 to check for security issues: you can read all
212about it at
213https://www.nccgroup.com/globalassets/our-research/us/public-reports/2016/november/ncc_group_olm_cryptogrpahic_review_2016_11_01.pdf
214and https://matrix.org/blog/2016/11/21/matrixs-olm-end-to-end-encryption-security-assessment-released-and-implemented-cross-platform-on-riot-at-last/
215
216## Bug reports
217
218Please file bug reports at https://github.com/matrix-org/olm/issues
219
220## What's an olm?
221
222It's a really cool species of European troglodytic salamander.
223http://www.postojnska-jama.eu/en/come-and-visit-us/vivarium-proteus/
224
225## Legal Notice
226
227The software may be subject to the U.S. export control laws and regulations
228and by downloading the software the user certifies that he/she/it is
229authorized to do so in accordance with those export control laws and
230regulations.
231