-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (65 loc) · 2.05 KB
/
Makefile
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
# Copyright (C) 2022 Nitrokey GmbH
# SPDX-License-Identifier: CC0-1.0
-include variables.mk
export RUST_LOG ?= info,cargo_tarpaulin=off
export OPCARD_DANGEROUS_TEST_CARD_USB_VENDOR ?= 0000
export OPCARD_DANGEROUS_TEST_CARD_USB_PRODUCT ?= 000000
export OPCARD_DANGEROUS_TEST_CARD_PGP_VENDOR ?= 0000
export OPCARD_DANGEROUS_TEST_CARD_PGP_SERIAL ?= 000000
FUZZ_JOBS?=$(shell nproc)
FUZZ_DURATION?="0"
.NOTPARALLEL:
.PHONY: check
check:
cargo check --all-features --all-targets --workspace
.PHONY: lint
lint:
cargo check --all-features --all-targets --workspace
cargo check --no-default-features --all-targets
cargo clippy --all-features --all-targets -- --deny warnings
cargo fmt -- --check
RUSTDOCFLAGS='-Dwarnings' cargo doc --all-features --package opcard
reuse lint
.PHONY: fix
fix:
cargo fix --all-features
cargo fmt
.PHONY: test
test:
cargo test --features vpicc,rsa4096-gen
.PHONY: test
dangerous-real-card-test:
ps aux | grep pcscd | grep -v grep || sudo pcscd
cargo test --features rsa2048-gen,rsa4096,dangerous-test-real-card sequoia_hardware
sudo pkill pcscd
cargo test --features rsa2048-gen,rsa4096-gen,dangerous-test-real-card gpg_hardware
.PHONY: fuzz
fuzz: fuzz-corpus
cargo +nightly fuzz run --jobs ${FUZZ_JOBS} fuzz_target_1 fuzz/corpus -- -max_total_time=${FUZZ_DURATION}
.PHONY: fuzz-corpus
fuzz-corpus:
mkdir -p fuzz/corpus
cd fuzz && cargo r --bin opcard-fuzz
.PHONY: fuzz-cov
fuzz-cov:
cargo +nightly fuzz coverage fuzz_target_1 fuzz/corpus
llvm-cov show --format=html \
--instr-profile=fuzz/coverage/fuzz_target_1/coverage.profdata \
fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_target_1 \
> fuzz_coverage.html
.PHONY: tarpaulin
tarpaulin:
cargo tarpaulin --features vpicc,rsa4096-gen -o Html -o Xml
.PHONY: ci
ci: lint tarpaulin
.PHONY: clean
clean:
cargo clean
cd fuzz && cargo clean && rm -rf corpus
rm -f fuzz_coverage.html
.PHONY: example-vpicc
example-vpicc:
cargo run --example vpicc --features vpicc,rsa4096-gen
.PHONY: example-usbip
example-usbip:
cargo run --example usbip --features virt,rsa4096-gen,apdu-dispatch