Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent: quantum-resistant double ratchet encryption #1024

Merged
merged 19 commits into from
Mar 10, 2024
Merged

agent: quantum-resistant double ratchet encryption #1024

merged 19 commits into from
Mar 10, 2024

Conversation

epoberezkin
Copy link
Member

@epoberezkin epoberezkin commented Mar 3, 2024

  • versioning of the envelope sizes in agent-agent protocol.
  • make JSON parser to support old ratchets in the database (via omittedField)
  • support upgrading existing connections to support PQ encryption.
  • store intended connection encryption mode and use it during ratchet resynchronisation.
  • more tests: enable/disable PQ via functional API, test connection version upgrade to support PQ (so that envelope sizes change and PQ encryption is enabled).
  • allow version 1 for E2E encryption and replace with 2 in parser, possibly the same for duplex handshake in agent version. this is not necessary, as these parameters are only used in 1-time links that don't need this adjustment.
  • joinContactInitialKeys: PQSupportOn -> IKUsePQ - I will change to IKNoPQ PQSupportOn
  • export necessary EQ instances
  • optional: add a new message to ratchet resynchronisation flow to allow accepting PQ encryption in resync reply message (two proposals would still have to be accepted, as clients can initiate sync concurrently).
  • optional: support different DH algorithms

* doc

* diff

* ratchet header

* types

* ratchet step with PQ KEM, message header with KEM

* comment

* update types, remove Eq instances, store KEM keys to database

* pqx3dh

* PQ double ratchet test

* pqdr tests pass

* fix most tests

* refactor

* allow KEM proposals from both sides

* test names

* agent API parameters to use PQ KEM

* initialize ratchet state for enabling KEM

* fix/test KEM state machine to support disabling/enabling via messages

* more tests

* diff

* diff2

* refactor

* refactor

* refactor

* refactor

* remove Maybe

* rename

* add PQ encryption status to CON, MID and MSG events and sendMessage API results

* different PQ parameter when creating connection

* rename/reorganize types for PQ encryption modes

* rename

* fix testWaitDeliveryTimeout

* rename

* rename2

* ghc8107

* rename

* increase timeouts for concurrent send/receive test

* enable all tests

---------

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
epoberezkin and others added 18 commits March 4, 2024 20:13
* correctly parse new Ratchet fields when omitted

* rfc: migrating connection versions to pqdr

* update rfc

* WIP (dont commit)

* rename versions

* update ratchet version based on PQ encryption feature flag

* remove duplicate function

* synchronize ratchet, fix tests, refactor

* comments

* test

* pattern
* extract batchTransmissions_

* add Simplex.Messaging.Compression

* add combined compression/batching

* force NonEmpty for batching

* hide FFI and allocation related IO

* split packing

* remove batch compression, tweak API

* OCD over API

* remove Empty, extract passthrough const

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
* envelope sizes dependent on PQ encryption (WIP)

* add "supported" flag to ratchets, update this flag on ratchet resync

* change connection PQ status on sendMessage

* comment, fix

* refactor
…n in connections (#1031)

* pqdr: use different newtypes for supporting and enabling PQ encryption in connections

* rename field, fix test

* refactor
…ndshake, fix incorrect PQ support (#1032)

* pqdr: agent api to confirm PQ encryption support during connection handshake

* fix CONF, tests

* fix REQ, tests

* remove unused
* convert compress to a wrapper with passthrough fallback

* add compress1 for non-batched compression

* use original size as upper bound for scratch

* refactor

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
* core: restore Eq instances

* remove duplicates from tests
* pqdr: more tests, pass e2e version to rcEncrypt from config

* fix
@epoberezkin epoberezkin merged commit 819ae70 into master Mar 10, 2024
2 of 3 checks passed
@epoberezkin epoberezkin deleted the pq branch March 10, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants