Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (99 loc) · 4.7 KB
/
Copy pathMakefile
File metadata and controls
134 lines (99 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
abs_dir := $(shell pwd)
DOCKER_IMAGE ?= qverify
# Extra args for qverify-v1-pdfs in Docker, e.g. SIM_FLAGS='--num-qubits 64 --shots 40'
SIM_FLAGS ?=
clean_spthy=./tools/clean_spthy
tamarin=./tools/tamarin-prover
TAMARIN_FLAGS=
# TAMARIN_FLAGS= -c=100
# TAMARIN_FLAGS=+RTS -N16 -RTS # limit number of CPUs used
# TAMARIN_FLAGS=+RTS -s -M1000000000 -RTS # limit amount of memory used
type=EB
Adv=Network
exec=false
auth=false
secrecy=false
ER=FEC
BO=PostM
M4_FLAGS= --define=type=$(type) --define=Adv=$(Adv) --define=auth=$(auth) --define=secrecy=$(secrecy) --define=exec=$(exec) --define=ER=$(ER) --define=BO=$(BO)
# ifeq ($(Adv), Network)
# M4_FLAGS=net
# endif
# make type=EB auth=true ER=REC BO=PostM Adv=Network prove
preprocess:
m4 ${M4_FLAGS} main.m4 > generated_$(type).spthy
$(clean_spthy) generated_$(type).spthy
test: preprocess
${tamarin} ${TAMARIN_FLAGS} --quit-on-warning generated_$(type).spthy
prove: preprocess
${tamarin} ${TAMARIN_FLAGS} --prove --output=generated_$(type).proof generated_$(type).spthy
# --with-dot=$(abs_dir)/tools/tamarin-cleandot.py
# --with-dot=$(abs_dir)/tools/tamarin-cleandot.py
web: preprocess
${tamarin} interactive generated_$(type).spthy
gen_proofs:
chmod a+x ./tools/compile_models ./tools/gen_proofs ./tools/collect ./tools/clean_spthy ./tools/test_models ./tools/check_incompleted ./tools/setup.sh ./tools/maude/*
./tools/compile_models
# ./tools/test_models
time ./tools/gen_proofs | tee run.log
./tools/collect --output=./output/generated_results.html ./output/
web_proofs:
echo $(abs_dir)
${tamarin} interactive ./output/
all: prove web
clean:
$(RM) -f generated_*
$(RM) -f client_session_key.aes
clean_tmp:
$(RM) -f ./output/*.tmp
clean_theory:
$(RM) -f ./output/*.spthy
clean_proofs:
$(RM) -f ./output/*.proof
clean_all: clean clean_theory clean_proofs clean_tmp
$(RM) -f run.log
# ─── Docker targets ──────────────────────────────────────────────────────────
# Ensure host _output is writable and (on macOS) strip xattrs that cause EPERM on bind mounts.
.PHONY: docker-prepare-output docker-prepare-host-output
docker-prepare-output:
mkdir -p ./_output
chmod -R u+rwX ./_output
@command -v xattr >/dev/null 2>&1 && xattr -cr ./_output 2>/dev/null || true
# Remove generated theories on the *host* before Tamarin Docker runs. Docker Desktop on macOS
# cannot chmod/unlink/overwrite existing files under ~/Desktop bind mounts (EPERM); creating
# new files after host-side rm works. Does not touch _output/simulation/ or .proof files.
docker-prepare-host-output: docker-prepare-output
rm -f ./_output/*.spthy ./_output/*.tmp 2>/dev/null || true
# Build the Docker image (re-run whenever the Dockerfile changes)
docker-build:
docker compose build
# Run the full proof-generation pipeline inside Docker.
# Outputs land in ./_output/ on the HOST (mounted into the container).
docker-gen-proofs: docker-prepare-host-output
docker compose run --rm tamarin make gen_proofs
# Run statistical simulations only; PDFs and CSV land in ./_output/simulation/
docker-simulation: docker-prepare-output
docker compose run --rm simulation qverify-v1-pdfs --output-dir /workspace/output/simulation $(SIM_FLAGS)
# Run Tamarin gen_proofs then statistical simulation. (Running both containers in parallel on
# the same ./_output bind mount breaks on Docker Desktop macOS: find ./output in gen_proofs
# returns "Operation not permitted".)
docker-gen-proofs-and-simulation: docker-prepare-host-output
docker compose build
docker compose run --rm tamarin make gen_proofs
docker compose run --rm simulation qverify-v1-pdfs --output-dir /workspace/output/simulation $(SIM_FLAGS)
# Collect proof summaries into ./_output/generated_results.html
# (Usually run automatically by gen_proofs but available here just in case)
docker-collect: docker-prepare-output
docker compose run --rm tamarin ./tools/collect --output=./output/generated_results.html ./output/
# Open an interactive shell inside the container for debugging
docker-shell: docker-prepare-output
docker compose run --rm tamarin bash
# Launch Tamarin interactive mode in Docker. Access the GUI at http://127.0.0.1:$(PORT)
# Use with: make docker-web [type=EB|PM] [PORT=3001]
PORT ?= 3001
docker-web: docker-prepare-output
docker compose run --rm -p $(PORT):3001 -e type=$(type) tamarin sh -c 'make preprocess && ./tools/tamarin-prover interactive generated_$${type}.spthy'
# Launch Tamarin interactive mode over all proofs in output/. Requires gen_proofs first.
# Access at http://127.0.0.1:$(PORT)
docker-web-proofs: docker-prepare-output
docker compose run --rm -p $(PORT):3001 tamarin ./tools/tamarin-prover interactive ./output/