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