{"title":"Cryptech Project - Novena","link":[{"@attributes":{"href":"https:\/\/wiki.cryptech.is\/","rel":"alternate"}},{"@attributes":{"href":"https:\/\/wiki.cryptech.is\/feeds\/novena.atom.xml","rel":"self"}}],"id":"https:\/\/wiki.cryptech.is\/","updated":"2016-12-15T22:44:00+00:00","entry":[{"title":"How to start using coretest_hashes on the Novena PVT1","link":{"@attributes":{"href":"https:\/\/wiki.cryptech.is\/CoretestHashesNovena","rel":"alternate"}},"published":"2016-12-15T22:44:00+00:00","updated":"2016-12-15T22:44:00+00:00","author":{"name":"Cryptech Core Team"},"id":"tag:wiki.cryptech.is,2016-12-15:\/CoretestHashesNovena","summary":"<p>This is a writeup on how to setup, build and testrun the coretest_hashes\nCryptech subsystem on a Novena PVT1 development board.<\/p>\n<h2>Getting started with Novena<\/h2>\n<p><a href=\"http:\/\/www.kosagi.com\/w\/index.php?title=Novena_Main_Page\">Novena<\/a> is an open hardware and F\/OSS-friendly computing platform.<\/p>\n<p><img src=\"http:\/\/bunniefoo.com\/novena\/pvt1_release\/novena_pvt1e_top_sm.jpg\"><\/p>\n<p>It is a small single-board Linux PC, which happens to include a Xilinx <a href=\"http:\/\/www.xilinx.com\/products\/silicon-devices\/fpga\/spartan-6\/lx.html\">Spartan-6 FPGA \u2026<\/a><\/p>","content":"<p>This is a writeup on how to setup, build and testrun the coretest_hashes\nCryptech subsystem on a Novena PVT1 development board.<\/p>\n<h2>Getting started with Novena<\/h2>\n<p><a href=\"http:\/\/www.kosagi.com\/w\/index.php?title=Novena_Main_Page\">Novena<\/a> is an open hardware and F\/OSS-friendly computing platform.<\/p>\n<p><img src=\"http:\/\/bunniefoo.com\/novena\/pvt1_release\/novena_pvt1e_top_sm.jpg\"><\/p>\n<p>It is a small single-board Linux PC, which happens to include a Xilinx <a href=\"http:\/\/www.xilinx.com\/products\/silicon-devices\/fpga\/spartan-6\/lx.html\">Spartan-6 FPGA<\/a>. This, together with the TerasIC <a href=\"https:\/\/wiki.cryptech.is\/CoretestHashesC5G\">Cyclone 5 GX<\/a>, is what we are using to develop and test the Cryptech cores.<\/p>\n<p>The Novena includes an HDMI adapter and two USB ports, so you can plug in a monitor, keyboard, and mouse, and have a graphical desktop environment. However, I prefer to run it headless, and ssh to it. To ssh to the Novena, you need to know its IP address, which means you need to either statically configure it, or you need to assign it an address in your DHCP server.<\/p>\n<p>If you go the DHCP route, be aware that Novena doesn't used a fixed hardware address, so you'll have to statically configure <strong>that<\/strong>.\nOpen <code>\/etc\/network\/interfaces<\/code>, and add something like the following lines:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"nx\">allow<\/span><span class=\"o\">-<\/span><span class=\"nx\">hotplug<\/span><span class=\"w\"> <\/span><span class=\"nx\">eth0<\/span>\n<span class=\"nx\">iface<\/span><span class=\"w\"> <\/span><span class=\"nx\">eth0<\/span><span class=\"w\"> <\/span><span class=\"nx\">inet<\/span><span class=\"w\"> <\/span><span class=\"nx\">dhcp<\/span>\n<span class=\"w\">  <\/span><span class=\"nx\">hwaddress<\/span><span class=\"w\"> <\/span><span class=\"nx\">ether<\/span><span class=\"w\"> <\/span><span class=\"mi\">00<\/span><span class=\"p\">:<\/span><span class=\"mi\">0<\/span><span class=\"nx\">e<\/span><span class=\"p\">:<\/span><span class=\"nx\">c6<\/span><span class=\"p\">:<\/span><span class=\"mi\">87<\/span><span class=\"p\">:<\/span><span class=\"mi\">72<\/span><span class=\"p\">:<\/span><span class=\"mi\">01<\/span>\n<\/code><\/pre><\/div>\n\n<ul>\n<li>The specific CPU on the Novena is the Freescale i.MX6 MCIMX6Q5EYM12AC device. A quad core, ARM A9 device running at 1.2 GHz.<\/li>\n<li>The specific FPGA on the Novena is the Xilinx Spartan-6 XC6SLX45-3CSG324C device.<\/li>\n<li>Here are <a href=\"http:\/\/bunniefoo.com\/novena\/pvt2_release\/novena_pvt2.PDF\">the schematics for the Novena PVT2 board<\/a>.<\/li>\n<\/ul>\n<h3>Coretest_hashes<\/h3>\n<p>The coretest_hashes is a subsystem that is a FPGA design that contains\nCryptech application cores as well as support cores used to run tests\nof the SHA-1 and SHA-2 hash functions from the host computer via an\nI2C serial bus. The subsystem consists of:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/git.cryptech.is\/core\/sha1\">sha1<\/a>: A HW implementation of the SHA-1 hash function.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/git.cryptech.is\/core\/sha256\">sha256<\/a>: A HW implementation of the SHA-256 hash\n  function.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/git.cryptech.is\/core\/sha512\">sha512<\/a>: A HW implementation of the SHA-512 hash\n  function.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/git.cryptech.is\/core\/coretest\">coretest<\/a>: A command parser that accepts read\/write\n  commands from a host, executes the commands and sends the response.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/git.cryptech.is\/core\/i2c\">i2c<\/a>: A serial interface that connects coretest to the\n  host.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/git.cryptech.is\/core\/novena\">novena<\/a>: A top-level wrapper that connects all<\/p>\n<\/li>\n<\/ul>\n<p>the cores, and connects i2c to external pins as well as clk and\n reset. This repo also contains userland software that talks to\n coretest and performs tests of the sha1, sha256, and sha512 cores.<\/p>\n<h2>Software and system requirements<\/h2>\n<p>You need to download and install the Xilinx\n<a href=\"http:\/\/www.xilinx.com\/support\/download\/index.html\/content\/xilinx\/en\/downloadNav\/design-tools.html\">ISE Design Suite<\/a>.<\/p>\n<p>Note: this software runs on a Windows or x86 Linux host, <strong>not<\/strong> on the Novena.<\/p>\n<h3>Installing on Linux<\/h3>\n<p>The Windows install is pretty straight-forward. So is the Linux\ninstall, but with a few extra notes:<\/p>\n<ul>\n<li>\n<p>Xilinx only supports specific versions of Red Hat and Suse Linux, but it does run on Ubuntu, with the following caveat: Ubuntu symlinks <code>\/bin\/sh<\/code> to <code>dash<\/code>, which can't handle <code>if [ ]<\/code> syntax in shell scripts, so I symlinked <code>\/bin\/sh<\/code> to <code>bash<\/code> instead.<\/p>\n<\/li>\n<li>\n<p>ISE Design Suite uses a graphical installer, so has to be installed\n  on a desktop edition, not a server edition.<\/p>\n<\/li>\n<li>\n<p>Although the software can be installed as user or root, by default\n  it wants to install into <code>\/opt\/Xilinx<\/code>, so you need to install as root\n  if you want to do that.<\/p>\n<\/li>\n<li>\n<p>The Xilinx tools are disk hogs, so if you're building a VM for this, you'll probably want to give it at least 30-40 GB of disk space.<\/p>\n<\/li>\n<\/ul>\n<p>Step-by-step installation:\n1. Unpack Xilinx_ISE_DS_Lin_14.7_1015_1.tar (or whatever version you have).\n2. <code>cd<\/code> to Xilinx_ISE_DS_Lin_14.7_1015_1, and run <code>sudo .\/xsetup<\/code>\n3. Click through two screens of license agreements.\n4. Select <code>ISE WebPACK<\/code>.\n5. Unselect (or leave unselected) <code>Install Cable Drivers<\/code>.\n6. Go!<\/p>\n<p>Well, not quite.  You will need to convince the ISE that you have a license.<\/p>\n<p>On the page <a href=\"http:\/\/www.xilinx.com\/products\/design-tools\/ise-design-suite\/ise-webpack.htm\">http:\/\/www.xilinx.com\/products\/design-tools\/ise-design-suite\/ise-webpack.htm<\/a> click on the <code>Licensing Solutions<\/code> link.  On the resulting page, expand the section <code>Obtain a license for Free or Evaluation product<\/code>.  To download the ISE Webpack, you should have created an account, so now you can go to the Licensing Site and use that account to create a Certificate Based License.<\/p>\n<p>You do not need to go through the HostID dance, just say Do It.  You will then receive a certificate in email (not an X.509 certificate) which you will be able to use.  Then start the ISE Webpack by issuing the command <code>ise<\/code>.  Go to the Help menu and <code>Manage Licenses<\/code>.  Use the resulting new License Manager window to install the .lic file.  This process is complex and flakey.<\/p>\n<p>Here is a more detailed description of <a href=\"http:\/\/www.armadeus.com\/wiki\/index.php?title=ISE_WebPack_installation_on_Linux\">installing ISE in Ubuntu.<\/a><\/p>\n<p>Platforms on which at least one person has done this succesfully:<\/p>\n<ul>\n<li>ISE 14.7 on a 32-bit Debian Wheezy VM running under VirtualBox on MacOSX.<\/li>\n<li>ISE 14.7 on a 64-bit Debian Jessie VM running under virsh\/kvm.<\/li>\n<li>ISE 14.7 on 32-bit Debian Jessie on a Shuttle XS36V.<\/li>\n<\/ul>\n<h2>Downloading the cores<\/h2>\n<p>Create a project directory, e.g. <code>coretest\/core<\/code>.<\/p>\n<p>The cores we need to build the subsystem must be downloaded from the\nCryptech server. Check them out one by one:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"ch\">#!sh<\/span>\ngit<span class=\"w\"> <\/span>clone<span class=\"w\"> <\/span>http:\/\/git.cryptech.is\/core\/sha1.git\ngit<span class=\"w\"> <\/span>clone<span class=\"w\"> <\/span>http:\/\/git.cryptech.is\/core\/sha256.git\ngit<span class=\"w\"> <\/span>clone<span class=\"w\"> <\/span>http:\/\/git.cryptech.is\/core\/sha512.git\ngit<span class=\"w\"> <\/span>clone<span class=\"w\"> <\/span>http:\/\/git.cryptech.is\/core\/i2c.git\ngit<span class=\"w\"> <\/span>clone<span class=\"w\"> <\/span>http:\/\/git.cryptech.is\/core\/coretest.git\ngit<span class=\"w\"> <\/span>clone<span class=\"w\"> <\/span>http:\/\/git.cryptech.is\/core\/novena.git\n<\/code><\/pre><\/div>\n\n<p>If you are a cryptech core member, use the ssh method, e.g.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"n\">git<\/span><span class=\"w\"> <\/span><span class=\"n\">clone<\/span><span class=\"w\"> <\/span><span class=\"n\">git<\/span><span class=\"nv\">@git<\/span><span class=\"p\">.<\/span><span class=\"n\">cryptech<\/span><span class=\"p\">.<\/span><span class=\"k\">is<\/span><span class=\"err\">:<\/span><span class=\"n\">core<\/span><span class=\"o\">\/<\/span><span class=\"n\">sha1<\/span><span class=\"p\">.<\/span><span class=\"n\">git<\/span>\n<\/code><\/pre><\/div>\n\n<h2>Building the cores<\/h2>\n<h3>Building in Linux command-line<\/h3>\n<p>Go to <code>novena\/synth<\/code> and run <code>make<\/code>.<\/p>\n<p>Depending on your version of ISE Design Suite, where you installed it,\nand whether you're running it on 32-bit or 64-bit hardware, you may\nhave to change the <code>isedir<\/code> and <code>xil_env<\/code> values in <code>Makefile<\/code>.<\/p>\n<h3>Building in the ISE application<\/h3>\n<p>On Windows, open the Project Navigator link.<\/p>\n<p>On Linux, run e.g. <code>\/opt\/Xilinx\/14.7\/ISE_DS\/ISE\/bin\/lin64\/ise<\/code><\/p>\n<p>a. Create the project:\n   Select <code>File<\/code> &gt; <code>New Project<\/code><\/p>\n<ul>\n<li>Name: novena<\/li>\n<li>Location: ...\/toolruns (automatically appends \"novena\")<\/li>\n<li>Family: Spartan6<\/li>\n<li>Device: XC6SLX45<\/li>\n<li>Package: CSG324<\/li>\n<li>Speed: -3<\/li>\n<\/ul>\n<p>b. Add files to the project:<\/p>\n<ul>\n<li>coretest\/src\/rtl\/coretest.v<\/li>\n<li>coretest_test_core\/src\/rtl\/coretest_test_core.v<\/li>\n<li>i2c\/src\/rtl\/i2c.v<\/li>\n<li>i2c\/src\/rtl\/i2c_core.v<\/li>\n<li>novena\/src\/rtl\/coretest_hashes.v<\/li>\n<li>novena\/src\/rtl\/novena_fpga.v<\/li>\n<li>novena\/synth\/coretest-novena.ucf<\/li>\n<li>sha1\/src\/rtl\/sha1.v<\/li>\n<li>sha1\/src\/rtl\/sha1_core.v<\/li>\n<li>sha1\/src\/rtl\/sha1_w_mem.v<\/li>\n<li>sha256\/src\/rtl\/sha256.v<\/li>\n<li>sha256\/src\/rtl\/sha256_core.v<\/li>\n<li>sha256\/src\/rtl\/sha256_k_constants.v<\/li>\n<li>sha256\/src\/rtl\/sha256_w_mem.v<\/li>\n<li>sha512\/src\/rtl\/sha512.v<\/li>\n<li>sha512\/src\/rtl\/sha512_core.v<\/li>\n<li>sha512\/src\/rtl\/sha512_h_constants.v<\/li>\n<li>sha512\/src\/rtl\/sha512_k_constants.v<\/li>\n<li>sha512\/src\/rtl\/sha512_w_mem.v<\/li>\n<\/ul>\n<p>c. Set some non-default options:<\/p>\n<p><em>Note: these are derived from other Novena projects, and I'm not sure\n   what they mean, but they don't make things blow up.<\/em><\/p>\n<ul>\n<li>In the <code>Process<\/code> window, right-click on <code>Generate Programming File<\/code>, select <code>Process Properties...<\/code>.<ul>\n<li>In <code>Configuration Options<\/code>, find <code>-g UnusedPin<\/code>, and change it from <code>Pull Down<\/code> to <code>Float<\/code>.<\/li>\n<li>In <code>Startup Options<\/code>, find <code>-g DriveDone<\/code>, and check the box.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>d. Build the project<\/p>\n<p>Select <code>Process<\/code> &gt; <code>Implement Top Module<\/code><\/p>\n<p>The expected build time should be something like 5 and 10 minutes, depending on the computer used.\nSome measured build times for the design:<\/p>\n<ul>\n<li>5,30 minutes on MacbookPro 2013 with tools in 64-bit SUSE Linux in VM<\/li>\n<li>9,20 minutes on AMD A10-6800K with tools in Windows 7 in Virtualbox VM with one CPU core and 4 GByte RAM.<\/li>\n<\/ul>\n<h2>Running coretest on the Novena<\/h2>\n<p><code>scp<\/code> the built <code>coretest-novena.bit<\/code> to the Novena.<\/p>\n<p>Fetch\n<a href=\"https:\/\/github.com\/xobs\/novena-scope-drivers\/blob\/master\/userspace\/devmem2.c\">devmem2.c<\/a>\nand compile it on the Novena.<\/p>\n<p><code>scp<\/code> the following files from <code>novena\/src\/sw<\/code> to the Novena:<\/p>\n<ul>\n<li>configure.sh<\/li>\n<li>hash_tester.py<\/li>\n<\/ul>\n<p>To configure the coretest image into the FPGA, run<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"ch\">#!sh<\/span>\n.\/configure.sh<span class=\"w\"> <\/span>coretest-novena.bit\n<\/code><\/pre><\/div>\n\n<p>This should light a small green LED (labeled \"fpga\") next to the high-speed\nexpansion connector. The console log should be:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"n\">Setting<\/span><span class=\"w\"> <\/span><span class=\"k\">export<\/span><span class=\"w\"> <\/span><span class=\"n\">of<\/span><span class=\"w\"> <\/span><span class=\"n\">reset<\/span><span class=\"w\"> <\/span><span class=\"n\">pin<\/span>\n<span class=\"n\">setting<\/span><span class=\"w\"> <\/span><span class=\"n\">reset<\/span><span class=\"w\"> <\/span><span class=\"n\">pin<\/span><span class=\"w\"> <\/span><span class=\"n\">to<\/span><span class=\"w\"> <\/span><span class=\"n\">out<\/span>\n<span class=\"n\">flipping<\/span><span class=\"w\"> <\/span><span class=\"n\">reset<\/span>\n<span class=\"n\">configuring<\/span><span class=\"w\"> <\/span><span class=\"n\">FPGA<\/span>\n<span class=\"mi\">11597<\/span><span class=\"o\">+<\/span><span class=\"mi\">1<\/span><span class=\"w\"> <\/span><span class=\"n\">records<\/span><span class=\"w\"> <\/span><span class=\"ow\">in<\/span>\n<span class=\"mi\">11597<\/span><span class=\"o\">+<\/span><span class=\"mi\">1<\/span><span class=\"w\"> <\/span><span class=\"n\">records<\/span><span class=\"w\"> <\/span><span class=\"n\">out<\/span>\n<span class=\"mi\">1484509<\/span><span class=\"w\"> <\/span><span class=\"n\">bytes<\/span><span class=\"w\"> <\/span><span class=\"p\">(<\/span><span class=\"mf\">1.5<\/span><span class=\"w\"> <\/span><span class=\"n\">MB<\/span><span class=\"p\">)<\/span><span class=\"w\"> <\/span><span class=\"n\">copied<\/span><span class=\"p\">,<\/span><span class=\"w\"> <\/span><span class=\"mf\">2.34345<\/span><span class=\"w\"> <\/span><span class=\"n\">s<\/span><span class=\"p\">,<\/span><span class=\"w\"> <\/span><span class=\"mi\">633<\/span><span class=\"w\"> <\/span><span class=\"n\">kB<\/span><span class=\"o\">\/<\/span><span class=\"n\">s<\/span>\n<span class=\"n\">turning<\/span><span class=\"w\"> <\/span><span class=\"n\">on<\/span><span class=\"w\"> <\/span><span class=\"n\">clock<\/span><span class=\"w\"> <\/span><span class=\"n\">to<\/span><span class=\"w\"> <\/span><span class=\"n\">FPGA<\/span>\n<span class=\"o\">\/<\/span><span class=\"n\">dev<\/span><span class=\"o\">\/<\/span><span class=\"n\">mem<\/span><span class=\"w\"> <\/span><span class=\"n\">opened<\/span><span class=\"o\">.<\/span>\n<span class=\"n\">Memory<\/span><span class=\"w\"> <\/span><span class=\"n\">mapped<\/span><span class=\"w\"> <\/span><span class=\"n\">at<\/span><span class=\"w\"> <\/span><span class=\"n\">address<\/span><span class=\"w\"> <\/span><span class=\"mh\">0x76f51000<\/span><span class=\"o\">.<\/span>\n<span class=\"n\">Value<\/span><span class=\"w\"> <\/span><span class=\"n\">at<\/span><span class=\"w\"> <\/span><span class=\"n\">address<\/span><span class=\"w\"> <\/span><span class=\"mh\">0x20C8160<\/span><span class=\"w\"> <\/span><span class=\"p\">(<\/span><span class=\"mh\">0x76f51160<\/span><span class=\"p\">):<\/span><span class=\"w\"> <\/span><span class=\"mh\">0x40B<\/span>\n<span class=\"n\">Written<\/span><span class=\"w\"> <\/span><span class=\"mh\">0xD2B<\/span><span class=\"p\">;<\/span><span class=\"w\"> <\/span><span class=\"n\">readback<\/span><span class=\"w\"> <\/span><span class=\"mh\">0xD2B<\/span>\n<\/code><\/pre><\/div>\n\n<p>Run <code>hash_tester.py<\/code> to go through the full test suite.<\/p>","category":{"@attributes":{"term":"Novena"}}},{"title":"Getting Started on the Novena","link":{"@attributes":{"href":"https:\/\/wiki.cryptech.is\/GettingStartedNovena","rel":"alternate"}},"published":"2016-12-15T22:44:00+00:00","updated":"2016-12-15T22:44:00+00:00","author":{"name":"Cryptech Core Team"},"id":"tag:wiki.cryptech.is,2016-12-15:\/GettingStartedNovena","summary":"<h2>The Novena Board<\/h2>\n<p><img src=\"http:\/\/bunniefoo.com\/novena\/pvt1_release\/novena_pvt1e_top_sm.jpg\"><\/p>\n<p><a href=\"http:\/\/www.kosagi.com\/w\/index.php?title=Novena_Main_Page\">Novena<\/a> is an open hardware and F\/OSS-friendly computing platform. It is a small single-board Linux PC, with a Freescale i.MX6 (ARM\nCortex-A9) CPU and a Xilinx Spartan-6 LX45 FPGA.<\/p>\n<p>It is available in limited quantities through <a href=\"https:\/\/www.crowdsupply.com\/sutajio-kosagi\/novena\">crowd supply<\/a>.<\/p>\n<h3>Setting up the Novena<\/h3>\n<p>The Novena PVT-2 \u2026<\/p>","content":"<h2>The Novena Board<\/h2>\n<p><img src=\"http:\/\/bunniefoo.com\/novena\/pvt1_release\/novena_pvt1e_top_sm.jpg\"><\/p>\n<p><a href=\"http:\/\/www.kosagi.com\/w\/index.php?title=Novena_Main_Page\">Novena<\/a> is an open hardware and F\/OSS-friendly computing platform. It is a small single-board Linux PC, with a Freescale i.MX6 (ARM\nCortex-A9) CPU and a Xilinx Spartan-6 LX45 FPGA.<\/p>\n<p>It is available in limited quantities through <a href=\"https:\/\/www.crowdsupply.com\/sutajio-kosagi\/novena\">crowd supply<\/a>.<\/p>\n<h3>Setting up the Novena<\/h3>\n<p>The Novena PVT-2 requires some initial setup. You will need to attach a USB keyboard and HDMI monitor.<\/p>\n<p>Once this is done, most of us prefer to run it headless, and ssh in.<\/p>\n<p>You may also want to bring the packages up to date:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-get<span class=\"w\"> <\/span>update\n$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-get<span class=\"w\"> <\/span>upgrade\n<\/code><\/pre><\/div>\n\n<h2>The Avalanche Noise Board<\/h2>\n<p><img alt=\"rev03-on-novena.jpg\" src=\"https:\/\/wiki.cryptech.is\/GettingStartedNovena\/GettingStartedNovena\/rev03-on-novena.jpg\"><\/p>\n<p>The avalanche noise board is a Novena daughter board that contains a zener-diode noise circuit that can be read directly by the FPGA.<\/p>\n<p><em>(More information from FT: block diagram, schematics, ...)<\/em><\/p>\n<p>It is available in limited quantities directly from Fredrik Thulin, and will be distributed at the PrahaWorkshop.<\/p>\n<h2>Binary Packages<\/h2>\n<p>Cryptech maintains an <code>apt<\/code> repository, with two binary packages for the Novena:<\/p>\n<ul>\n<li>a bitstream, to be configured into the FPGA<\/li>\n<li>software, to run on the CPU<\/li>\n<\/ul>\n<h3>How to get them<\/h3>\n<p>All commands are run on the Novena.<\/p>\n<ol>\n<li>First, get the hactrn CA certificate:<\/li>\n<\/ol>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>wget<span class=\"w\"> <\/span>http:\/\/www.hactrn.net\/cacert.asc\n<\/code><\/pre><\/div>\n\n<p>Get the key used to sign the CA certificate.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>gpg<span class=\"w\"> <\/span>--recv-keys<span class=\"w\"> <\/span>2DC6FF82\n<\/code><\/pre><\/div>\n\n<p>Validate the CA certificate<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>gpg<span class=\"w\"> <\/span>cacert.asc\n<\/code><\/pre><\/div>\n\n<p>Install the CA certficiate.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>mkdir<span class=\"w\"> <\/span>\/usr\/share\/ca-certificates\/hactrn.org\n$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>mv<span class=\"w\"> <\/span>cacert<span class=\"w\"> <\/span>\/usr\/share\/ca-certificates\/hactrn.org\/cacert.crt\n$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>dpkg-reconfigure<span class=\"w\"> <\/span>ca-certificates\n<\/code><\/pre><\/div>\n\n<ol>\n<li>Get the repository key.<\/li>\n<\/ol>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>wget<span class=\"w\"> <\/span>https:\/\/apt.cryptech.is\/novena\/apt-gpg-key.asc\n<\/code><\/pre><\/div>\n\n<p>Validate the key.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span><span class=\"nv\">id<\/span><span class=\"o\">=<\/span>37A8E93F5D7E7B9A\n$<span class=\"w\"> <\/span>gpg<span class=\"w\"> <\/span>--recv-key<span class=\"w\"> <\/span><span class=\"nv\">$id<\/span>\n$<span class=\"w\"> <\/span>gpg<span class=\"w\"> <\/span>--check-sig<span class=\"w\"> <\/span><span class=\"nv\">$id<\/span>\n$<span class=\"w\"> <\/span>gpg<span class=\"w\"> <\/span>--export<span class=\"w\"> <\/span><span class=\"nv\">$id<\/span><span class=\"w\"> <\/span><span class=\"p\">|<\/span><span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-key<span class=\"w\"> <\/span>add<span class=\"w\"> <\/span>-\n<\/code><\/pre><\/div>\n\n<p>See the apt-key(8) manual page for more information about the APT key database, including how to remove keys you don't want anymore.<\/p>\n<p>Install the key.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-key<span class=\"w\"> <\/span>add<span class=\"w\"> <\/span>apt-gpg-key.asc\n<\/code><\/pre><\/div>\n\n<ol>\n<li>Get the packages<\/li>\n<\/ol>\n<p>Configure apt to use the repository.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>wget<span class=\"w\"> <\/span>-q<span class=\"w\"> <\/span>-O<span class=\"w\"> <\/span>\/etc\/apt\/sources.list.d\/novena.list<span class=\"w\"> <\/span>https:\/\/apt.cryptech.is\/novena\/sources.list\n<\/code><\/pre><\/div>\n\n<p>Update the package index file.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-get<span class=\"w\"> <\/span>update\n<\/code><\/pre><\/div>\n\n<p>Get the cryptech meta-package.<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-get<span class=\"w\"> <\/span>install<span class=\"w\"> <\/span>cryptech-novena\n<\/code><\/pre><\/div>\n\n<p>This installs the <code>cryptech-novena-rtl<\/code> and <code>cryptech-novena-sw<\/code> packages.<\/p>\n<p>The <code>cryptech-novena-rtl<\/code> package includes an <code>init.d<\/code> script that configures the FPGA on system startup. This script should run automatically as part of the install process.<\/p>\n<h3>Updating the packages<\/h3>\n<p>Once you've performed the steps above you should be able to upgrade to newer\nversion of the code using the normal APT upgrade process, eg:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-get<span class=\"w\"> <\/span>update\n$<span class=\"w\"> <\/span>sudo<span class=\"w\"> <\/span>apt-get<span class=\"w\"> <\/span>upgrade\n<\/code><\/pre><\/div>\n\n<h2>Setting up PKCS#11<\/h2>\n<p>The PKCS11 token is in \/usr\/lib\/libpkcs11.so. In order to start using it you need to set a pin and an SO pin. This you do with p11util thus:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>(echo 12345678;echo 1234) | sudo p11util --set-so-pin --set-user-pin --pin-from-stdin\n<\/code><\/pre><\/div>\n\n<p>It is strongly suggested to change the so pin and pin (in that order above) to something sensible. Now your token is ready to use. Your favorite PKCS11-client may or may not work depending on the state of support for PKCS11 function calls - please open tickets for whatever is missing. If you want\/need to talk PKCS11 from another host, you could install and configure <a href=\"https:\/\/wiki.cryptech.is\/PKCS11Proxy\">PKCS11Proxy<\/a> on both the novena and your host. Note that currently pkcs11-proxy doesn't handle differing word-lengths so your client-side will have to be 32bit (since the novena is).<\/p>\n<h2>Setting up the lab signer<\/h2>\n<p>The lab DNSSEC signer MUST, at this point, be running on a 32-bit system in order to work with the 32-bit Novena.<\/p>\n<p><a href=\"https:\/\/www.dropbox.com\/s\/f8b4s9vic7hsqyb\/cryptech-proxy-lab-20150718r2.pdf\">https:\/\/www.dropbox.com\/s\/f8b4s9vic7hsqyb\/cryptech-proxy-lab-20150718r2.pdf<\/a><\/p>","category":{"@attributes":{"term":"Novena"}}},{"title":"PKCS11 Proxy","link":{"@attributes":{"href":"https:\/\/wiki.cryptech.is\/PKCS11Proxy","rel":"alternate"}},"published":"2016-12-15T22:44:00+00:00","updated":"2016-12-15T22:44:00+00:00","author":{"name":"Cryptech Core Team"},"id":"tag:wiki.cryptech.is,2016-12-15:\/PKCS11Proxy","summary":"<p>The pkcs11-proxy is a way to tunnel PKCS11 over TCP (TLS). This page explains how to build and install PKCS11 proxy on the novena. There are various forks of this on github. We're going to use the SUNET fork since it support TLS-PSK for authentication out of the box. The \u2026<\/p>","content":"<p>The pkcs11-proxy is a way to tunnel PKCS11 over TCP (TLS). This page explains how to build and install PKCS11 proxy on the novena. There are various forks of this on github. We're going to use the SUNET fork since it support TLS-PSK for authentication out of the box. The proxy does not currently support different word length on each side of the tunnel so to use it with the novena platform your PKCS11 client must be 32 bit.<\/p>\n<h2>Why would you want this?<\/h2>\n<p>Not all applications will run on the arm-based novena. For instance not all parts of opendnssec is not fully ported to arm (and probably never will be).<\/p>\n<h2>Building PKCS11 proxy<\/h2>\n<div class=\"highlight\"><pre><span><\/span><code># apt-get -y install git cmake libssl-dev\n# git clone https:\/\/github.com\/SUNET\/pkcs11-proxy\n# cd pkcs11-proxy\n# mkdir build\n# cd build\n# cmake ..\n# make\n# make install\n<\/code><\/pre><\/div>\n\n<h2>Setting up pkcs11 proxy on the novena<\/h2>\n<p>Next create a pre-shared secret for TLS authentication...<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"err\">#<\/span><span class=\"w\"> <\/span><span class=\"o\">(<\/span><span class=\"nt\">echo<\/span><span class=\"w\"> <\/span><span class=\"nt\">-n<\/span><span class=\"w\"> <\/span><span class=\"s2\">&quot;psk:&quot;<\/span><span class=\"err\">`<\/span><span class=\"nt\">xxd<\/span><span class=\"w\"> <\/span><span class=\"nt\">-l<\/span><span class=\"w\"> <\/span><span class=\"nt\">16<\/span><span class=\"w\"> <\/span><span class=\"nt\">-p<\/span><span class=\"w\"> <\/span><span class=\"o\">\/<\/span><span class=\"nt\">dev<\/span><span class=\"o\">\/<\/span><span class=\"nt\">random<\/span><span class=\"err\">`<\/span><span class=\"o\">;<\/span><span class=\"w\"> <\/span><span class=\"nt\">echo<\/span><span class=\"o\">)<\/span><span class=\"w\"> <\/span><span class=\"o\">&gt;<\/span><span class=\"w\"> <\/span><span class=\"nt\">psk<\/span><span class=\"p\">.<\/span><span class=\"nc\">txt<\/span>\n<\/code><\/pre><\/div>\n\n<p>The resulting file (psk.txt) needs to be present both on the server and client side of the PKCS11 tunnel so copy it (or its one-line content) to the client side of your proxy.<\/p>\n<p>Now start a pkcs11 proxy daemon:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"gh\">#<\/span> env PKCS11_PROXY_TLS_PSK_FILE=&quot;psk.txt&quot; PKCS11_DAEMON_SOCKET=&quot;tls:\/\/&lt;your ip&gt;:4444&quot; pkcs11-daemon \/usr\/lib\/libpkcs11.so\n<\/code><\/pre><\/div>\n\n<p>Now on another machine (where pkcs11-proxy has been installed) access the remote token via<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"c1\"># env PKCS11_PROXY_TLS_PSK_FILE=&quot;psk.txt&quot; PKCS11_PROXY_SOCKET=&quot;tls:\/\/&lt;your ip&gt;:4444&quot; pkcs11-tool --module \/usr\/local\/lib\/libpkcs11-proxy.so -I<\/span>\n<\/code><\/pre><\/div>\n\n<h2>Tracing PKCS11 calls<\/h2>\n<p>If you want to trace the PKCS11 calls you can use pkcs11spy from the opensc package. If you install opensc look for an SO called pkcs11-spy.so. On the novena it is in \/usr\/lib\/arm-linux-gnueabihf\/pkcs11-spy.so. To use it set your environment variable PKCS11SPY to your real PKCS11 library and use pkcs11-spy.so instead. For instance to use PCKCS11 spy on the server side of the PKCS11 proxy start the pkcs11-daemon thus:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"gh\">#<\/span> env PKCS11_PROXY_TLS_PSK_FILE=&quot;psk.txt&quot; PKCS11SPY=&quot;\/usr\/lib\/libpkcs11.so&quot; PKCS11_DAEMON_SOCKET=&quot;tls:\/\/&lt;your ip&gt;:4444&quot; pkcs11-daemon \/usr\/lib\/arm-linux-gnueabihf\/pkcs11-spy.so\n<\/code><\/pre><\/div>\n\n<p>This should now generate lots of output when you run PKCS11 calls over the tunnel.<\/p>","category":{"@attributes":{"term":"Novena"}}}]}