-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile.test
91 lines (63 loc) · 3.63 KB
/
Makefile.test
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
# Makefile -- UNIX-style make for no-crypto test config for t_cose
#
# Copyright (c) 2019-2022, Laurence Lundblade. All rights reserved.
# Copyright (c) 2020, Michael Eckel, Fraunhofer SIT.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# See BSD-3-Clause license in README.md
#
# ---- comment ----
# This t_cose makefile is for test crypto
# It has no dependency on any external crypto library, but doesn't
# support real ECDSA signing. The only external code needed is QCBOR.
# ---- QCBOR location ----
# Adjust this to the location of QCBOR in your build environment
#QCBOR_DIR=../../QCBOR/master
#QCBOR_INC=-I $(QCBOR_DIR)/inc
#QCBOR_LIB=$(QCBOR_DIR)/libqcbor.a
QCBOR_INC= -I/usr/include -I/usr/local/include
QCBOR_LIB= -l qcbor
# ---- crypto configuration -----
# Uses only the internal Brad Conte hash implementation that is bundled with t_cose
CRYPTO_INC=-I crypto_adapters/b_con_hash
CRYPTO_LIB=
CRYPTO_CONFIG_OPTS=-DT_COSE_USE_B_CON_SHA256
CRYPTO_OBJ=crypto_adapters/t_cose_test_crypto.o crypto_adapters/b_con_hash/sha256.o
CRYPTO_TEST_OBJ=
# ---- compiler configuration -----
# Optimize for size
C_OPTS=-Os -fPIC
# ---- T_COSE Config and test options ----
TEST_CONFIG_OPTS=-DT_COSE_ENABLE_HASH_FAIL_TEST -DT_COSE_DISABLE_SIGN_VERIFY_TESTS
TEST_OBJ=test/t_cose_test.o test/run_tests.o test/t_cose_make_test_messages.o $(CRYPTO_TEST_OBJ)
# ---- the main body that is invariant ----
T_COSE_INC=-I inc -I test -I src
ALL_INC=$(T_COSE_INC) $(QCBOR_INC) $(CRYPTO_INC)
CFLAGS=$(CMD_LINE) $(ALL_INC) $(C_OPTS) $(TEST_CONFIG_OPTS) $(CRYPTO_CONFIG_OPTS)
SRC_OBJ=src/t_cose_sign1_verify.o src/t_cose_sign1_sign.o src/t_cose_util.o src/t_cose_parameters.o src/t_cose_short_circuit.o
.PHONY: all clean
all: libt_cose.a t_cose_test
libt_cose.a: $(SRC_OBJ) $(CRYPTO_OBJ)
ar -r $@ $^
libt_cose.so: $(SRC_OBJ) $(CRYPTO_OBJ)
cc $^ $(CFLAGS) -dead_strip -o $@ -shared $(QCBOR_LIB) $(CRYPTO_LIB)
t_cose_test: main.o $(TEST_OBJ) libt_cose.a
cc -o $@ $^ $(QCBOR_LIB) $(CRYPTO_LIB)
clean:
rm -f $(SRC_OBJ) $(TEST_OBJ) $(CRYPTO_OBJ) libt_cose.a libt_cose.so t_cose_test main.o
# ---- public headers -----
PUBLIC_INTERFACE=inc/t_cose/t_cose_common.h inc/t_cose/t_cose_sign1_sign.h inc/t_cose/t_cose_sign1_verify.h
# ---- source dependecies -----
src/t_cose_util.o: src/t_cose_util.h src/t_cose_standard_constants.h inc/t_cose/t_cose_common.h src/t_cose_crypto.h
src/t_cose_sign1_verify.o: inc/t_cose/t_cose_sign1_verify.h src/t_cose_crypto.h src/t_cose_util.h src/t_cose_parameters.h inc/t_cose/t_cose_common.h src/t_cose_standard_constants.h src/t_cose_short_circuit.h
src/t_cose_parameters.o: src/t_cose_parameters.h src/t_cose_standard_constants.h inc/t_cose/t_cose_sign1_verify.h inc/t_cose/t_cose_common.h
src/t_cose_sign1_sign.o: inc/t_cose/t_cose_sign1_sign.h src/t_cose_standard_constants.h src/t_cose_crypto.h src/t_cose_util.h inc/t_cose/t_cose_common.h src/t_cose_short_circuit.h
src/t_cose_short_circuit.o: src/t_cose_short_circuit.h src/t_cose_standard_constants.h src/t_cose_crypto.h
# ---- test dependencies -----
test/t_cose_test.o: test/t_cose_test.h test/t_cose_make_test_messages.h src/t_cose_crypto.h $(PUBLIC_INTERFACE)
test/t_cose_make_test_messages.o: test/t_cose_make_test_messages.h inc/t_cose/t_cose_sign1_sign.h inc/t_cose/t_cose_common.h src/t_cose_standard_constants.h src/t_cose_crypto.h src/t_cose_util.h
test/run_test.o: test/run_test.h test/t_cose_test.h test/t_cose_hash_fail_test.h
# ---- crypto dependencies ----
crypto_adapters/t_cose_test_crypto.o: src/t_cose_crypto.h inc/t_cose/t_cose_common.h src/t_cose_standard_constants.h inc/t_cose/q_useful_buf.h crypto_adapters/b_con_hash/sha256.h
crypto_adapters/b_con_hash/sha256.o: crypto_adapters/b_con_hash/sha256.h