Commit graph

19 commits

Author SHA1 Message Date
Tulir Asokan
315d2ab17d all: fix staticcheck issues
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run
2025-12-08 00:07:25 +02:00
Tulir Asokan
c716f30959 crypto/register: don't use init in *olm packages 2025-09-11 14:14:15 +03:00
Sumner Evans
20db7f86ec
crypto/goolm: reorganize pickle code
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-01-17 11:31:49 -07:00
Sumner Evans
d60d8d4744
crypto/aessha2: extract AES SHA2 functionality from crypto/goolm/cipher
This also refactors it to not recompute the keys via HKDF repeatedly.

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-01-17 11:23:45 -07:00
Sumner Evans
4a2557ed15
crypto: propagate more errors
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 09:39:19 -06:00
Sumner Evans
9f74b58d84
crypto/goolm/crypto: use stdlib for HKDF and HMAC operations
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 09:08:34 -06:00
Sumner Evans
d2aaa2dc5c
goolm/libolmpickle: add Decoder for easier pickling API
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 09:06:46 -06:00
Sumner Evans
e525e151e1
goolm/libolmpickle: add Encoder for easier pickling API
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 09:06:45 -06:00
Sumner Evans
bc1f09086f
goolm: use constants for pickle lengths when possible
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 08:54:48 -06:00
Sumner Evans
fbea2a067c
goolm: simplify return statements
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 08:53:43 -06:00
Sumner Evans
eb632a9994
goolm: simplify tests using testify
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 08:47:56 -06:00
Sumner Evans
7cc46f1ff3
crypto: always read from crypto/rand
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-25 08:17:13 -06:00
Sumner Evans
66c417825b
crypto/olm: add tests comparing libolm and goolm, replace crypto/ed25519 -> maunium.net/go/mautrix/crypto/ed25519
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run
The following tests were added that compare libolm and goolm against
each other.

* account: add (un)pickle tests
* groupsession: add test for (en|de)cryption for group sessions
* account: test IdentityKeysJSON and OneTimeKeys
* session: add test for encrypt/decrypt
* session: add test for private key format
* outboundsession: add differential fuzz test for encryption

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-08-23 09:16:58 -06:00
Sumner Evans
213b6ec80d
crypto/olm: make everything into an interface
This commit turns all of the crypto objects that are provided by olm
into interfaces so that multiple implementations (libolm and goolm right
now) can implement it.

As part of this refactor, the libolm code has been moved to a separate
package (goolm was already in its own package). Both packages now
implement structs which implement the various interfaces.

Additional changes:

* goolm/goolmbase64: split into separate package (needed to avoid import
  loops)
* olm/errors: unified all errors under the olm package
* ci: remove libolm before building with goolm flag (this allows us to
  use ./... to build all of the packages under goolm)

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-08-23 09:16:33 -06:00
Sumner Evans
b369efbc06
goolm: rename a couple files
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-02-09 10:20:09 -07:00
Sumner Evans
a0b92fd185
crypto/goolm/session: use crypto/rand instead of math/rand
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-01-15 15:15:00 -07:00
Tulir Asokan
893afc7259 Fix typos and JSON field names 2023-12-15 15:56:38 +02:00
Tulir Asokan
ab39495bc6 Clean up goolm and update import path 2023-12-15 15:56:38 +02:00
Lukas Gallandi
9c109c97a6 Add pure Go implementation of libolm 2023-12-15 15:56:38 +02:00