From owner-freebsd-hackers@freebsd.org Fri Aug 3 02:30:07 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 384F41059855 for ; Fri, 3 Aug 2018 02:30:07 +0000 (UTC) (envelope-from eric@metricspace.net) Received: from mail.metricspace.net (static-98-116-200-172.nycmny.fios.verizon.net [98.116.200.172]) by mx1.freebsd.org (Postfix) with ESMTP id D27008BC13; Fri, 3 Aug 2018 02:30:06 +0000 (UTC) (envelope-from eric@metricspace.net) Received: from [172.16.0.23] (unknown [172.16.0.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: eric) by mail.metricspace.net (Postfix) with ESMTPSA id 9998B6106; Fri, 3 Aug 2018 02:30:05 +0000 (UTC) Subject: Re: A few build system questions To: Warner Losh Cc: Brooks Davis , FreeBSD Hackers References: <20180802153357.GA25687@spindle.one-eyed-alien.net> <7f143985-2ebb-210a-e314-0deebd3d9f5b@metricspace.net> <7a14aee9-8205-4fc7-a7a0-a9ed2f33751d@metricspace.net> From: Eric McCorkle Openpgp: preference=signencrypt Autocrypt: addr=eric@metricspace.net; prefer-encrypt=mutual; keydata= mDMEWue2FBYJKwYBBAHaRw8BAQdAP/qVPlXodV6pYO5b1Jw0eFyMhyDD7B5y5eFsciutEfS0 JEVyaWMgTWNDb3JrbGUgPGVyaWNAbWV0cmljc3BhY2UubmV0PoiWBBMWCAA+FiEEDxi/0rkj zd6Uc6cFCN/CKRbBwmwFAlrnthQCGwMFCQHhM4AFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA CgkQCN/CKRbBwmyGKAD/XTSBOItCKcYCPTlsaS1aQYVEwWXXFgdjWE+WsNdZUS8A/AhYAbQZ kNZNimE2rQLoklkfTA74qF/V257NuQi4QDcLuDgEWue2FBIKKwYBBAGXVQEFAQEHQKpZVyCG ync/xqejm2C1HKGXLJTUu38RvnrR3UYECz9nAwEIB4h+BBgWCAAmFiEEDxi/0rkjzd6Uc6cF CN/CKRbBwmwFAlrnthQCGwwFCQHhM4AACgkQCN/CKRbBwmyi2wEAmvaGt8QMjGELzm27gP4c jJGUi7oigsLmTiFPkpJqPz0A+QFBSCvxJaxCMyoVru/xB6bunpJ+Wtsj8HD1EuJOn4EJ Message-ID: <9c3f08be-2a76-a726-16b2-c1e6a1aa4aa8@metricspace.net> Date: Thu, 2 Aug 2018 22:29:59 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JqaR5W3ewElEK0x1BT6GZzF4B12xrh8Us" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 02:30:07 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JqaR5W3ewElEK0x1BT6GZzF4B12xrh8Us Content-Type: multipart/mixed; boundary="jddM8aLdOHpkNQ0PjYirQ4Eah0klwzG4C"; protected-headers="v1" From: Eric McCorkle To: Warner Losh Cc: Brooks Davis , FreeBSD Hackers Message-ID: <9c3f08be-2a76-a726-16b2-c1e6a1aa4aa8@metricspace.net> Subject: Re: A few build system questions References: <20180802153357.GA25687@spindle.one-eyed-alien.net> <7f143985-2ebb-210a-e314-0deebd3d9f5b@metricspace.net> <7a14aee9-8205-4fc7-a7a0-a9ed2f33751d@metricspace.net> In-Reply-To: --jddM8aLdOHpkNQ0PjYirQ4Eah0klwzG4C Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 08/02/2018 15:04, Warner Losh wrote: > On Thu, Aug 2, 2018 at 11:45 AM, Eric McCorkle > wrote: >=20 > On 08/02/2018 12:56, Warner Losh wrote: > >=20 > >=20 > > On Thu, Aug 2, 2018, 5:19 PM Eric McCorkle > > >> wrot= e: > >=20 > >=C2=A0 =C2=A0 =C2=A0On 08/02/2018 11:33, Brooks Davis wrote: > >=C2=A0 =C2=A0 =C2=A0> On Thu, Aug 02, 2018 at 11:17:06AM -0400, Er= ic McCorkle wrote: > >=C2=A0 =C2=A0 =C2=A0>> Hi, > >=C2=A0 =C2=A0 =C2=A0>> > >=C2=A0 =C2=A0 =C2=A0>> I have a few questions about how to accompl= ish some things with the > >=C2=A0 =C2=A0 =C2=A0>> build system. > >=C2=A0 =C2=A0 =C2=A0>> > >=C2=A0 =C2=A0 =C2=A0>> First, I want to create some libraries that= exist only as static > >=C2=A0 =C2=A0 =C2=A0>> archives, meaning no shared object (ex. lib= something.a, but no > >=C2=A0 =C2=A0 =C2=A0>> libsomething.so) > >=C2=A0 =C2=A0 =C2=A0> > >=C2=A0 =C2=A0 =C2=A0> If it's something for use by only the base s= ystem PRIVATELIB=3D will > >=C2=A0 =C2=A0 =C2=A0> do it (and change the name to libprivatesome= thi.a).=C2=A0 If you want to be > >=C2=A0 =C2=A0 =C2=A0> broadly available outside the base system, N= O_SHARED=3D should do it > >=C2=A0 =C2=A0 =C2=A0IIRC. > >=20 > >=C2=A0 =C2=A0 =C2=A0If loader and kernel are able to use private l= ibraries, then that is > >=C2=A0 =C2=A0 =C2=A0probably better, actually. > >=20 > >=20 > > They aren't.=C2=A0 Src/stand depends on no objects in the system = other than > > what is built in src/stand. What you are proposing is a non-start= er. The > > loader >=20 > I think you hit "send" too soon... >=20 > Basically what I'm trying to do at this point is two things. >=20 > First, I want to convert some certs into C declarations and embed t= hem > into a static library, which can in turn be used to embed them into= > applications.=C2=A0 This is essentially the same thing that some dr= ivers do, > where they embed the firmware binaries directly into the driver. >=20 > This is easy. For future reference, this seems to be more or less what I'm after: for f in /etc/trust/root/certs/*.pub.pem; do echo -n "static const char `basename ${f%%.*}`_data[] =3D {"; openssl x509 -outform DER -in /etc/trust/root/certs/local.pub.pem | hexdump -v -e '1/1 "0x%02x,"'; echo "};"; done > Second, and a (somewhat) separate thing, I'm trying to see if I can= get > a PoC of extracting the specific primitives out of OpenSSL and usin= g > them in place of the current software crypto implementations in ker= nel > and loader.=C2=A0 (objcopy ought to be able to do this to a static = library in > theory) >=20 > Such a strategy won't fly for various reasons. Userland, the loader and= > the kernel are all compiled with different options. You'll need to > recompile for each and not do objcopy tricks because the current build > model doesn't allow for that. >=20 Yeah, I'd say that shipwrecks any hopes I'd had there :( --jddM8aLdOHpkNQ0PjYirQ4Eah0klwzG4C-- --JqaR5W3ewElEK0x1BT6GZzF4B12xrh8Us Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQQPGL/SuSPN3pRzpwUI38IpFsHCbAUCW2O+JwAKCRAI38IpFsHC bMKeAP4y0OfomjWNy73Iaw0nDynjYLXVAjpNbdW5ABg54NNe5QEA6JYeTppaHyUg gv2OZFlq3KM7r8J6g9XG+vF9AxkXJgE= =vx61 -----END PGP SIGNATURE----- --JqaR5W3ewElEK0x1BT6GZzF4B12xrh8Us--