forked from yuichitk/libteep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.cose
102 lines (80 loc) · 3.08 KB
/
Makefile.cose
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
#
# Copyright (c) 2020-2023 SECOM CO., LTD. All Rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause
#
CFLAGS = -Wall -g
LDFLAGS = $(CMD_LD) -lt_cose -lqcbor -lm
INC = $(CMD_INC) -I ./inc -I ./examples/inc
TAM0 = ./bin/teep_cose_tam0
TAM1 = ./bin/teep_cose_tam1
AGENT = ./bin/teep_cose_agent
VERIFIER = ./bin/teep_cose_verifier
TRUST_ANCHOR = ./bin/teep_cose_trust_anchor
SRCS = \
examples/teep_examples_common.c \
src/teep_common.c \
src/teep_message_decode.c \
src/teep_message_print.c \
src/teep_cose.c
OBJDIR = ./obj
OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCS)))
TAM0_OBJ = obj/examples/teep_cose_tam0.o
TAM1_OBJ = obj/examples/teep_cose_tam1.o
AGENT_OBJ = obj/examples/teep_cose_agent.o
VERIFIER_OBJ = obj/examples/teep_cose_verifier.o
TRUST_ANCHOR_OBJ = obj/examples/teep_cose_trust_anchor.o
ifeq ($(MBEDTLS),1)
# use MbedTLS
CFLAGS += -DLIBTEEP_PSA_CRYPTO_C=1
LDFLAGS += -lmbedcrypto
else
# use OpenSSL
MBEDTLS=0
LDFLAGS += -lcrypto
endif
.PHONY: all clean run
all: $(TAM0) $(TAM1) $(AGENT) $(VERIFIER) $(TRUST_ANCHOR)
include Makefile.common
$(OBJDIR)/%.o: %.c | $(OBJDIR) $(OBJDIR)/examples $(OBJDIR)/src
$(CC) $(CFLAGS) $(INC) -o $@ -c $<
$(TAM0_OBJ): examples/teep_cose_test_main.c | $(OBJDIR)/examples
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_TAM0=1 -o $@ -c $<
$(TAM1_OBJ): examples/teep_cose_test_main.c | $(OBJDIR)/examples
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_TAM1=1 -o $@ -c $<
$(AGENT_OBJ): examples/teep_cose_test_main.c | $(OBJDIR)/examples
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_AGENT=1 -o $@ -c $<
$(VERIFIER_OBJ): examples/teep_cose_test_main.c | $(OBJDIR)/examples
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_VERIFIER=1 -o $@ -c $<
$(TRUST_ANCHOR_OBJ): examples/teep_cose_test_main.c | $(OBJDIR)/examples
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_TRUST_ANCHOR=1 -o $@ -c $<
$(TAM0): $(OBJS) $(TAM0_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
$(TAM1): $(OBJS) $(TAM1_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
$(AGENT): $(OBJS) $(AGENT_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
$(VERIFIER): $(OBJS) $(VERIFIER_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
$(TRUST_ANCHOR): $(OBJS) $(TRUST_ANCHOR_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
$(RM) $(OBJS) $(TAM0_OBJ) $(TAM1_OBJ) $(AGENT_OBJ) $(VERIFIER_OBJ) $(TAM0) $(TAM1) $(AGENT) $(VERIFIER)
SOURCES := \
query_request.cbor \
query_response.cbor \
update.cbor \
teep_success.cbor \
teep_error.cbor \
evidence.cbor \
attestation_results.cbor
$(SOURCES):
$(MAKE) -C testfiles $@
run: $(TAM0) $(TAM1) $(AGENT) $(VERIFIER) $(SOURCES)
$(TAM0) ./testfiles/query_request.cbor ./testfiles/query_request_cose.cbor || exit 1
$(AGENT) ./testfiles/query_response.cbor ./testfiles/query_response_cose.cbor || exit 1
$(TAM1) ./testfiles/update.cbor ./testfiles/update_cose.cbor || exit 1
$(AGENT) ./testfiles/teep_success.cbor ./testfiles/teep_success_cose.cbor || exit 1
$(AGENT) ./testfiles/teep_error.cbor ./testfiles/teep_error_cose.cbor || exit 1
$(AGENT) ./testfiles/evidence.cbor ./testfiles/evidence_cose.cbor || exit 1
$(VERIFIER) ./testfiles/attestation_results.cbor ./testfiles/attestation_results_cose.cbor || exit 1