NaCl/Shared

To build a shared, dynamically linkable library from the nacl sourcecode: wget -O- http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | bunzip2 | tar -xf - cd nacl-20110221 rm -r crypto_onetimeauth/poly1305/amd64 sed -i "s/$/ -fPIC/" okcompilers/c wget -O- http://oss.ucis.nl/nacl/shared/shared.c | patch -p1 ./do gcc okcompilers/abiname.c -o abiname ABINAME="$(./abiname "" | cut -b 2-)" BUILDDIR="build/$(hostname | sed 's/\..*//' | tr -cd '[a-z][A-Z][0-9]')" NACLLIB="${BUILDDIR}/lib/${ABINAME}/libnacl.a" OKCOMPILER="$($BUILDDIR/bin/okc-${ABINAME} | head -n 1)" wget -O- http://oss.ucis.nl/nacl/shared/shared.c | ${OKCOMPILER} -x c -E - -I "${BUILDDIR}/include/${ABINAME}" | sed "s/export_//" | ${OKCOMPILER} -fPIC -nostdlib -shared -Wl,--no-undefined -o "libnacl.so" -x c - -x none "${NACLLIB}" install -m 644 libnacl.so /usr/lib/ mkdir /usr/include/nacl (  cd /usr/include/nacl   wget http://oss.ucis.nl/nacl/shared/crypto_box.h http://oss.ucis.nl/nacl/shared/crypto_box_curve25519xsalsa20poly1305.h http://oss.ucis.nl/nacl/shared/crypto_scalarmult_curve25519.h http://oss.ucis.nl/nacl/shared/crypto_sign_edwards25519sha512batch.h )
 * 1) Download and extract the NaCl sourcecode:
 * 1) Remove some implementations that do not want to be relocatable (it will fall back to another implementation)
 * 1) Patch the compiler commands to create relocatable code
 * 1) Patch the code to accept application input for the key generation functions
 * 1) Build the NaCl library, this takes some time...
 * 1) Build and locate some utilities used by the nacl build process to find the CPU architecture (and output directory) and an useable compiler
 * 1) Compile some frontend code into a shared library (download, preprocess with NaCl header files, rewrite some lines, compile and link with the static nacl library)
 * 1) Install library to /usr/lib
 * 1) Install header files to /usr/include/nacl

File list

 * http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2
 * http://oss.ucis.nl/nacl/shared/shared.c
 * http://oss.ucis.nl/nacl/shared/keypair_random_input.patch
 * http://oss.ucis.nl/nacl/shared/crypto_box.h
 * http://oss.ucis.nl/nacl/shared/crypto_box_curve25519xsalsa20poly1305.h
 * http://oss.ucis.nl/nacl/shared/crypto_scalarmult_curve25519.h
 * http://oss.ucis.nl/nacl/shared/crypto_sign_edwards25519sha512batch.h