]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libsecureboot/local.trust.mk
cdn-patch: offer option to mount /etc/keys before attaching geli devices
[FreeBSD/FreeBSD.git] / lib / libsecureboot / local.trust.mk
1 # $FreeBSD$
2
3 # Consider this file an example.
4 #
5 # For Junos this is how we obtain trust anchor .pems
6 # the signing server (http://www.crufty.net/sjg/blog/signing-server.htm)
7 # for each key will provide the appropriate certificate chain on request
8
9 # force these for Junos
10 #MANIFEST_SKIP_ALWAYS= boot
11 VE_HASH_LIST= \
12         SHA1 \
13         SHA256 \
14         SHA384 \
15         SHA512
16
17 VE_SIGNATURE_LIST= \
18         ECDSA \
19         RSA
20
21 VE_SIGNATURE_EXT_LIST= \
22         esig \
23         rsig
24
25 VE_SELF_TESTS= yes
26
27 .if ${MACHINE} == "host" && ${.CURDIR:T} == "tests"
28
29 VE_SIGNATURE_LIST+= \
30         DEPRECATED_RSA_SHA1
31
32 VE_SIGNATURE_EXT_LIST+= \
33         sig
34 .endif
35
36 # add OpenPGP support - possibly dormant
37 VE_SIGNATURE_LIST+= OPENPGP
38 VE_SIGNATURE_EXT_LIST+= asc
39
40 SIGNER ?= ${SB_TOOLS_PATH:U/volume/buildtools/bin}/sign.py
41
42 .if exists(${SIGNER})
43 SIGN_HOST ?= ${SB_SITE:Usvl}-junos-signer.juniper.net
44 ECDSA_PORT:= ${133%y:L:gmtime}
45 SIGN_ECDSA= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${ECDSA_PORT} -h sha256
46 RSA2_PORT:= ${163%y:L:gmtime}
47 SIGN_RSA2=   ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${RSA2_PORT} -h sha256
48
49 # deal with quirk of our .esig format
50 XCFLAGS.vets+= -DVE_ECDSA_HASH_AGAIN
51
52 .if !empty(OPENPGP_SIGN_URL)
53 XCFLAGS.opgp_key+= -DHAVE_TA_ASC_H
54
55 VE_SIGNATURE_LIST+= OPENPGP
56 VE_SIGNATURE_EXT_LIST+= asc
57
58 SIGN_OPENPGP= ${PYTHON} ${SIGNER:H}/openpgp-sign.py -a -u ${OPENPGP_SIGN_URL}
59
60 ta_openpgp.asc:
61         ${SIGN_OPENPGP} -C ${.TARGET}
62
63 ta_asc.h: ta_openpgp.asc
64
65 .if ${VE_SELF_TESTS} != "no"
66 # for self test
67 vc_openpgp.asc: ta_openpgp.asc
68         ${SIGN_OPENPGP} ${.ALLSRC:M*.asc}
69         mv ta_openpgp.asc.asc ${.TARGET}
70
71 ta_asc.h: vc_openpgp.asc
72 .endif
73 .endif
74
75 rcerts.pem:
76         ${SIGN_RSA2} -C ${.TARGET}
77
78 ecerts.pem:
79         ${SIGN_ECDSA} -C ${.TARGET}
80
81 .if ${VE_SIGNATURE_LIST:tu:MECDSA} != ""
82 # the last cert in the chain is the one we want
83 ta_ec.pem: ecerts.pem _LAST_PEM_USE
84 ta.h: ta_ec.pem
85 .if ${VE_SELF_TESTS} != "no"
86 # these are for verification self test
87 vc_ec.pem: ecerts.pem _2ndLAST_PEM_USE
88 ta.h: vc_ec.pem
89 .endif
90 .endif
91
92 .if ${VE_SIGNATURE_LIST:tu:MRSA} != ""
93 ta_rsa.pem: rcerts.pem _LAST_PEM_USE
94 ta.h: ta_rsa.pem
95 .if ${VE_SELF_TESTS} != "no"
96 vc_rsa.pem: rcerts.pem _2ndLAST_PEM_USE
97 ta.h: vc_rsa.pem
98 .endif
99 .endif
100
101 # we take the mtime of this as our baseline time
102 #BUILD_UTC_FILE= ecerts.pem
103 #VE_DEBUG_LEVEL=3
104 #VE_VERBOSE_DEFAULT=1
105
106 .else
107 # you need to provide t*.pem or t*.asc files for each trust anchor
108 .if empty(TRUST_ANCHORS)
109 TRUST_ANCHORS!= cd ${.CURDIR} && 'ls' -1 *.pem t*.asc 2> /dev/null
110 .endif
111 .if empty(TRUST_ANCHORS) && ${MK_LOADER_EFI_SECUREBOOT} != "yes"
112 .error Need TRUST_ANCHORS see ${.CURDIR}/README.rst
113 .endif
114 .if ${TRUST_ANCHORS:T:Mt*.pem} != ""
115 ta.h: ${TRUST_ANCHORS:M*.pem}
116 .endif
117 .if ${TRUST_ANCHORS:T:Mt*.asc} != ""
118 VE_SIGNATURE_LIST+= OPENPGP
119 VE_SIGNATURE_EXT_LIST+= asc
120 ta_asc.h: ${TRUST_ANCHORS:M*.asc}
121 .endif
122 # we take the mtime of this as our baseline time
123 BUILD_UTC_FILE?= ${TRUST_ANCHORS:[1]}
124 .endif
125