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