From owner-freebsd-hackers@freebsd.org Fri Aug 3 05:39:03 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 DE88C105DEA6 for ; Fri, 3 Aug 2018 05:39:02 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77FF67141D for ; Fri, 3 Aug 2018 05:39:02 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f177.google.com with SMTP id k16-v6so4020473iom.12 for ; Thu, 02 Aug 2018 22:39:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=JVI8QECuzuORo3JovxsMsK6d3WLHnyGMR806uNSy/qc=; b=L3Ov+kHM3btSOcAQrx2TSX1xyu0iZ+t1RbBJxhSeu8nJws5YyoD7oNFrVBxUASNcuu qEjYxx+PGW91MTx5gFD1hH0O0ZGpB/zI7mZqjwvnvr85xpsbTe+glAfOEOXjsje4s5E8 xCBiwaaePff+TCwnVlvbAYYLVY3lytURbPSENZG7mziKEYbuhf3gD37fP0ucqRwXyfeB nn6mKmZyMPO/kN48APRwNwhRwXtdcY1fiQhwux61cX57gXUkvtjbXpNaaSusll6Kh66Z 2Z8Y/f8FsvQ1ouI1PwHqOPW4HWI+UIPnuusFIbfeJM+CwOblokNnLAHInOZyyVMSibLl 84og== X-Gm-Message-State: AOUpUlHZCUJ6y5eK8O9+s+Qxi+z14hohtPl+yXK38nSGuoeFrykOC5qM j30Tz5TdJNUW9dy3v82JWJkr8qh1 X-Google-Smtp-Source: AA+uWPwLD60sH3lbp0GMgNPvXEG1ugjdRcuKGdqHTNmganlRIDlG9uuIRuk+7mhcNMLAUGqyBL9SSQ== X-Received: by 2002:a6b:ef08:: with SMTP id k8-v6mr4883365ioh.12.1533274278660; Thu, 02 Aug 2018 22:31:18 -0700 (PDT) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com. [209.85.223.175]) by smtp.gmail.com with ESMTPSA id v5-v6sm1618529ite.20.2018.08.02.22.31.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 22:31:18 -0700 (PDT) Received: by mail-io0-f175.google.com with SMTP id o22-v6so4042833ioh.6 for ; Thu, 02 Aug 2018 22:31:18 -0700 (PDT) X-Received: by 2002:a6b:b0c5:: with SMTP id z188-v6mr4757177ioe.220.1533274277914; Thu, 02 Aug 2018 22:31:17 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:7e0a:0:0:0:0:0 with HTTP; Thu, 2 Aug 2018 22:31:17 -0700 (PDT) In-Reply-To: <9c3f08be-2a76-a726-16b2-c1e6a1aa4aa8@metricspace.net> References: <20180802153357.GA25687@spindle.one-eyed-alien.net> <7f143985-2ebb-210a-e314-0deebd3d9f5b@metricspace.net> <7a14aee9-8205-4fc7-a7a0-a9ed2f33751d@metricspace.net> <9c3f08be-2a76-a726-16b2-c1e6a1aa4aa8@metricspace.net> From: Conrad Meyer Date: Thu, 2 Aug 2018 22:31:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A few build system questions To: Eric McCorkle Cc: FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" 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 05:39:03 -0000 On Thu, Aug 2, 2018 at 7:29 PM, Eric McCorkle wrote: > 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[] = {"; openssl x509 -outform DER -in > /etc/trust/root/certs/local.pub.pem | hexdump -v -e '1/1 "0x%02x,"'; > echo "};"; done Another option instead of the hexdump format is just "xxd -i" (xxd is part of vim), although that works best if the intermediary output is written to a file (it populates the struct name automatically). Something like: for f in .../*pub.pem; do openssl x509 -outform DER -in ... > "$(basename "...")_data" && xxd -i "$(basename "...")_data" ; done Its output is nicely formatted with spaces and line wrapping. Best, Conrad