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