xref: /freebsd/lib/libsecureboot/openpgp/Makefile.inc (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2# decode OpenPGP signatures per rfc4880
3.PATH: ${.PARSEDIR}
4
5CFLAGS+= -DUSE_BEARSSL
6
7BRSSL_SRCS+= dearmor.c
8SRCS+= \
9	decode.c \
10	opgp_key.c \
11	opgp_sig.c
12
13opgp_key.o opgp_key.po opgp_key.pico: ta_asc.h
14
15# Generate ta_asc.h containing one or more OpenPGP trust anchors.
16#
17# Since each trust anchor must be processed individually,
18# we create ta_ASC as a list of pointers to them.
19#
20# If we are doing self-tests, we define another arrary vc_ASC
21# containing pointers to a signature of each trust anchor.
22# It is assumed that these v*.asc files are named similarly to
23# the appropriate t*.asc so that the relative order of vc_ASC
24# entries matches ta_ASC.
25#
26TA_ASC_LIST ?= ${.ALLSRC:Mt*.asc}
27VC_ASC_LIST ?= ${.ALLSRC:Mv*.asc}
28
29ta_asc.h:
30.if ${VE_SIGNATURE_LIST:MOPENPGP} != ""
31	@( echo '/* Autogenerated - DO NOT EDIT!!! */'; echo; \
32	echo "#define HAVE_TA_ASC 1"; \
33	set -- ${TA_ASC_LIST:@f@$f ${f:T:R}@}; \
34	while test $$# -ge 2; do \
35		file2c -sx "static const char $$2[] = {" ', 0x00 };' < $$1; \
36		shift 2; \
37	done; \
38	echo 'static const char *ta_ASC[] = { ${TA_ASC_LIST:T:R:ts,}, NULL };'; \
39	echo; ) > ${.TARGET}
40.if ${VE_SELF_TESTS} != "no"
41	@( echo "#define HAVE_VC_ASC 1"; \
42	set -- ${VC_ASC_LIST:@f@$f ${f:T:R}@}; \
43	while test $$# -ge 2; do \
44		file2c -sx "static const char $$2[] = {" ', 0x00 };' < $$1; \
45		shift 2; \
46	done; \
47	echo 'static const char *vc_ASC[] = { ${VC_ASC_LIST:T:R:ts,}, NULL };'; \
48	echo; ) >> ${.TARGET}
49.endif
50.endif
51