Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Add support for local verification #239

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Add support for local verification #239

wants to merge 2 commits into from

Conversation

s-zanella
Copy link
Contributor

This adds support for verification of modules in mitls-fstar without having to first build hacl-star.

The trick is to verify dependencies in hacl-star, if needed, without providers/evercrypt/fst in scope. The results are cached locally and used for verification, but can't be used for extraction because mitls-fstar relies on --cmi to e.g. inline EverCrypt.StaticConfig and EverCrypt.TargetConfig definitions, and for soundness of extraction of StackInline functions such as EverCrypt.Hash.alloca.

This PR will

  • error out before verification if the required Vale dependencies in $(HACL_HOME)/obj/ haven't been generated, informing the user to run make -C $(HACL_HOME) vale-fst first.
  • warn before verification if $(HACL_HOME)/obj/EverCrypt.fsti.checked doesn't exist, which suggests that hacl-star hasn't been built. The warning tells that hacl-star dependencies will be verified as needed and that cached results can't be used for extraction.
  • error out before extraction if there are locally cached hacl-star dependencies, informing the user to delete them and build hacl-star first.

Thanks @nik and @msprotz for suggesting this could be useful and discussing solutions.

…nd safeguards against using the cached results for extraction
@@ -79,7 +79,7 @@ FSTAR_HINTS ?= --use_hints --use_hint_hashes --record_hints
# verify... see https://github.com/FStarLang/FStar/issues/1652
FSTAR_NO_FLAGS = $(FSTAR_HOME)/bin/fstar.exe $(FSTAR_HINTS) \
--odir $(OUTPUT_DIR) --cache_checked_modules $(FSTAR_INCLUDES) --cmi \
--already_cached 'Prims FStar LowStar C Spec.Loops TestLib WasmSupport Hacl EverCrypt Vale LowParse Lib Spec -FStar.Old.Endianness -FStar.Test -C.Compat' \
--already_cached 'Prims FStar LowStar C Spec.Loops TestLib WasmSupport LowParse -FStar.Old.Endianness -FStar.Test -C.Compat' \
Copy link
Member

Choose a reason for hiding this comment

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

won't you have "did not expect module XXX to be checked" errors with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are only warnings e.g. Did not expected EverCrypt.HKDF to be already checked, but found it in an unexpected location ... (sic). I believe it will behave as before except for these warnings.

@@ -16,7 +16,10 @@ INCLUDE_PATHS = \
$(QD_HOME)/src/lowparse \
$(MITLS_HOME)/src/parsers/generated \
$(MITLS_HOME)/src/tls \
$(MITLS_HOME)/src/tls/obj
Copy link
Member

Choose a reason for hiding this comment

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

do you remember or understand why obj needs to be on the include path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is only needed to benefit from the cache in interactive mode. I think we can add it only in -in targets, but I'm not absolutely sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can. I removed it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants