forked from laurencelundblade/t_cose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.psa
85 lines (58 loc) · 3.5 KB
/
Makefile.psa
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
# Makefile -- UNIX-style make for t_cose using crypto with MBed Crypto
# MBed Crypto uses the PSA Crypto interface
#
# Copyright (c) 2019, Laurence Lundblade. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# See BSD-3-Clause license in README.md
#
# ---- comment ----
# This is for PSA Crypto / MBed Crypto. See longer explanation in README.md
# ---- QCBOR location ----
# Adjust this to the location of QCBOR in your build environment
QCBOR_INC= -I ../../QCBOR/master/inc
QCBOR_LIB=../../QCBOR/master/libqcbor.a
# ---- crypto configuration -----
# The lib and inc directories may have to be adjusted for your build environment.
CRYPTO_LIB=../../mbed-crypto/library/libmbedcrypto.a
CRYPTO_INC= -I ../../mbed-crypto/include/
CRYPTO_CONFIG_OPTS=-DT_COSE_USE_PSA_CRYPTO
CRYPTO_OBJ=crypto_adapters/t_cose_psa_crypto.o
CRYPTO_TEST_OBJ=test/t_cose_make_psa_test_key.o
# ---- compiler configuration -----
C_OPTS=-Os -Wall -Wconversion -Wconstant-conversion -Werror -pedantic-errors -Wextra -Wshadow -Wparentheses -xc -std=c99
# ---- T_COSE Config and test options ----
TEST_CONFIG_OPTS=
TEST_OBJ=test/t_cose_test.o test/run_tests.o test/t_cose_sign_verify_test.o test/t_cose_make_test_messages.o $(CRYPTO_TEST_OBJ)
# ---- the main body that is invariant ----
INC=-I inc -I test -I src
ALL_INC=$(CRYPTO_INC) $(QCBOR_INC) $(INC)
CFLAGS=$(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
all: libt_cose.a t_cose_test t_cose_basic_example_psa
libt_cose.a: $(SRC_OBJ) $(CRYPTO_OBJ)
ar -r $@ $^
t_cose_test: main.o $(TEST_OBJ) libt_cose.a
cc -o $@ $^ $(QCBOR_LIB) $(CRYPTO_LIB)
t_cose_basic_example_psa: examples/t_cose_basic_example_psa.o libt_cose.a
cc -o $@ $^ $(QCBOR_LIB) $(CRYPTO_LIB)
clean:
rm -f $(SRC_OBJ) $(TEST_OBJ) $(CRYPTO_OBJ) t_cose_basic_example_psa t_cose_test libt_cose.a main.o
# ---- public headers -----
PUBLIC_INTERFACE=inc/t_cose_common.h inc/t_cose_sign1_sign.h inc/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_common.h src/t_cose_crypto.h
src/t_cose_sign1_verify.o: inc/t_cose_sign1_verify.h src/t_cose_crypto.h src/t_cose_util.h src/t_cose_parameters.h inc/t_cose_common.h src/t_cose_standard_constants.h
src/t_cose_parameters.o: src/t_cose_parameters.h src/t_cose_standard_constants.h inc/t_cose_sign1_verify.h inc/t_cose_common.h
src/t_cose_sign1_sign.o: inc/t_cose_sign1_sign.h src/t_cose_standard_constants.h src/t_cose_crypto.h src/t_cose_util.h inc/t_cose_common.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_sign_verify_test.o: test/t_cose_sign_verify_test.h test/t_cose_make_test_messages.h src/t_cose_crypto.h test/t_cose_make_test_pub_key.h $(PUBLIC_INTERFACE)
test/t_cose_make_test_messages.o: test/t_cose_make_test_messages.h inc/t_cose_sign1_sign.h inc/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
test/t_cose_make_psa_test_key.o: test/t_cose_make_test_pub_key.h src/t_cose_standard_constants.h inc/t_cose_common.h
# ---- crypto dependencies ----
crypto_adapters/t_cose_psa_crypto.o: src/t_cose_crypto.h inc/t_cose_common.h src/t_cose_standard_constants.h inc/q_useful_buf.h
# ---- example dependencies ----
t_cose_basic_example_psa.o: $(PUBLIC_INTERFACE)