-r--r--r-- 5554 librandombytes-20230126/doc/html/install.html raw
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html{overflow-y:scroll}
body{font-family:sans-serif}
p,ul,ol,blockquote,pre{font-size:1.0em;line-height:1.6em}
li p{font-size:1.0em}
blockquote p{font-size:1.0em}
tt{font-size:1.3em}
code{font-size:1.3em}
h1{font-size:1.5em}
h2{font-size:1.3em}
h3{font-size:1.0em}
h1 a{text-decoration:none}
table{border-collapse:collapse}
th,td{border:1px solid black}
table a{text-decoration:none}
table tr{font-size:1.0em;line-height:1.6em}
.links a:hover{text-decoration:underline}
.links a:active{text-decoration:underline}
.links img{width:200px;padding-left:1em}
.links td{border:0px;padding-top:0.5em;padding-bottom:0.5em}
.headline{padding:0;font-weight:bold;font-size:1.5em;vertical-align:top;padding-bottom:0.5em;color:#2f8a59}
.navt{display:inline-block;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;
min-width:14%;margin:0;padding:0;padding-left:0.5em;padding-right:0.5em;vertical-align:center;
font-weight:bold;font-size:1.1em;text-align:center;border:1px solid black}
.here{border-bottom:0px;background-color:#ffffff}
.away{background-color:#2f8a59;}
.away a{text-decoration:none;display:block;color:#ffffff}
.away a:hover,.away a:active{text-decoration:underline}
.main{margin:0;padding-top:0em;padding-bottom:1%;clear:both}
</style>
<title>
Install</title>
</head>
<body>
<div class=headline>
librandombytes
</div>
<div class=nav>
<div class="navt away"><a href=index.html>Intro</a>
</div><div class="navt away"><a href=download.html>Download</a>
</div><div class="navt here">Install
</div><div class="navt away"><a href=api.html>API</a>
</div><div class="navt away"><a href=security.html>Security</a>
</div></div>
<div class=main>
<p>Prerequisites: <code>python3</code>; <code>gcc</code> and/or <code>clang</code>; OpenSSL. Currently
tested only under Linux, but porting to other systems shouldn't be
difficult.</p>
<h3>For sysadmins</h3>
<p>To install in <code>/usr/local/{include,lib,bin}</code>:</p>
<pre><code> ./configure && make -j8 install
</code></pre>
<p>If you're running an old Linux system and see that the <code>cpucycles-info</code>
output says <code>randombytes source kernel-devurandom</code> (this will happen on
Linux kernels before 3.17), add the lines</p>
<pre><code> dd count=1 bs=64 if=/dev/random of=/dev/urandom status=none \
&& findmnt -t tmpfs -T /var/run >/dev/null \
&& touch /var/run/urandom-ready &
</code></pre>
<p>to your boot scripts to improve librandombytes startup time. On new
Linux systems, <code>cpucycles-info</code> should instead say <code>kernel-getrandom</code>
and startup time should be fine in any case, unaffected by these lines.</p>
<p>If you're running a Linux virtual machine (old or new) and see startup
delays, you probably need the host to provide <code>virtio-rng</code>.</p>
<h3>For developers with an unprivileged account</h3>
<p>Typically you'll already have</p>
<pre><code> export LD_LIBRARY_PATH="$HOME/lib"
export LIBRARY_PATH="$HOME/lib"
export CPATH="$HOME/include"
export PATH="$HOME/bin:$PATH"
</code></pre>
<p>in <code>$HOME/.profile</code>. To install in <code>$HOME/{include,lib,bin}</code>:</p>
<pre><code> ./configure --prefix=$HOME && make -j8 install
</code></pre>
<h3>For distributors creating a package</h3>
<p>Run</p>
<pre><code> ./configure --prefix=/usr && make -j8
</code></pre>
<p>and then follow your usual packaging procedures for the
<code>build/0/package</code> files:</p>
<pre><code> build/0/package/man/man3/randombytes.3
build/0/package/include/randombytes.h
build/0/package/lib/librandombytes*
build/0/package/bin/randombytes-info
</code></pre>
<p>Note that <code>librandombytes-kernel</code> and <code>librandombytes-openssl</code> are
alternative implementations of the same librandombytes API. There are
default symlinks to <code>librandombytes-kernel</code>, but you should allow the
sysadmin to change these symlinks to <code>librandombytes-openssl</code> by simply
installing a <code>librandombytes-openssl</code> package. The OpenSSL dependency is
for <code>librandombytes-openssl</code>; the rest of librandombytes is independent
of OpenSSL.</p>
<h3>More options</h3>
<p>You can run</p>
<pre><code> ./configure --host=amd64
</code></pre>
<p>to override <code>./configure</code>'s guess of the architecture that it should
compile for. However, cross-compilers aren't yet selected automatically.</p>
<p>Inside the <code>build</code> directory, <code>0</code> is symlinked to <code>amd64</code> for
<code>--host=amd64</code>. Running <code>make clean</code> removes <code>build/amd64</code>. Re-running
<code>./configure</code> automatically starts with <code>make clean</code>.</p>
<p>A subsequent <code>./configure --host=arm64</code> will create <code>build/arm64</code> and
symlink <code>0 -> arm64</code>, without touching an existing <code>build/amd64</code>.</p>
<p>Compilers tried are listed in <code>compilers/default</code>. Each compiler
includes <code>-fPIC</code> to create a shared library, <code>-fvisibility=hidden</code> to
hide non-public symbols in the library, and <code>-fwrapv</code> to switch to a
slightly less dangerous version of C. The first compiler that seems to
work is used to compile everything.</p><hr><font size=1><b>Version:</b>
This is version 2023.01.26 of the "Install" web page.
</font>
</div>
</body>
</html>