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