xref: /freebsd/lib/libsecureboot/openpgp/Makefile.inc (revision 9bee6a6083228d0e6abfb991fdbb4edf020fd438)
15fff9558SSimon J. Gerraty# $FreeBSD$
25fff9558SSimon J. Gerraty
35fff9558SSimon J. Gerraty# decode OpenPGP signatures per rfc4880
45fff9558SSimon J. Gerraty.PATH: ${.PARSEDIR}
55fff9558SSimon J. Gerraty
65fff9558SSimon J. GerratyCFLAGS+= -DUSE_BEARSSL
75fff9558SSimon J. Gerraty
85fff9558SSimon J. GerratyBRSSL_SRCS+= dearmor.c
95fff9558SSimon J. GerratySRCS+= \
105fff9558SSimon J. Gerraty	decode.c \
115fff9558SSimon J. Gerraty	opgp_key.c \
125fff9558SSimon J. Gerraty	opgp_sig.c
135fff9558SSimon J. Gerraty
145fff9558SSimon J. Gerratyopgp_key.o opgp_key.po opgp_key.pico: ta_asc.h
155fff9558SSimon J. Gerraty
165fff9558SSimon J. Gerraty# Generate ta_asc.h containing one or more OpenPGP trust anchors.
175fff9558SSimon J. Gerraty#
185fff9558SSimon J. Gerraty# Since each trust anchor must be processed individually,
195fff9558SSimon J. Gerraty# we create ta_ASC as a list of pointers to them.
205fff9558SSimon J. Gerraty#
215fff9558SSimon J. Gerraty# If we are doing self-tests, we define another arrary vc_ASC
225fff9558SSimon J. Gerraty# containing pointers to a signature of each trust anchor.
235fff9558SSimon J. Gerraty# It is assumed that these v*.asc files are named similarly to
245fff9558SSimon J. Gerraty# the appropriate t*.asc so that the relative order of vc_ASC
255fff9558SSimon J. Gerraty# entries matches ta_ASC.
265fff9558SSimon J. Gerraty#
27*9bee6a60SSimon J. GerratyTA_ASC_LIST ?= ${.ALLSRC:Mt*.asc}
28*9bee6a60SSimon J. GerratyVC_ASC_LIST ?= ${.ALLSRC:Mv*.asc}
29*9bee6a60SSimon J. Gerraty
30*9bee6a60SSimon J. Gerratyta_asc.h:
315fff9558SSimon J. Gerraty.if ${VE_SIGNATURE_LIST:MOPENPGP} != ""
325fff9558SSimon J. Gerraty	@( echo '/* Autogenerated - DO NOT EDIT!!! */'; echo; \
335fff9558SSimon J. Gerraty	echo "#define HAVE_TA_ASC 1"; \
34*9bee6a60SSimon J. Gerraty	set -- ${TA_ASC_LIST:@f@$f ${f:T:R}@}; \
355fff9558SSimon J. Gerraty	while test $$# -ge 2; do \
365fff9558SSimon J. Gerraty		file2c -sx "static const char $$2[] = {" ', 0x00 };' < $$1; \
375fff9558SSimon J. Gerraty		shift 2; \
385fff9558SSimon J. Gerraty	done; \
39*9bee6a60SSimon J. Gerraty	echo 'static const char *ta_ASC[] = { ${TA_ASC_LIST:T:R:ts,}, NULL };'; \
405fff9558SSimon J. Gerraty	echo; ) > ${.TARGET}
415fff9558SSimon J. Gerraty.if ${VE_SELF_TESTS} != "no"
425fff9558SSimon J. Gerraty	@( echo "#define HAVE_VC_ASC 1"; \
43*9bee6a60SSimon J. Gerraty	set -- ${VC_ASC_LIST:@f@$f ${f:T:R}@}; \
445fff9558SSimon J. Gerraty	while test $$# -ge 2; do \
455fff9558SSimon J. Gerraty		file2c -sx "static const char $$2[] = {" ', 0x00 };' < $$1; \
465fff9558SSimon J. Gerraty		shift 2; \
475fff9558SSimon J. Gerraty	done; \
48*9bee6a60SSimon J. Gerraty	echo 'static const char *vc_ASC[] = { ${VC_ASC_LIST:T:R:ts,}, NULL };'; \
495fff9558SSimon J. Gerraty	echo; ) >> ${.TARGET}
505fff9558SSimon J. Gerraty.endif
515fff9558SSimon J. Gerraty.endif
52