]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libsecureboot/local.trust.mk
Merge bmake-20230622
[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 # allow site override of all the above
41 .-include "site.trust.mk"
42
43 SIGNER ?= ${SB_TOOLS_PATH:U/volume/buildtools/bin}/sign.py
44
45 .if exists(${SIGNER})
46 SIGN_HOST ?= ${SB_SITE:Usvl}-junos-signer.juniper.net
47 ECDSA_PORT:= ${133%y:L:gmtime}
48 SIGN_ECDSA= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${ECDSA_PORT} -h sha256
49 RSA2_PORT:= ${163%y:L:gmtime}
50 SIGN_RSA2=   ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${RSA2_PORT} -h sha256
51
52 # deal with quirk of our .esig format
53 XCFLAGS.vets+= -DVE_ECDSA_HASH_AGAIN
54
55 .if !empty(OPENPGP_SIGN_URL)
56 XCFLAGS.opgp_key+= -DHAVE_TA_ASC_H
57
58 VE_SIGNATURE_LIST+= OPENPGP
59 VE_SIGNATURE_EXT_LIST+= asc
60
61 SIGN_OPENPGP= ${PYTHON} ${SIGNER:H}/openpgp-sign.py -a -u ${OPENPGP_SIGN_URL}
62
63 ta_openpgp.asc:
64         ${SIGN_OPENPGP} -C ${.TARGET}
65
66 ta_asc.h: ta_openpgp.asc
67
68 .if ${VE_SELF_TESTS} != "no"
69 # for self test
70 vc_openpgp.asc: ta_openpgp.asc
71         ${SIGN_OPENPGP} ${.ALLSRC:M*.asc}
72         mv ta_openpgp.asc.asc ${.TARGET}
73
74 ta_asc.h: vc_openpgp.asc
75 .endif
76 .endif
77
78 rcerts.pem:
79         ${SIGN_RSA2} -C ${.TARGET}
80
81 ecerts.pem:
82         ${SIGN_ECDSA} -C ${.TARGET}
83
84 .if ${VE_SIGNATURE_LIST:tu:MECDSA} != ""
85 # the last cert in the chain is the one we want
86 ta_ec.pem: ecerts.pem _LAST_PEM_USE
87 ta.h: ta_ec.pem
88 .if ${VE_SELF_TESTS} != "no"
89 # these are for verification self test
90 vc_ec.pem: ecerts.pem _2ndLAST_PEM_USE
91 ta.h: vc_ec.pem
92 .endif
93 .endif
94
95 .if ${VE_SIGNATURE_LIST:tu:MRSA} != ""
96 ta_rsa.pem: rcerts.pem _LAST_PEM_USE
97 ta.h: ta_rsa.pem
98 .if ${VE_SELF_TESTS} != "no"
99 vc_rsa.pem: rcerts.pem _2ndLAST_PEM_USE
100 ta.h: vc_rsa.pem
101 .endif
102 .endif
103
104 # we take the mtime of this as our baseline time
105 #BUILD_UTC_FILE= ecerts.pem
106 #VE_DEBUG_LEVEL=3
107 #VE_VERBOSE_DEFAULT=1
108
109 .else
110 # you need to provide t*.pem or t*.asc files for each trust anchor
111 .if empty(TRUST_ANCHORS)
112 TRUST_ANCHORS!= cd ${.CURDIR} && 'ls' -1 *.pem t*.asc 2> /dev/null
113 .endif
114 .if empty(TRUST_ANCHORS) && ${MK_LOADER_EFI_SECUREBOOT} != "yes"
115 .error Need TRUST_ANCHORS see ${.PARSEDIR}/README.rst
116 .endif
117 .if ${TRUST_ANCHORS:T:Mt*.pem} != ""
118 ta.h: ${TRUST_ANCHORS:M*.pem}
119 .endif
120 .if ${TRUST_ANCHORS:T:Mt*.asc} != ""
121 VE_SIGNATURE_LIST+= OPENPGP
122 VE_SIGNATURE_EXT_LIST+= asc
123 ta_asc.h: ${TRUST_ANCHORS:M*.asc}
124 .endif
125 # we take the mtime of this as our baseline time
126 BUILD_UTC_FILE?= ${TRUST_ANCHORS:[1]}
127 .endif
128