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

feat:Communication Layer #50

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open

Conversation

fabian-hk
Copy link
Contributor

This PR is an early version of a communication layer. It is a draft PR because it is not yet ready to merge. Currently, the following functionality is implemented:

  • Confidential send and receive functions
  • Authenticated send and receive functions

Note that these functions can and probably will change before this PR can be merged.

You can find minimal example protocols for these functions in this repository: https://github.com/fabian-hk/dolev-yao-star-communication-layer-examples/tree/main

Copy link
Collaborator

@TWal TWal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks overall good, my main question are:

  • What is the use of the receiver predicates? I don't understand what goal they achieve, and the pre-conditions they appear in seem in general difficult to prove.
  • I think we could require sender predicates to stay true when the trace grows, this would avoid using something like forall tr'. tr <$ tr' ==> higher_pred tr' ...

Makefile Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.Lemmas.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.Lemmas.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.Lemmas.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.Lemmas.fst Outdated Show resolved Hide resolved
Copy link
Contributor

@qaphla qaphla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding some preliminary comments so they don't get lost while reading through the rest of the PR.

src/lib/communication/DY.Lib.Communication.API.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.fst Outdated Show resolved Hide resolved
src/lib/communication/DY.Lib.Communication.API.fst Outdated Show resolved Hide resolved
@fabian-hk fabian-hk force-pushed the feature/communication-layer branch from a9f3be2 to d0682e8 Compare December 10, 2024 11:11
@fabian-hk fabian-hk changed the base branch from main to feature/add-key-to-crypto-preds December 10, 2024 11:12
@fabian-hk fabian-hk force-pushed the feature/add-key-to-crypto-preds branch from f2945e2 to 96c58c5 Compare December 20, 2024 13:27
@fabian-hk fabian-hk force-pushed the feature/communication-layer branch from 129ea3a to 46081f2 Compare December 20, 2024 15:12
Base automatically changed from feature/add-key-to-crypto-preds to main December 23, 2024 09:22
@fabian-hk fabian-hk force-pushed the feature/communication-layer branch from 46081f2 to e54cca9 Compare December 26, 2024 14:25
@fabian-hk fabian-hk force-pushed the feature/communication-layer branch from b3630b9 to c2205c5 Compare January 10, 2025 09:21
@fabian-hk fabian-hk requested a review from qaphla January 22, 2025 15:49
@fabian-hk fabian-hk marked this pull request as ready for review January 22, 2025 15:49
@fabian-hk fabian-hk requested a review from a team as a code owner January 22, 2025 15:49
@fabian-hk
Copy link
Contributor Author

This PR is ready to be merged from my side. There will be improvements in the future, but I believe this is a solid basis.

@fabian-hk fabian-hk force-pushed the feature/communication-layer branch from 3743479 to 7deb02c Compare January 23, 2025 17:03
qaphla
qaphla previously approved these changes Jan 24, 2025
Copy link
Contributor

@qaphla qaphla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I have a lot of comments, I think it's probably best to get this merged properly, and then I can turn the most relevant ones into issues for the future (since none seem really blocking to me, more things that we should keep in mind as we continue to use this library and see what additional functionality we want out of it). It would be nice if a few of the small changes were made, but these also seem not critical to me, and I think for the sake of ease of review, it would be better to get this merged, and then do a follow-up cleanup PR for any minor changes.

fabian-hk and others added 3 commits January 30, 2025 13:48
* Some small cleanup of EoL spaces

* Revised confidential message/request receipt postconditions

* Cleaned up some invariants and proofs with help of a small utility function

---------

Co-authored-by: Klaas Pruiksma <klaas.pruiksma@sec.uni-stuttgart.de>
Copy link
Contributor

@qaphla qaphla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As before, I think this looks good enough to merge and use --- there are of course always improvements to be made (e.g., I am currently working on making more of the library opaque to SMT), but this is functional in its current state.

The opinion of @TWal on the parse_and_pred function in particular would be welcome, but also generally on the whole library (I don't want to unilaterally merge it without input from the other working groups).

Comment on lines +16 to +23
val parse_and_pred:
#a:Type -> {| parseable_serializeable bytes a |} ->
(p:a -> Type0) -> (bytes -> Type0)
let parse_and_pred #a p = (fun b ->
match parse a b with
| None -> False
| Some x -> p x
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels to me like a generally good utility function, which we probably do want to have (and which could probably also be used more broadly) --- I also introduced it for that reason. That said, I see a few possible problems with it:

  • This may not be the right place for it. It doesn't seem to fit in exactly with the other comparse glue, but it also feels strange to have this utils file with only a single function. Maybe this is less relevant if we have more useful functions of this form. Maybe also it belongs in the main Comparse repo (in a more general form, using an arbitrary bytes_like), rather than here.
  • I'm not sure if the use of this will be bad for the SMT solver, in particular since it does often require a lambda to define the input predicate p. My sense is that as long as we don't want to talk about equivalence of these predicates that shouldn't be too big of a problem, but I am far from an expert on the encoding used.

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.

3 participants