diff --git a/.gitignore b/.gitignore index 5984f484..eef4119f 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,6 @@ m4/lt~obsolete.m4 man/*.html man/Makefile.in missing -src/libnacl/okcompilers/c -src/libnacl/okcompilers/do +src/libnacl-ref/include/version.h stamp-* testing diff --git a/configure.ac b/configure.ac index 6ab02574..b2fb81ee 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.61]) AC_INIT([libnacl-ref],[0.0.1],[https://github.com/jedisct1/nacl-ref]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([libltdl/config]) -AC_CONFIG_SRCDIR([src/libnacl/PROTOTYPES.c]) +AC_CONFIG_SRCDIR([src/libnacl-ref/randombytes/devurandom.c]) AC_CONFIG_HEADER([config.h]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar]) @@ -203,12 +203,8 @@ AH_VERBATIM([NDEBUG], [/* Never ever ignore assertions */ AC_CONFIG_FILES([Makefile src/Makefile - src/libnacl/Makefile - src/libnacl/tests/Makefile - src/libnacl/okcompilers/c - src/libnacl/okcompilers/do]) + src/libnacl-ref/Makefile + src/libnacl-ref/include/Makefile + src/libnacl-ref/include/nacl/version.h]) AC_OUTPUT - -chmod +x src/libnacl/do -chmod +x src/libnacl/okcompilers/do diff --git a/src/Makefile.am b/src/Makefile.am index 5e297a3a..212237c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ SUBDIRS = \ - libnacl + libnacl-ref diff --git a/src/libnacl-ref/Makefile.am b/src/libnacl-ref/Makefile.am new file mode 100644 index 00000000..cd92ab9e --- /dev/null +++ b/src/libnacl-ref/Makefile.am @@ -0,0 +1,88 @@ + +lib_LTLIBRARIES = \ + libnacl.la + +libnacl_la_SOURCES = \ + randombytes/devurandom.c \ + randombytes/devurandom.h \ + crypto_core/hsalsa20/ref2/core_hsalsa20.c \ + crypto_core/hsalsa20/ref2/crypto_core.h \ + crypto_core/hsalsa20/ref2/crypto_core_hsalsa20.h \ + crypto_core/salsa20/ref/core_salsa20.c \ + crypto_core/salsa20/ref/crypto_core.h \ + crypto_core/salsa20/ref/crypto_core_salsa20.h \ + crypto_core/salsa2012/ref/core_salsa2012.c \ + crypto_core/salsa2012/ref/crypto_core.h \ + crypto_core/salsa2012/ref/crypto_core_salsa2012.h \ + crypto_core/salsa208/ref/core_salsa208.c \ + crypto_core/salsa208/ref/crypto_core.h \ + crypto_core/salsa208/ref/crypto_core_salsa208.h \ + crypto_scalarmult/curve25519/ref/base.c \ + crypto_scalarmult/curve25519/ref/crypto_scalarmult.h \ + crypto_scalarmult/curve25519/ref/crypto_scalarmult_curve25519.h \ + crypto_scalarmult/curve25519/ref/smult.c \ + crypto_hashblocks/sha256/ref/blocks_sha256.c \ + crypto_hashblocks/sha256/ref/crypto_hashblocks.h \ + crypto_hashblocks/sha256/ref/crypto_hashblocks_sha256.h \ + crypto_hashblocks/sha512/ref/blocks_sha512.c \ + crypto_hashblocks/sha512/ref/crypto_hashblocks.h \ + crypto_hashblocks/sha512/ref/crypto_hashblocks_sha512.h \ + crypto_hash/sha256/ref/crypto_hash.h \ + crypto_hash/sha256/ref/hash_sha256.c \ + crypto_hash/sha512/ref/crypto_hash.h \ + crypto_hash/sha512/ref/hash_sha512.c \ + crypto_verify/16/ref/crypto_verify.h \ + crypto_verify/16/ref/verify_16.c \ + crypto_verify/32/ref/crypto_verify.h \ + crypto_verify/32/ref/verify_32.c \ + crypto_auth/hmacsha256/ref/crypto_auth.h \ + crypto_auth/hmacsha256/ref/hmac_hmacsha256.c \ + crypto_auth/hmacsha256/ref/verify_hmacsha256.c \ + crypto_auth/hmacsha512256/ref/api.h \ + crypto_auth/hmacsha512256/ref/crypto_auth.h \ + crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c \ + crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c \ + crypto_stream/salsa20/ref/crypto_stream.h \ + crypto_stream/salsa20/ref/stream_salsa20.c \ + crypto_stream/salsa20/ref/xor_salsa20.c \ + crypto_stream/salsa2012/ref/crypto_stream.h \ + crypto_stream/salsa2012/ref/stream_salsa2012.c \ + crypto_stream/salsa2012/ref/xor_salsa2012.c \ + crypto_stream/salsa208/ref/crypto_stream.h \ + crypto_stream/salsa208/ref/stream_salsa208.c \ + crypto_stream/salsa208/ref/xor_salsa208.c \ + crypto_stream/xsalsa20/ref/crypto_stream.h \ + crypto_stream/xsalsa20/ref/stream_xsalsa20.c \ + crypto_stream/xsalsa20/ref/xor_xsalsa20.c \ + crypto_onetimeauth/poly1305/ref/auth_poly1305.c \ + crypto_onetimeauth/poly1305/ref/crypto_onetimeauth.h \ + crypto_onetimeauth/poly1305/ref/verify_poly1305.c \ + crypto_sign/edwards25519sha512batch/ref/crypto_sign.h \ + crypto_sign/edwards25519sha512batch/ref/fe25519.h \ + crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/ref/ge25519.h \ + crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/ref/sc25519.h \ + crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c \ + crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c \ + crypto_secretbox/xsalsa20poly1305/ref/crypto_secretbox.h \ + crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c \ + crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c \ + crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c \ + crypto_box/curve25519xsalsa20poly1305/ref/crypto_box.h \ + crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c + +libnacl_la_LDFLAGS = \ + $(AM_LDFLAGS) \ + -avoid-version \ + -export-dynamic \ + -module \ + -no-undefined + +libnacl_la_CPPFLAGS = \ + $(LTDLINCL) \ + -Iinclude/nacl + +SUBDIRS = \ + include diff --git a/src/libnacl/crypto_auth/hmacsha256/checksum b/src/libnacl-ref/crypto_auth/hmacsha256/checksum similarity index 100% rename from src/libnacl/crypto_auth/hmacsha256/checksum rename to src/libnacl-ref/crypto_auth/hmacsha256/checksum diff --git a/src/libnacl/crypto_auth/hmacsha256/ref/api.h b/src/libnacl-ref/crypto_auth/hmacsha256/ref/api.h similarity index 100% rename from src/libnacl/crypto_auth/hmacsha256/ref/api.h rename to src/libnacl-ref/crypto_auth/hmacsha256/ref/api.h diff --git a/src/libnacl-ref/crypto_auth/hmacsha256/ref/crypto_auth.h b/src/libnacl-ref/crypto_auth/hmacsha256/ref/crypto_auth.h new file mode 100644 index 00000000..5ca6a52d --- /dev/null +++ b/src/libnacl-ref/crypto_auth/hmacsha256/ref/crypto_auth.h @@ -0,0 +1,14 @@ +#ifndef crypto_auth_H +#define crypto_auth_H + +#include "crypto_auth_hmacsha256.h" + +#define crypto_auth crypto_auth_hmacsha256 +#define crypto_auth_verify crypto_auth_hmacsha256_verify +#define crypto_auth_BYTES crypto_auth_hmacsha256_BYTES +#define crypto_auth_KEYBYTES crypto_auth_hmacsha256_KEYBYTES +#define crypto_auth_PRIMITIVE "hmacsha256" +#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha256_IMPLEMENTATION +#define crypto_auth_VERSION crypto_auth_hmacsha256_VERSION + +#endif diff --git a/src/libnacl/crypto_auth/hmacsha256/ref/hmac.c b/src/libnacl-ref/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c similarity index 100% rename from src/libnacl/crypto_auth/hmacsha256/ref/hmac.c rename to src/libnacl-ref/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c diff --git a/src/libnacl/crypto_auth/hmacsha256/ref/verify.c b/src/libnacl-ref/crypto_auth/hmacsha256/ref/verify_hmacsha256.c similarity index 100% rename from src/libnacl/crypto_auth/hmacsha256/ref/verify.c rename to src/libnacl-ref/crypto_auth/hmacsha256/ref/verify_hmacsha256.c diff --git a/src/libnacl/crypto_auth/hmacsha512256/checksum b/src/libnacl-ref/crypto_auth/hmacsha512256/checksum similarity index 100% rename from src/libnacl/crypto_auth/hmacsha512256/checksum rename to src/libnacl-ref/crypto_auth/hmacsha512256/checksum diff --git a/src/libnacl/crypto_auth/hmacsha512256/ref/api.h b/src/libnacl-ref/crypto_auth/hmacsha512256/ref/api.h similarity index 100% rename from src/libnacl/crypto_auth/hmacsha512256/ref/api.h rename to src/libnacl-ref/crypto_auth/hmacsha512256/ref/api.h diff --git a/src/libnacl-ref/crypto_auth/hmacsha512256/ref/crypto_auth.h b/src/libnacl-ref/crypto_auth/hmacsha512256/ref/crypto_auth.h new file mode 100644 index 00000000..32775575 --- /dev/null +++ b/src/libnacl-ref/crypto_auth/hmacsha512256/ref/crypto_auth.h @@ -0,0 +1,14 @@ +#ifndef crypto_auth_H +#define crypto_auth_H + +#include "crypto_auth_hmacsha512256.h" + +#define crypto_auth crypto_auth_hmacsha512256 +#define crypto_auth_verify crypto_auth_hmacsha512256_verify +#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES +#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES +#define crypto_auth_PRIMITIVE "hmacsha512256" +#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION +#define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION + +#endif diff --git a/src/libnacl/crypto_auth/hmacsha512256/ref/hmac.c b/src/libnacl-ref/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c similarity index 100% rename from src/libnacl/crypto_auth/hmacsha512256/ref/hmac.c rename to src/libnacl-ref/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c diff --git a/src/libnacl/crypto_auth/hmacsha512256/ref/verify.c b/src/libnacl-ref/crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c similarity index 100% rename from src/libnacl/crypto_auth/hmacsha512256/ref/verify.c rename to src/libnacl-ref/crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c diff --git a/src/libnacl/crypto_auth/measure.c b/src/libnacl-ref/crypto_auth/measure.c similarity index 100% rename from src/libnacl/crypto_auth/measure.c rename to src/libnacl-ref/crypto_auth/measure.c diff --git a/src/libnacl/crypto_auth/try.c b/src/libnacl-ref/crypto_auth/try.c similarity index 100% rename from src/libnacl/crypto_auth/try.c rename to src/libnacl-ref/crypto_auth/try.c diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/checksum b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/checksum similarity index 100% rename from src/libnacl/crypto_box/curve25519xsalsa20poly1305/checksum rename to src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/checksum diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/after.c b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c similarity index 100% rename from src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/after.c rename to src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/api.h b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/api.h similarity index 100% rename from src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/api.h rename to src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/api.h diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c similarity index 100% rename from src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c rename to src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c similarity index 100% rename from src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c rename to src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c diff --git a/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/crypto_box.h b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/crypto_box.h new file mode 100644 index 00000000..a6f1c4f6 --- /dev/null +++ b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/crypto_box.h @@ -0,0 +1,22 @@ +#ifndef crypto_box_H +#define crypto_box_H + +#include "crypto_box_curve25519xsalsa20poly1305.h" + +#define crypto_box crypto_box_curve25519xsalsa20poly1305 +#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open +#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair +#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm +#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm +#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm +#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES +#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES +#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES +#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES +#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES +#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES +#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305" +#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION +#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION + +#endif diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/keypair.c b/src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c similarity index 100% rename from src/libnacl/crypto_box/curve25519xsalsa20poly1305/ref/keypair.c rename to src/libnacl-ref/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c diff --git a/src/libnacl/crypto_box/measure.c b/src/libnacl-ref/crypto_box/measure.c similarity index 100% rename from src/libnacl/crypto_box/measure.c rename to src/libnacl-ref/crypto_box/measure.c diff --git a/src/libnacl/crypto_box/try.c b/src/libnacl-ref/crypto_box/try.c similarity index 100% rename from src/libnacl/crypto_box/try.c rename to src/libnacl-ref/crypto_box/try.c diff --git a/src/libnacl/crypto_core/hsalsa20/checksum b/src/libnacl-ref/crypto_core/hsalsa20/checksum similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/checksum rename to src/libnacl-ref/crypto_core/hsalsa20/checksum diff --git a/src/libnacl/crypto_core/hsalsa20/ref/api.h b/src/libnacl-ref/crypto_core/hsalsa20/ref/api.h similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/ref/api.h rename to src/libnacl-ref/crypto_core/hsalsa20/ref/api.h diff --git a/src/libnacl/crypto_core/hsalsa20/ref/core.c b/src/libnacl-ref/crypto_core/hsalsa20/ref/core.c similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/ref/core.c rename to src/libnacl-ref/crypto_core/hsalsa20/ref/core.c diff --git a/src/libnacl-ref/crypto_core/hsalsa20/ref/crypto_core.h b/src/libnacl-ref/crypto_core/hsalsa20/ref/crypto_core.h new file mode 100644 index 00000000..f7daf16f --- /dev/null +++ b/src/libnacl-ref/crypto_core/hsalsa20/ref/crypto_core.h @@ -0,0 +1,15 @@ +#ifndef crypto_core_H +#define crypto_core_H + +#include "crypto_core_hsalsa20.h" + +#define crypto_core crypto_core_hsalsa20 +#define crypto_core_OUTPUTBYTES crypto_core_hsalsa20_OUTPUTBYTES +#define crypto_core_INPUTBYTES crypto_core_hsalsa20_INPUTBYTES +#define crypto_core_KEYBYTES crypto_core_hsalsa20_KEYBYTES +#define crypto_core_CONSTBYTES crypto_core_hsalsa20_CONSTBYTES +#define crypto_core_PRIMITIVE "hsalsa20" +#define crypto_core_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION +#define crypto_core_VERSION crypto_core_hsalsa20_VERSION + +#endif diff --git a/src/libnacl/crypto_core/hsalsa20/ref/implementors b/src/libnacl-ref/crypto_core/hsalsa20/ref/implementors similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/ref/implementors rename to src/libnacl-ref/crypto_core/hsalsa20/ref/implementors diff --git a/src/libnacl/crypto_core/hsalsa20/ref2/api.h b/src/libnacl-ref/crypto_core/hsalsa20/ref2/api.h similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/ref2/api.h rename to src/libnacl-ref/crypto_core/hsalsa20/ref2/api.h diff --git a/src/libnacl/crypto_core/hsalsa20/ref2/core.c b/src/libnacl-ref/crypto_core/hsalsa20/ref2/core_hsalsa20.c similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/ref2/core.c rename to src/libnacl-ref/crypto_core/hsalsa20/ref2/core_hsalsa20.c diff --git a/src/libnacl-ref/crypto_core/hsalsa20/ref2/crypto_core.h b/src/libnacl-ref/crypto_core/hsalsa20/ref2/crypto_core.h new file mode 100644 index 00000000..f7daf16f --- /dev/null +++ b/src/libnacl-ref/crypto_core/hsalsa20/ref2/crypto_core.h @@ -0,0 +1,15 @@ +#ifndef crypto_core_H +#define crypto_core_H + +#include "crypto_core_hsalsa20.h" + +#define crypto_core crypto_core_hsalsa20 +#define crypto_core_OUTPUTBYTES crypto_core_hsalsa20_OUTPUTBYTES +#define crypto_core_INPUTBYTES crypto_core_hsalsa20_INPUTBYTES +#define crypto_core_KEYBYTES crypto_core_hsalsa20_KEYBYTES +#define crypto_core_CONSTBYTES crypto_core_hsalsa20_CONSTBYTES +#define crypto_core_PRIMITIVE "hsalsa20" +#define crypto_core_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION +#define crypto_core_VERSION crypto_core_hsalsa20_VERSION + +#endif diff --git a/src/libnacl/crypto_core/hsalsa20/ref2/implementors b/src/libnacl-ref/crypto_core/hsalsa20/ref2/implementors similarity index 100% rename from src/libnacl/crypto_core/hsalsa20/ref2/implementors rename to src/libnacl-ref/crypto_core/hsalsa20/ref2/implementors diff --git a/src/libnacl/crypto_core/salsa20/checksum b/src/libnacl-ref/crypto_core/salsa20/checksum similarity index 100% rename from src/libnacl/crypto_core/salsa20/checksum rename to src/libnacl-ref/crypto_core/salsa20/checksum diff --git a/src/libnacl/crypto_core/salsa20/ref/api.h b/src/libnacl-ref/crypto_core/salsa20/ref/api.h similarity index 100% rename from src/libnacl/crypto_core/salsa20/ref/api.h rename to src/libnacl-ref/crypto_core/salsa20/ref/api.h diff --git a/src/libnacl/crypto_core/salsa20/ref/core.c b/src/libnacl-ref/crypto_core/salsa20/ref/core_salsa20.c similarity index 100% rename from src/libnacl/crypto_core/salsa20/ref/core.c rename to src/libnacl-ref/crypto_core/salsa20/ref/core_salsa20.c diff --git a/src/libnacl-ref/crypto_core/salsa20/ref/crypto_core.h b/src/libnacl-ref/crypto_core/salsa20/ref/crypto_core.h new file mode 100644 index 00000000..88374aa0 --- /dev/null +++ b/src/libnacl-ref/crypto_core/salsa20/ref/crypto_core.h @@ -0,0 +1,15 @@ +#ifndef crypto_core_H +#define crypto_core_H + +#include "crypto_core_salsa20.h" + +#define crypto_core crypto_core_salsa20 +#define crypto_core_OUTPUTBYTES crypto_core_salsa20_OUTPUTBYTES +#define crypto_core_INPUTBYTES crypto_core_salsa20_INPUTBYTES +#define crypto_core_KEYBYTES crypto_core_salsa20_KEYBYTES +#define crypto_core_CONSTBYTES crypto_core_salsa20_CONSTBYTES +#define crypto_core_PRIMITIVE "salsa20" +#define crypto_core_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION +#define crypto_core_VERSION crypto_core_salsa20_VERSION + +#endif diff --git a/src/libnacl/crypto_core/salsa20/ref/implementors b/src/libnacl-ref/crypto_core/salsa20/ref/implementors similarity index 100% rename from src/libnacl/crypto_core/salsa20/ref/implementors rename to src/libnacl-ref/crypto_core/salsa20/ref/implementors diff --git a/src/libnacl/crypto_core/salsa2012/checksum b/src/libnacl-ref/crypto_core/salsa2012/checksum similarity index 100% rename from src/libnacl/crypto_core/salsa2012/checksum rename to src/libnacl-ref/crypto_core/salsa2012/checksum diff --git a/src/libnacl/crypto_core/salsa2012/ref/api.h b/src/libnacl-ref/crypto_core/salsa2012/ref/api.h similarity index 100% rename from src/libnacl/crypto_core/salsa2012/ref/api.h rename to src/libnacl-ref/crypto_core/salsa2012/ref/api.h diff --git a/src/libnacl/crypto_core/salsa2012/ref/core.c b/src/libnacl-ref/crypto_core/salsa2012/ref/core_salsa2012.c similarity index 100% rename from src/libnacl/crypto_core/salsa2012/ref/core.c rename to src/libnacl-ref/crypto_core/salsa2012/ref/core_salsa2012.c diff --git a/src/libnacl-ref/crypto_core/salsa2012/ref/crypto_core.h b/src/libnacl-ref/crypto_core/salsa2012/ref/crypto_core.h new file mode 100644 index 00000000..320ad91b --- /dev/null +++ b/src/libnacl-ref/crypto_core/salsa2012/ref/crypto_core.h @@ -0,0 +1,15 @@ +#ifndef crypto_core_H +#define crypto_core_H + +#include "crypto_core_salsa2012.h" + +#define crypto_core crypto_core_salsa2012 +#define crypto_core_OUTPUTBYTES crypto_core_salsa2012_OUTPUTBYTES +#define crypto_core_INPUTBYTES crypto_core_salsa2012_INPUTBYTES +#define crypto_core_KEYBYTES crypto_core_salsa2012_KEYBYTES +#define crypto_core_CONSTBYTES crypto_core_salsa2012_CONSTBYTES +#define crypto_core_PRIMITIVE "salsa2012" +#define crypto_core_IMPLEMENTATION crypto_core_salsa2012_IMPLEMENTATION +#define crypto_core_VERSION crypto_core_salsa2012_VERSION + +#endif diff --git a/src/libnacl/crypto_core/salsa2012/ref/implementors b/src/libnacl-ref/crypto_core/salsa2012/ref/implementors similarity index 100% rename from src/libnacl/crypto_core/salsa2012/ref/implementors rename to src/libnacl-ref/crypto_core/salsa2012/ref/implementors diff --git a/src/libnacl/crypto_core/salsa208/checksum b/src/libnacl-ref/crypto_core/salsa208/checksum similarity index 100% rename from src/libnacl/crypto_core/salsa208/checksum rename to src/libnacl-ref/crypto_core/salsa208/checksum diff --git a/src/libnacl/crypto_core/salsa208/ref/api.h b/src/libnacl-ref/crypto_core/salsa208/ref/api.h similarity index 100% rename from src/libnacl/crypto_core/salsa208/ref/api.h rename to src/libnacl-ref/crypto_core/salsa208/ref/api.h diff --git a/src/libnacl/crypto_core/salsa208/ref/core.c b/src/libnacl-ref/crypto_core/salsa208/ref/core_salsa208.c similarity index 100% rename from src/libnacl/crypto_core/salsa208/ref/core.c rename to src/libnacl-ref/crypto_core/salsa208/ref/core_salsa208.c diff --git a/src/libnacl-ref/crypto_core/salsa208/ref/crypto_core.h b/src/libnacl-ref/crypto_core/salsa208/ref/crypto_core.h new file mode 100644 index 00000000..0f65f53a --- /dev/null +++ b/src/libnacl-ref/crypto_core/salsa208/ref/crypto_core.h @@ -0,0 +1,15 @@ +#ifndef crypto_core_H +#define crypto_core_H + +#include "crypto_core_salsa208.h" + +#define crypto_core crypto_core_salsa208 +#define crypto_core_OUTPUTBYTES crypto_core_salsa208_OUTPUTBYTES +#define crypto_core_INPUTBYTES crypto_core_salsa208_INPUTBYTES +#define crypto_core_KEYBYTES crypto_core_salsa208_KEYBYTES +#define crypto_core_CONSTBYTES crypto_core_salsa208_CONSTBYTES +#define crypto_core_PRIMITIVE "salsa208" +#define crypto_core_IMPLEMENTATION crypto_core_salsa208_IMPLEMENTATION +#define crypto_core_VERSION crypto_core_salsa208_VERSION + +#endif diff --git a/src/libnacl/crypto_core/salsa208/ref/implementors b/src/libnacl-ref/crypto_core/salsa208/ref/implementors similarity index 100% rename from src/libnacl/crypto_core/salsa208/ref/implementors rename to src/libnacl-ref/crypto_core/salsa208/ref/implementors diff --git a/src/libnacl/crypto_hash/measure.c b/src/libnacl-ref/crypto_hash/measure.c similarity index 100% rename from src/libnacl/crypto_hash/measure.c rename to src/libnacl-ref/crypto_hash/measure.c diff --git a/src/libnacl/crypto_hash/sha256/checksum b/src/libnacl-ref/crypto_hash/sha256/checksum similarity index 100% rename from src/libnacl/crypto_hash/sha256/checksum rename to src/libnacl-ref/crypto_hash/sha256/checksum diff --git a/src/libnacl/crypto_hash/sha256/ref/api.h b/src/libnacl-ref/crypto_hash/sha256/ref/api.h similarity index 100% rename from src/libnacl/crypto_hash/sha256/ref/api.h rename to src/libnacl-ref/crypto_hash/sha256/ref/api.h diff --git a/src/libnacl-ref/crypto_hash/sha256/ref/crypto_hash.h b/src/libnacl-ref/crypto_hash/sha256/ref/crypto_hash.h new file mode 100644 index 00000000..e89f6e60 --- /dev/null +++ b/src/libnacl-ref/crypto_hash/sha256/ref/crypto_hash.h @@ -0,0 +1,12 @@ +#ifndef crypto_hash_H +#define crypto_hash_H + +#include "crypto_hash_sha256.h" + +#define crypto_hash crypto_hash_sha256 +#define crypto_hash_BYTES crypto_hash_sha256_BYTES +#define crypto_hash_PRIMITIVE "sha256" +#define crypto_hash_IMPLEMENTATION crypto_hash_sha256_IMPLEMENTATION +#define crypto_hash_VERSION crypto_hash_sha256_VERSION + +#endif diff --git a/src/libnacl/crypto_hash/sha256/ref/hash.c b/src/libnacl-ref/crypto_hash/sha256/ref/hash_sha256.c similarity index 100% rename from src/libnacl/crypto_hash/sha256/ref/hash.c rename to src/libnacl-ref/crypto_hash/sha256/ref/hash_sha256.c diff --git a/src/libnacl/crypto_hash/sha256/ref/implementors b/src/libnacl-ref/crypto_hash/sha256/ref/implementors similarity index 100% rename from src/libnacl/crypto_hash/sha256/ref/implementors rename to src/libnacl-ref/crypto_hash/sha256/ref/implementors diff --git a/src/libnacl/crypto_hash/sha512/checksum b/src/libnacl-ref/crypto_hash/sha512/checksum similarity index 100% rename from src/libnacl/crypto_hash/sha512/checksum rename to src/libnacl-ref/crypto_hash/sha512/checksum diff --git a/src/libnacl/crypto_hash/sha512/ref/api.h b/src/libnacl-ref/crypto_hash/sha512/ref/api.h similarity index 100% rename from src/libnacl/crypto_hash/sha512/ref/api.h rename to src/libnacl-ref/crypto_hash/sha512/ref/api.h diff --git a/src/libnacl-ref/crypto_hash/sha512/ref/crypto_hash.h b/src/libnacl-ref/crypto_hash/sha512/ref/crypto_hash.h new file mode 100644 index 00000000..c24f367e --- /dev/null +++ b/src/libnacl-ref/crypto_hash/sha512/ref/crypto_hash.h @@ -0,0 +1,12 @@ +#ifndef crypto_hash_H +#define crypto_hash_H + +#include "crypto_hash_sha512.h" + +#define crypto_hash crypto_hash_sha512 +#define crypto_hash_BYTES crypto_hash_sha512_BYTES +#define crypto_hash_PRIMITIVE "sha512" +#define crypto_hash_IMPLEMENTATION crypto_hash_sha512_IMPLEMENTATION +#define crypto_hash_VERSION crypto_hash_sha512_VERSION + +#endif diff --git a/src/libnacl/crypto_hash/sha512/ref/hash.c b/src/libnacl-ref/crypto_hash/sha512/ref/hash_sha512.c similarity index 100% rename from src/libnacl/crypto_hash/sha512/ref/hash.c rename to src/libnacl-ref/crypto_hash/sha512/ref/hash_sha512.c diff --git a/src/libnacl/crypto_hash/sha512/ref/implementors b/src/libnacl-ref/crypto_hash/sha512/ref/implementors similarity index 100% rename from src/libnacl/crypto_hash/sha512/ref/implementors rename to src/libnacl-ref/crypto_hash/sha512/ref/implementors diff --git a/src/libnacl/crypto_hash/try.c b/src/libnacl-ref/crypto_hash/try.c similarity index 100% rename from src/libnacl/crypto_hash/try.c rename to src/libnacl-ref/crypto_hash/try.c diff --git a/src/libnacl/crypto_hashblocks/measure.c b/src/libnacl-ref/crypto_hashblocks/measure.c similarity index 100% rename from src/libnacl/crypto_hashblocks/measure.c rename to src/libnacl-ref/crypto_hashblocks/measure.c diff --git a/src/libnacl/crypto_hashblocks/sha256/checksum b/src/libnacl-ref/crypto_hashblocks/sha256/checksum similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/checksum rename to src/libnacl-ref/crypto_hashblocks/sha256/checksum diff --git a/src/libnacl/crypto_hashblocks/sha256/inplace/api.h b/src/libnacl-ref/crypto_hashblocks/sha256/inplace/api.h similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/inplace/api.h rename to src/libnacl-ref/crypto_hashblocks/sha256/inplace/api.h diff --git a/src/libnacl/crypto_hashblocks/sha256/inplace/blocks.c b/src/libnacl-ref/crypto_hashblocks/sha256/inplace/blocks.c similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/inplace/blocks.c rename to src/libnacl-ref/crypto_hashblocks/sha256/inplace/blocks.c diff --git a/src/libnacl/crypto_hashblocks/sha256/inplace/implementors b/src/libnacl-ref/crypto_hashblocks/sha256/inplace/implementors similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/inplace/implementors rename to src/libnacl-ref/crypto_hashblocks/sha256/inplace/implementors diff --git a/src/libnacl/crypto_hashblocks/sha256/ref/api.h b/src/libnacl-ref/crypto_hashblocks/sha256/ref/api.h similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/ref/api.h rename to src/libnacl-ref/crypto_hashblocks/sha256/ref/api.h diff --git a/src/libnacl/crypto_hashblocks/sha256/ref/blocks.c b/src/libnacl-ref/crypto_hashblocks/sha256/ref/blocks_sha256.c similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/ref/blocks.c rename to src/libnacl-ref/crypto_hashblocks/sha256/ref/blocks_sha256.c diff --git a/src/libnacl-ref/crypto_hashblocks/sha256/ref/crypto_hashblocks.h b/src/libnacl-ref/crypto_hashblocks/sha256/ref/crypto_hashblocks.h new file mode 100644 index 00000000..f0108797 --- /dev/null +++ b/src/libnacl-ref/crypto_hashblocks/sha256/ref/crypto_hashblocks.h @@ -0,0 +1,13 @@ +#ifndef crypto_hashblocks_H +#define crypto_hashblocks_H + +#include "crypto_hashblocks_sha256.h" + +#define crypto_hashblocks crypto_hashblocks_sha256 +#define crypto_hashblocks_STATEBYTES crypto_hashblocks_sha256_STATEBYTES +#define crypto_hashblocks_BLOCKBYTES crypto_hashblocks_sha256_BLOCKBYTES +#define crypto_hashblocks_PRIMITIVE "sha256" +#define crypto_hashblocks_IMPLEMENTATION crypto_hashblocks_sha256_IMPLEMENTATION +#define crypto_hashblocks_VERSION crypto_hashblocks_sha256_VERSION + +#endif diff --git a/src/libnacl/crypto_hashblocks/sha256/ref/implementors b/src/libnacl-ref/crypto_hashblocks/sha256/ref/implementors similarity index 100% rename from src/libnacl/crypto_hashblocks/sha256/ref/implementors rename to src/libnacl-ref/crypto_hashblocks/sha256/ref/implementors diff --git a/src/libnacl/crypto_hashblocks/sha512/checksum b/src/libnacl-ref/crypto_hashblocks/sha512/checksum similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/checksum rename to src/libnacl-ref/crypto_hashblocks/sha512/checksum diff --git a/src/libnacl/crypto_hashblocks/sha512/inplace/api.h b/src/libnacl-ref/crypto_hashblocks/sha512/inplace/api.h similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/inplace/api.h rename to src/libnacl-ref/crypto_hashblocks/sha512/inplace/api.h diff --git a/src/libnacl/crypto_hashblocks/sha512/inplace/blocks.c b/src/libnacl-ref/crypto_hashblocks/sha512/inplace/blocks.c similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/inplace/blocks.c rename to src/libnacl-ref/crypto_hashblocks/sha512/inplace/blocks.c diff --git a/src/libnacl/crypto_hashblocks/sha512/inplace/implementors b/src/libnacl-ref/crypto_hashblocks/sha512/inplace/implementors similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/inplace/implementors rename to src/libnacl-ref/crypto_hashblocks/sha512/inplace/implementors diff --git a/src/libnacl/crypto_hashblocks/sha512/ref/api.h b/src/libnacl-ref/crypto_hashblocks/sha512/ref/api.h similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/ref/api.h rename to src/libnacl-ref/crypto_hashblocks/sha512/ref/api.h diff --git a/src/libnacl/crypto_hashblocks/sha512/ref/blocks.c b/src/libnacl-ref/crypto_hashblocks/sha512/ref/blocks_sha512.c similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/ref/blocks.c rename to src/libnacl-ref/crypto_hashblocks/sha512/ref/blocks_sha512.c diff --git a/src/libnacl-ref/crypto_hashblocks/sha512/ref/crypto_hashblocks.h b/src/libnacl-ref/crypto_hashblocks/sha512/ref/crypto_hashblocks.h new file mode 100644 index 00000000..ce389b63 --- /dev/null +++ b/src/libnacl-ref/crypto_hashblocks/sha512/ref/crypto_hashblocks.h @@ -0,0 +1,13 @@ +#ifndef crypto_hashblocks_H +#define crypto_hashblocks_H + +#include "crypto_hashblocks_sha512.h" + +#define crypto_hashblocks crypto_hashblocks_sha512 +#define crypto_hashblocks_STATEBYTES crypto_hashblocks_sha512_STATEBYTES +#define crypto_hashblocks_BLOCKBYTES crypto_hashblocks_sha512_BLOCKBYTES +#define crypto_hashblocks_PRIMITIVE "sha512" +#define crypto_hashblocks_IMPLEMENTATION crypto_hashblocks_sha512_IMPLEMENTATION +#define crypto_hashblocks_VERSION crypto_hashblocks_sha512_VERSION + +#endif diff --git a/src/libnacl/crypto_hashblocks/sha512/ref/implementors b/src/libnacl-ref/crypto_hashblocks/sha512/ref/implementors similarity index 100% rename from src/libnacl/crypto_hashblocks/sha512/ref/implementors rename to src/libnacl-ref/crypto_hashblocks/sha512/ref/implementors diff --git a/src/libnacl/crypto_hashblocks/try.c b/src/libnacl-ref/crypto_hashblocks/try.c similarity index 100% rename from src/libnacl/crypto_hashblocks/try.c rename to src/libnacl-ref/crypto_hashblocks/try.c diff --git a/src/libnacl/crypto_onetimeauth/measure.c b/src/libnacl-ref/crypto_onetimeauth/measure.c similarity index 100% rename from src/libnacl/crypto_onetimeauth/measure.c rename to src/libnacl-ref/crypto_onetimeauth/measure.c diff --git a/src/libnacl/crypto_onetimeauth/poly1305/checksum b/src/libnacl-ref/crypto_onetimeauth/poly1305/checksum similarity index 100% rename from src/libnacl/crypto_onetimeauth/poly1305/checksum rename to src/libnacl-ref/crypto_onetimeauth/poly1305/checksum diff --git a/src/libnacl/crypto_onetimeauth/poly1305/53/api.h b/src/libnacl-ref/crypto_onetimeauth/poly1305/ref/api.h similarity index 100% rename from src/libnacl/crypto_onetimeauth/poly1305/53/api.h rename to src/libnacl-ref/crypto_onetimeauth/poly1305/ref/api.h diff --git a/src/libnacl/crypto_onetimeauth/poly1305/ref/auth.c b/src/libnacl-ref/crypto_onetimeauth/poly1305/ref/auth_poly1305.c similarity index 100% rename from src/libnacl/crypto_onetimeauth/poly1305/ref/auth.c rename to src/libnacl-ref/crypto_onetimeauth/poly1305/ref/auth_poly1305.c diff --git a/src/libnacl-ref/crypto_onetimeauth/poly1305/ref/crypto_onetimeauth.h b/src/libnacl-ref/crypto_onetimeauth/poly1305/ref/crypto_onetimeauth.h new file mode 100644 index 00000000..450e122d --- /dev/null +++ b/src/libnacl-ref/crypto_onetimeauth/poly1305/ref/crypto_onetimeauth.h @@ -0,0 +1,14 @@ +#ifndef crypto_onetimeauth_H +#define crypto_onetimeauth_H + +#include "crypto_onetimeauth_poly1305.h" + +#define crypto_onetimeauth crypto_onetimeauth_poly1305 +#define crypto_onetimeauth_verify crypto_onetimeauth_poly1305_verify +#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES +#define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES +#define crypto_onetimeauth_PRIMITIVE "poly1305" +#define crypto_onetimeauth_IMPLEMENTATION crypto_onetimeauth_poly1305_IMPLEMENTATION +#define crypto_onetimeauth_VERSION crypto_onetimeauth_poly1305_VERSION + +#endif diff --git a/src/libnacl/crypto_onetimeauth/poly1305/53/verify.c b/src/libnacl-ref/crypto_onetimeauth/poly1305/ref/verify_poly1305.c similarity index 100% rename from src/libnacl/crypto_onetimeauth/poly1305/53/verify.c rename to src/libnacl-ref/crypto_onetimeauth/poly1305/ref/verify_poly1305.c diff --git a/src/libnacl/crypto_onetimeauth/try.c b/src/libnacl-ref/crypto_onetimeauth/try.c similarity index 100% rename from src/libnacl/crypto_onetimeauth/try.c rename to src/libnacl-ref/crypto_onetimeauth/try.c diff --git a/src/libnacl/crypto_scalarmult/curve25519/checksum b/src/libnacl-ref/crypto_scalarmult/curve25519/checksum similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/checksum rename to src/libnacl-ref/crypto_scalarmult/curve25519/checksum diff --git a/src/libnacl/crypto_scalarmult/curve25519/donna_c64/api.h b/src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/api.h similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/donna_c64/api.h rename to src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/api.h diff --git a/src/libnacl/crypto_scalarmult/curve25519/donna_c64/base.c b/src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/base.c similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/donna_c64/base.c rename to src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/base.c diff --git a/src/libnacl/crypto_scalarmult/curve25519/donna_c64/implementors b/src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/implementors similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/donna_c64/implementors rename to src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/implementors diff --git a/src/libnacl/crypto_scalarmult/curve25519/donna_c64/smult.c b/src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/smult.c similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/donna_c64/smult.c rename to src/libnacl-ref/crypto_scalarmult/curve25519/donna_c64/smult.c diff --git a/src/libnacl/crypto_scalarmult/curve25519/ref/api.h b/src/libnacl-ref/crypto_scalarmult/curve25519/ref/api.h similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/ref/api.h rename to src/libnacl-ref/crypto_scalarmult/curve25519/ref/api.h diff --git a/src/libnacl/crypto_scalarmult/curve25519/ref/base.c b/src/libnacl-ref/crypto_scalarmult/curve25519/ref/base.c similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/ref/base.c rename to src/libnacl-ref/crypto_scalarmult/curve25519/ref/base.c diff --git a/src/libnacl-ref/crypto_scalarmult/curve25519/ref/crypto_scalarmult.h b/src/libnacl-ref/crypto_scalarmult/curve25519/ref/crypto_scalarmult.h new file mode 100644 index 00000000..ab642f74 --- /dev/null +++ b/src/libnacl-ref/crypto_scalarmult/curve25519/ref/crypto_scalarmult.h @@ -0,0 +1,14 @@ +#ifndef crypto_scalarmult_H +#define crypto_scalarmult_H + +#include "crypto_scalarmult_curve25519.h" + +#define crypto_scalarmult crypto_scalarmult_curve25519 +#define crypto_scalarmult_base crypto_scalarmult_curve25519_base +#define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES +#define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES +#define crypto_scalarmult_PRIMITIVE "curve25519" +#define crypto_scalarmult_IMPLEMENTATION crypto_scalarmult_curve25519_IMPLEMENTATION +#define crypto_scalarmult_VERSION crypto_scalarmult_curve25519_VERSION + +#endif diff --git a/src/libnacl/crypto_scalarmult/curve25519/ref/implementors b/src/libnacl-ref/crypto_scalarmult/curve25519/ref/implementors similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/ref/implementors rename to src/libnacl-ref/crypto_scalarmult/curve25519/ref/implementors diff --git a/src/libnacl/crypto_scalarmult/curve25519/ref/smult.c b/src/libnacl-ref/crypto_scalarmult/curve25519/ref/smult.c similarity index 100% rename from src/libnacl/crypto_scalarmult/curve25519/ref/smult.c rename to src/libnacl-ref/crypto_scalarmult/curve25519/ref/smult.c diff --git a/src/libnacl/crypto_scalarmult/measure.c b/src/libnacl-ref/crypto_scalarmult/measure.c similarity index 100% rename from src/libnacl/crypto_scalarmult/measure.c rename to src/libnacl-ref/crypto_scalarmult/measure.c diff --git a/src/libnacl/crypto_scalarmult/try.c b/src/libnacl-ref/crypto_scalarmult/try.c similarity index 100% rename from src/libnacl/crypto_scalarmult/try.c rename to src/libnacl-ref/crypto_scalarmult/try.c diff --git a/src/libnacl/crypto_secretbox/measure.c b/src/libnacl-ref/crypto_secretbox/measure.c similarity index 100% rename from src/libnacl/crypto_secretbox/measure.c rename to src/libnacl-ref/crypto_secretbox/measure.c diff --git a/src/libnacl/crypto_secretbox/try.c b/src/libnacl-ref/crypto_secretbox/try.c similarity index 100% rename from src/libnacl/crypto_secretbox/try.c rename to src/libnacl-ref/crypto_secretbox/try.c diff --git a/src/libnacl/crypto_secretbox/xsalsa20poly1305/checksum b/src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/checksum similarity index 100% rename from src/libnacl/crypto_secretbox/xsalsa20poly1305/checksum rename to src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/checksum diff --git a/src/libnacl/crypto_secretbox/xsalsa20poly1305/ref/api.h b/src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/api.h similarity index 100% rename from src/libnacl/crypto_secretbox/xsalsa20poly1305/ref/api.h rename to src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/api.h diff --git a/src/libnacl/crypto_secretbox/xsalsa20poly1305/ref/box.c b/src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c similarity index 100% rename from src/libnacl/crypto_secretbox/xsalsa20poly1305/ref/box.c rename to src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c diff --git a/src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/crypto_secretbox.h b/src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/crypto_secretbox.h new file mode 100644 index 00000000..7409dd04 --- /dev/null +++ b/src/libnacl-ref/crypto_secretbox/xsalsa20poly1305/ref/crypto_secretbox.h @@ -0,0 +1,16 @@ +#ifndef crypto_secretbox_H +#define crypto_secretbox_H + +#include "crypto_secretbox_xsalsa20poly1305.h" + +#define crypto_secretbox crypto_secretbox_xsalsa20poly1305 +#define crypto_secretbox_open crypto_secretbox_xsalsa20poly1305_open +#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES +#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES +#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES +#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES +#define crypto_secretbox_PRIMITIVE "xsalsa20poly1305" +#define crypto_secretbox_IMPLEMENTATION crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION +#define crypto_secretbox_VERSION crypto_secretbox_xsalsa20poly1305_VERSION + +#endif diff --git a/src/libnacl/crypto_sign/ed25519/description b/src/libnacl-ref/crypto_sign/ed25519/description similarity index 100% rename from src/libnacl/crypto_sign/ed25519/description rename to src/libnacl-ref/crypto_sign/ed25519/description diff --git a/src/libnacl/crypto_sign/ed25519/designers b/src/libnacl-ref/crypto_sign/ed25519/designers similarity index 100% rename from src/libnacl/crypto_sign/ed25519/designers rename to src/libnacl-ref/crypto_sign/ed25519/designers diff --git a/src/libnacl/crypto_sign/ed25519/ref/api.h b/src/libnacl-ref/crypto_sign/ed25519/ref/api.h similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/api.h rename to src/libnacl-ref/crypto_sign/ed25519/ref/api.h diff --git a/src/libnacl-ref/crypto_sign/ed25519/ref/crypto_sign.h b/src/libnacl-ref/crypto_sign/ed25519/ref/crypto_sign.h new file mode 100644 index 00000000..09c1df1e --- /dev/null +++ b/src/libnacl-ref/crypto_sign/ed25519/ref/crypto_sign.h @@ -0,0 +1,16 @@ +#ifndef crypto_sign_H +#define crypto_sign_H + +#include "crypto_sign_ed25519.h" + +#define crypto_sign crypto_sign_ed25519 +#define crypto_sign_open crypto_sign_ed25519_open +#define crypto_sign_keypair crypto_sign_ed25519_keypair +#define crypto_sign_BYTES crypto_sign_ed25519_BYTES +#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES +#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES +#define crypto_sign_PRIMITIVE "ed25519" +#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION +#define crypto_sign_VERSION crypto_sign_ed25519_VERSION + +#endif diff --git a/src/libnacl/crypto_sign/ed25519/ref/ed25519.c b/src/libnacl-ref/crypto_sign/ed25519/ref/ed25519_ed25519.c similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/ed25519.c rename to src/libnacl-ref/crypto_sign/ed25519/ref/ed25519_ed25519.c diff --git a/src/libnacl/crypto_sign/ed25519/ref/fe25519.h b/src/libnacl-ref/crypto_sign/ed25519/ref/fe25519.h similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/fe25519.h rename to src/libnacl-ref/crypto_sign/ed25519/ref/fe25519.h diff --git a/src/libnacl/crypto_sign/ed25519/ref/fe25519.c b/src/libnacl-ref/crypto_sign/ed25519/ref/fe25519_ed25519.c similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/fe25519.c rename to src/libnacl-ref/crypto_sign/ed25519/ref/fe25519_ed25519.c diff --git a/src/libnacl/crypto_sign/ed25519/ref/ge25519.h b/src/libnacl-ref/crypto_sign/ed25519/ref/ge25519.h similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/ge25519.h rename to src/libnacl-ref/crypto_sign/ed25519/ref/ge25519.h diff --git a/src/libnacl/crypto_sign/ed25519/ref/ge25519_base.data b/src/libnacl-ref/crypto_sign/ed25519/ref/ge25519_base.data similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/ge25519_base.data rename to src/libnacl-ref/crypto_sign/ed25519/ref/ge25519_base.data diff --git a/src/libnacl/crypto_sign/ed25519/ref/ge25519.c b/src/libnacl-ref/crypto_sign/ed25519/ref/ge25519_ed25519.c similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/ge25519.c rename to src/libnacl-ref/crypto_sign/ed25519/ref/ge25519_ed25519.c diff --git a/src/libnacl/crypto_sign/ed25519/ref/implementors b/src/libnacl-ref/crypto_sign/ed25519/ref/implementors similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/implementors rename to src/libnacl-ref/crypto_sign/ed25519/ref/implementors diff --git a/src/libnacl/crypto_sign/ed25519/ref/sc25519.h b/src/libnacl-ref/crypto_sign/ed25519/ref/sc25519.h similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/sc25519.h rename to src/libnacl-ref/crypto_sign/ed25519/ref/sc25519.h diff --git a/src/libnacl/crypto_sign/ed25519/ref/sc25519.c b/src/libnacl-ref/crypto_sign/ed25519/ref/sc25519_ed25519.c similarity index 100% rename from src/libnacl/crypto_sign/ed25519/ref/sc25519.c rename to src/libnacl-ref/crypto_sign/ed25519/ref/sc25519_ed25519.c diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/api.h b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/api.h similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/api.h rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/api.h diff --git a/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/crypto_sign.h b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/crypto_sign.h new file mode 100644 index 00000000..8472603e --- /dev/null +++ b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/crypto_sign.h @@ -0,0 +1,16 @@ +#ifndef crypto_sign_H +#define crypto_sign_H + +#include "crypto_sign_edwards25519sha512batch.h" + +#define crypto_sign crypto_sign_edwards25519sha512batch +#define crypto_sign_open crypto_sign_edwards25519sha512batch_open +#define crypto_sign_keypair crypto_sign_edwards25519sha512batch_keypair +#define crypto_sign_BYTES crypto_sign_edwards25519sha512batch_BYTES +#define crypto_sign_PUBLICKEYBYTES crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES +#define crypto_sign_SECRETKEYBYTES crypto_sign_edwards25519sha512batch_SECRETKEYBYTES +#define crypto_sign_PRIMITIVE "edwards25519sha512batch" +#define crypto_sign_IMPLEMENTATION crypto_sign_edwards25519sha512batch_IMPLEMENTATION +#define crypto_sign_VERSION crypto_sign_edwards25519sha512batch_VERSION + +#endif diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/fe25519.h b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/fe25519.h similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/fe25519.h rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/fe25519.h diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/fe25519.c b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/fe25519.c rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/ge25519.h b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/ge25519.h similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/ge25519.h rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/ge25519.h diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/ge25519.c b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/ge25519.c rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/sc25519.h b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/sc25519.h similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/sc25519.h rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/sc25519.h diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/sc25519.c b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/sc25519.c rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/ref/sign.c b/src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c similarity index 100% rename from src/libnacl/crypto_sign/edwards25519sha512batch/ref/sign.c rename to src/libnacl-ref/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c diff --git a/src/libnacl/crypto_sign/measure.c b/src/libnacl-ref/crypto_sign/measure.c similarity index 100% rename from src/libnacl/crypto_sign/measure.c rename to src/libnacl-ref/crypto_sign/measure.c diff --git a/src/libnacl/crypto_sign/try.c b/src/libnacl-ref/crypto_sign/try.c similarity index 100% rename from src/libnacl/crypto_sign/try.c rename to src/libnacl-ref/crypto_sign/try.c diff --git a/src/libnacl/crypto_stream/aes128ctr/checksum b/src/libnacl-ref/crypto_stream/aes128ctr/checksum similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/checksum rename to src/libnacl-ref/crypto_stream/aes128ctr/checksum diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/afternm.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/afternm.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/api.h b/src/libnacl-ref/crypto_stream/aes128ctr/portable/api.h similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/api.h rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/api.h diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/beforenm.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/beforenm.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/common.h b/src/libnacl-ref/crypto_stream/aes128ctr/portable/common.h similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/common.h rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/common.h diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/common.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/common_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/common.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/common_aes128ctr.c diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/consts.h b/src/libnacl-ref/crypto_stream/aes128ctr/portable/consts.h similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/consts.h rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/consts.h diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/consts.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/consts_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/consts.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/consts_aes128ctr.c diff --git a/src/libnacl-ref/crypto_stream/aes128ctr/portable/crypto_stream.h b/src/libnacl-ref/crypto_stream/aes128ctr/portable/crypto_stream.h new file mode 100644 index 00000000..01b476a7 --- /dev/null +++ b/src/libnacl-ref/crypto_stream/aes128ctr/portable/crypto_stream.h @@ -0,0 +1,18 @@ +#ifndef crypto_stream_H +#define crypto_stream_H + +#include "crypto_stream_aes128ctr.h" + +#define crypto_stream crypto_stream_aes128ctr +#define crypto_stream_xor crypto_stream_aes128ctr_xor +#define crypto_stream_beforenm crypto_stream_aes128ctr_beforenm +#define crypto_stream_afternm crypto_stream_aes128ctr_afternm +#define crypto_stream_xor_afternm crypto_stream_aes128ctr_xor_afternm +#define crypto_stream_KEYBYTES crypto_stream_aes128ctr_KEYBYTES +#define crypto_stream_NONCEBYTES crypto_stream_aes128ctr_NONCEBYTES +#define crypto_stream_BEFORENMBYTES crypto_stream_aes128ctr_BEFORENMBYTES +#define crypto_stream_PRIMITIVE "aes128ctr" +#define crypto_stream_IMPLEMENTATION crypto_stream_aes128ctr_IMPLEMENTATION +#define crypto_stream_VERSION crypto_stream_aes128ctr_VERSION + +#endif diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/int128.h b/src/libnacl-ref/crypto_stream/aes128ctr/portable/int128.h similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/int128.h rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/int128.h diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/int128.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/int128_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/int128.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/int128_aes128ctr.c diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/stream.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/stream_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/stream.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/stream_aes128ctr.c diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/types.h b/src/libnacl-ref/crypto_stream/aes128ctr/portable/types.h similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/types.h rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/types.h diff --git a/src/libnacl/crypto_stream/aes128ctr/portable/xor_afternm.c b/src/libnacl-ref/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c similarity index 100% rename from src/libnacl/crypto_stream/aes128ctr/portable/xor_afternm.c rename to src/libnacl-ref/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c diff --git a/src/libnacl/crypto_stream/measure.c b/src/libnacl-ref/crypto_stream/measure.c similarity index 100% rename from src/libnacl/crypto_stream/measure.c rename to src/libnacl-ref/crypto_stream/measure.c diff --git a/src/libnacl/crypto_stream/salsa20/checksum b/src/libnacl-ref/crypto_stream/salsa20/checksum similarity index 100% rename from src/libnacl/crypto_stream/salsa20/checksum rename to src/libnacl-ref/crypto_stream/salsa20/checksum diff --git a/src/libnacl/crypto_stream/salsa20/ref/api.h b/src/libnacl-ref/crypto_stream/salsa20/ref/api.h similarity index 100% rename from src/libnacl/crypto_stream/salsa20/ref/api.h rename to src/libnacl-ref/crypto_stream/salsa20/ref/api.h diff --git a/src/libnacl-ref/crypto_stream/salsa20/ref/crypto_stream.h b/src/libnacl-ref/crypto_stream/salsa20/ref/crypto_stream.h new file mode 100644 index 00000000..d1a43e78 --- /dev/null +++ b/src/libnacl-ref/crypto_stream/salsa20/ref/crypto_stream.h @@ -0,0 +1,18 @@ +#ifndef crypto_stream_H +#define crypto_stream_H + +#include "crypto_stream_salsa20.h" + +#define crypto_stream crypto_stream_salsa20 +#define crypto_stream_xor crypto_stream_salsa20_xor +#define crypto_stream_beforenm crypto_stream_salsa20_beforenm +#define crypto_stream_afternm crypto_stream_salsa20_afternm +#define crypto_stream_xor_afternm crypto_stream_salsa20_xor_afternm +#define crypto_stream_KEYBYTES crypto_stream_salsa20_KEYBYTES +#define crypto_stream_NONCEBYTES crypto_stream_salsa20_NONCEBYTES +#define crypto_stream_BEFORENMBYTES crypto_stream_salsa20_BEFORENMBYTES +#define crypto_stream_PRIMITIVE "salsa20" +#define crypto_stream_IMPLEMENTATION crypto_stream_salsa20_IMPLEMENTATION +#define crypto_stream_VERSION crypto_stream_salsa20_VERSION + +#endif diff --git a/src/libnacl/crypto_stream/salsa20/ref/implementors b/src/libnacl-ref/crypto_stream/salsa20/ref/implementors similarity index 100% rename from src/libnacl/crypto_stream/salsa20/ref/implementors rename to src/libnacl-ref/crypto_stream/salsa20/ref/implementors diff --git a/src/libnacl/crypto_stream/salsa20/ref/stream.c b/src/libnacl-ref/crypto_stream/salsa20/ref/stream_salsa20.c similarity index 100% rename from src/libnacl/crypto_stream/salsa20/ref/stream.c rename to src/libnacl-ref/crypto_stream/salsa20/ref/stream_salsa20.c diff --git a/src/libnacl/crypto_stream/salsa20/ref/xor.c b/src/libnacl-ref/crypto_stream/salsa20/ref/xor_salsa20.c similarity index 100% rename from src/libnacl/crypto_stream/salsa20/ref/xor.c rename to src/libnacl-ref/crypto_stream/salsa20/ref/xor_salsa20.c diff --git a/src/libnacl/crypto_stream/salsa2012/checksum b/src/libnacl-ref/crypto_stream/salsa2012/checksum similarity index 100% rename from src/libnacl/crypto_stream/salsa2012/checksum rename to src/libnacl-ref/crypto_stream/salsa2012/checksum diff --git a/src/libnacl/crypto_stream/salsa2012/ref/api.h b/src/libnacl-ref/crypto_stream/salsa2012/ref/api.h similarity index 100% rename from src/libnacl/crypto_stream/salsa2012/ref/api.h rename to src/libnacl-ref/crypto_stream/salsa2012/ref/api.h diff --git a/src/libnacl-ref/crypto_stream/salsa2012/ref/crypto_stream.h b/src/libnacl-ref/crypto_stream/salsa2012/ref/crypto_stream.h new file mode 100644 index 00000000..62c6281c --- /dev/null +++ b/src/libnacl-ref/crypto_stream/salsa2012/ref/crypto_stream.h @@ -0,0 +1,18 @@ +#ifndef crypto_stream_H +#define crypto_stream_H + +#include "crypto_stream_salsa2012.h" + +#define crypto_stream crypto_stream_salsa2012 +#define crypto_stream_xor crypto_stream_salsa2012_xor +#define crypto_stream_beforenm crypto_stream_salsa2012_beforenm +#define crypto_stream_afternm crypto_stream_salsa2012_afternm +#define crypto_stream_xor_afternm crypto_stream_salsa2012_xor_afternm +#define crypto_stream_KEYBYTES crypto_stream_salsa2012_KEYBYTES +#define crypto_stream_NONCEBYTES crypto_stream_salsa2012_NONCEBYTES +#define crypto_stream_BEFORENMBYTES crypto_stream_salsa2012_BEFORENMBYTES +#define crypto_stream_PRIMITIVE "salsa2012" +#define crypto_stream_IMPLEMENTATION crypto_stream_salsa2012_IMPLEMENTATION +#define crypto_stream_VERSION crypto_stream_salsa2012_VERSION + +#endif diff --git a/src/libnacl/crypto_stream/salsa2012/ref/implementors b/src/libnacl-ref/crypto_stream/salsa2012/ref/implementors similarity index 100% rename from src/libnacl/crypto_stream/salsa2012/ref/implementors rename to src/libnacl-ref/crypto_stream/salsa2012/ref/implementors diff --git a/src/libnacl/crypto_stream/salsa2012/ref/stream.c b/src/libnacl-ref/crypto_stream/salsa2012/ref/stream_salsa2012.c similarity index 100% rename from src/libnacl/crypto_stream/salsa2012/ref/stream.c rename to src/libnacl-ref/crypto_stream/salsa2012/ref/stream_salsa2012.c diff --git a/src/libnacl/crypto_stream/salsa2012/ref/xor.c b/src/libnacl-ref/crypto_stream/salsa2012/ref/xor_salsa2012.c similarity index 100% rename from src/libnacl/crypto_stream/salsa2012/ref/xor.c rename to src/libnacl-ref/crypto_stream/salsa2012/ref/xor_salsa2012.c diff --git a/src/libnacl/crypto_stream/salsa208/checksum b/src/libnacl-ref/crypto_stream/salsa208/checksum similarity index 100% rename from src/libnacl/crypto_stream/salsa208/checksum rename to src/libnacl-ref/crypto_stream/salsa208/checksum diff --git a/src/libnacl/crypto_stream/salsa208/ref/api.h b/src/libnacl-ref/crypto_stream/salsa208/ref/api.h similarity index 100% rename from src/libnacl/crypto_stream/salsa208/ref/api.h rename to src/libnacl-ref/crypto_stream/salsa208/ref/api.h diff --git a/src/libnacl-ref/crypto_stream/salsa208/ref/crypto_stream.h b/src/libnacl-ref/crypto_stream/salsa208/ref/crypto_stream.h new file mode 100644 index 00000000..0e0421ee --- /dev/null +++ b/src/libnacl-ref/crypto_stream/salsa208/ref/crypto_stream.h @@ -0,0 +1,18 @@ +#ifndef crypto_stream_H +#define crypto_stream_H + +#include "crypto_stream_salsa208.h" + +#define crypto_stream crypto_stream_salsa208 +#define crypto_stream_xor crypto_stream_salsa208_xor +#define crypto_stream_beforenm crypto_stream_salsa208_beforenm +#define crypto_stream_afternm crypto_stream_salsa208_afternm +#define crypto_stream_xor_afternm crypto_stream_salsa208_xor_afternm +#define crypto_stream_KEYBYTES crypto_stream_salsa208_KEYBYTES +#define crypto_stream_NONCEBYTES crypto_stream_salsa208_NONCEBYTES +#define crypto_stream_BEFORENMBYTES crypto_stream_salsa208_BEFORENMBYTES +#define crypto_stream_PRIMITIVE "salsa208" +#define crypto_stream_IMPLEMENTATION crypto_stream_salsa208_IMPLEMENTATION +#define crypto_stream_VERSION crypto_stream_salsa208_VERSION + +#endif diff --git a/src/libnacl/crypto_stream/salsa208/ref/implementors b/src/libnacl-ref/crypto_stream/salsa208/ref/implementors similarity index 100% rename from src/libnacl/crypto_stream/salsa208/ref/implementors rename to src/libnacl-ref/crypto_stream/salsa208/ref/implementors diff --git a/src/libnacl/crypto_stream/salsa208/ref/stream.c b/src/libnacl-ref/crypto_stream/salsa208/ref/stream_salsa208.c similarity index 100% rename from src/libnacl/crypto_stream/salsa208/ref/stream.c rename to src/libnacl-ref/crypto_stream/salsa208/ref/stream_salsa208.c diff --git a/src/libnacl/crypto_stream/salsa208/ref/xor.c b/src/libnacl-ref/crypto_stream/salsa208/ref/xor_salsa208.c similarity index 100% rename from src/libnacl/crypto_stream/salsa208/ref/xor.c rename to src/libnacl-ref/crypto_stream/salsa208/ref/xor_salsa208.c diff --git a/src/libnacl/crypto_stream/try.c b/src/libnacl-ref/crypto_stream/try.c similarity index 100% rename from src/libnacl/crypto_stream/try.c rename to src/libnacl-ref/crypto_stream/try.c diff --git a/src/libnacl/crypto_stream/xsalsa20/checksum b/src/libnacl-ref/crypto_stream/xsalsa20/checksum similarity index 100% rename from src/libnacl/crypto_stream/xsalsa20/checksum rename to src/libnacl-ref/crypto_stream/xsalsa20/checksum diff --git a/src/libnacl/crypto_stream/xsalsa20/ref/api.h b/src/libnacl-ref/crypto_stream/xsalsa20/ref/api.h similarity index 100% rename from src/libnacl/crypto_stream/xsalsa20/ref/api.h rename to src/libnacl-ref/crypto_stream/xsalsa20/ref/api.h diff --git a/src/libnacl-ref/crypto_stream/xsalsa20/ref/crypto_stream.h b/src/libnacl-ref/crypto_stream/xsalsa20/ref/crypto_stream.h new file mode 100644 index 00000000..02d2409c --- /dev/null +++ b/src/libnacl-ref/crypto_stream/xsalsa20/ref/crypto_stream.h @@ -0,0 +1,18 @@ +#ifndef crypto_stream_H +#define crypto_stream_H + +#include "crypto_stream_xsalsa20.h" + +#define crypto_stream crypto_stream_xsalsa20 +#define crypto_stream_xor crypto_stream_xsalsa20_xor +#define crypto_stream_beforenm crypto_stream_xsalsa20_beforenm +#define crypto_stream_afternm crypto_stream_xsalsa20_afternm +#define crypto_stream_xor_afternm crypto_stream_xsalsa20_xor_afternm +#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES +#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES +#define crypto_stream_BEFORENMBYTES crypto_stream_xsalsa20_BEFORENMBYTES +#define crypto_stream_PRIMITIVE "xsalsa20" +#define crypto_stream_IMPLEMENTATION crypto_stream_xsalsa20_IMPLEMENTATION +#define crypto_stream_VERSION crypto_stream_xsalsa20_VERSION + +#endif diff --git a/src/libnacl/crypto_stream/xsalsa20/ref/implementors b/src/libnacl-ref/crypto_stream/xsalsa20/ref/implementors similarity index 100% rename from src/libnacl/crypto_stream/xsalsa20/ref/implementors rename to src/libnacl-ref/crypto_stream/xsalsa20/ref/implementors diff --git a/src/libnacl/crypto_stream/xsalsa20/ref/stream.c b/src/libnacl-ref/crypto_stream/xsalsa20/ref/stream_xsalsa20.c similarity index 100% rename from src/libnacl/crypto_stream/xsalsa20/ref/stream.c rename to src/libnacl-ref/crypto_stream/xsalsa20/ref/stream_xsalsa20.c diff --git a/src/libnacl/crypto_stream/xsalsa20/ref/xor.c b/src/libnacl-ref/crypto_stream/xsalsa20/ref/xor_xsalsa20.c similarity index 100% rename from src/libnacl/crypto_stream/xsalsa20/ref/xor.c rename to src/libnacl-ref/crypto_stream/xsalsa20/ref/xor_xsalsa20.c diff --git a/src/libnacl/crypto_verify/16/checksum b/src/libnacl-ref/crypto_verify/16/checksum similarity index 100% rename from src/libnacl/crypto_verify/16/checksum rename to src/libnacl-ref/crypto_verify/16/checksum diff --git a/src/libnacl/crypto_verify/16/ref/api.h b/src/libnacl-ref/crypto_verify/16/ref/api.h similarity index 100% rename from src/libnacl/crypto_verify/16/ref/api.h rename to src/libnacl-ref/crypto_verify/16/ref/api.h diff --git a/src/libnacl-ref/crypto_verify/16/ref/crypto_verify.h b/src/libnacl-ref/crypto_verify/16/ref/crypto_verify.h new file mode 100644 index 00000000..c8d85137 --- /dev/null +++ b/src/libnacl-ref/crypto_verify/16/ref/crypto_verify.h @@ -0,0 +1,12 @@ +#ifndef crypto_verify_H +#define crypto_verify_H + +#include "crypto_verify_16.h" + +#define crypto_verify crypto_verify_16 +#define crypto_verify_BYTES crypto_verify_16_BYTES +#define crypto_verify_PRIMITIVE "16" +#define crypto_verify_IMPLEMENTATION crypto_verify_16_IMPLEMENTATION +#define crypto_verify_VERSION crypto_verify_16_VERSION + +#endif diff --git a/src/libnacl/crypto_verify/16/ref/verify.c b/src/libnacl-ref/crypto_verify/16/ref/verify_16.c similarity index 100% rename from src/libnacl/crypto_verify/16/ref/verify.c rename to src/libnacl-ref/crypto_verify/16/ref/verify_16.c diff --git a/src/libnacl/crypto_verify/32/checksum b/src/libnacl-ref/crypto_verify/32/checksum similarity index 100% rename from src/libnacl/crypto_verify/32/checksum rename to src/libnacl-ref/crypto_verify/32/checksum diff --git a/src/libnacl/crypto_verify/32/ref/api.h b/src/libnacl-ref/crypto_verify/32/ref/api.h similarity index 100% rename from src/libnacl/crypto_verify/32/ref/api.h rename to src/libnacl-ref/crypto_verify/32/ref/api.h diff --git a/src/libnacl-ref/crypto_verify/32/ref/crypto_verify.h b/src/libnacl-ref/crypto_verify/32/ref/crypto_verify.h new file mode 100644 index 00000000..a61ebb68 --- /dev/null +++ b/src/libnacl-ref/crypto_verify/32/ref/crypto_verify.h @@ -0,0 +1,12 @@ +#ifndef crypto_verify_H +#define crypto_verify_H + +#include "crypto_verify_32.h" + +#define crypto_verify crypto_verify_32 +#define crypto_verify_BYTES crypto_verify_32_BYTES +#define crypto_verify_PRIMITIVE "32" +#define crypto_verify_IMPLEMENTATION crypto_verify_32_IMPLEMENTATION +#define crypto_verify_VERSION crypto_verify_32_VERSION + +#endif diff --git a/src/libnacl/crypto_verify/32/ref/verify.c b/src/libnacl-ref/crypto_verify/32/ref/verify_32.c similarity index 100% rename from src/libnacl/crypto_verify/32/ref/verify.c rename to src/libnacl-ref/crypto_verify/32/ref/verify_32.c diff --git a/src/libnacl/crypto_verify/measure.c b/src/libnacl-ref/crypto_verify/measure.c similarity index 100% rename from src/libnacl/crypto_verify/measure.c rename to src/libnacl-ref/crypto_verify/measure.c diff --git a/src/libnacl/crypto_verify/try.c b/src/libnacl-ref/crypto_verify/try.c similarity index 100% rename from src/libnacl/crypto_verify/try.c rename to src/libnacl-ref/crypto_verify/try.c diff --git a/src/libnacl-ref/include/Makefile.am b/src/libnacl-ref/include/Makefile.am new file mode 100644 index 00000000..251e89d2 --- /dev/null +++ b/src/libnacl-ref/include/Makefile.am @@ -0,0 +1,36 @@ + +NACL_EXPORT = \ + nacl/crypto_auth_hmacsha256.h \ + nacl/crypto_auth_hmacsha512256.h \ + nacl/crypto_box.h \ + nacl/crypto_box_curve25519xsalsa20poly1305.h \ + nacl/crypto_core_hsalsa20.h \ + nacl/crypto_core_salsa20.h \ + nacl/crypto_core_salsa2012.h \ + nacl/crypto_core_salsa208.h \ + nacl/crypto_hash_sha256.h \ + nacl/crypto_hash_sha512.h \ + nacl/crypto_hashblocks_sha256.h \ + nacl/crypto_hashblocks_sha512.h \ + nacl/crypto_onetimeauth_poly1305.h \ + nacl/crypto_scalarmult_curve25519.h \ + nacl/crypto_secretbox_xsalsa20poly1305.h \ + nacl/crypto_sign_ed25519.h \ + nacl/crypto_sign_edwards25519sha512batch.h \ + nacl/crypto_stream_aes128ctr.h \ + nacl/crypto_stream_salsa20.h \ + nacl/crypto_stream_salsa2012.h \ + nacl/crypto_stream_salsa208.h \ + nacl/crypto_stream_xsalsa20.h \ + nacl/crypto_uint16.h \ + nacl/crypto_uint32.h \ + nacl/crypto_uint64.h \ + nacl/crypto_uint8.h \ + nacl/crypto_verify_16.h \ + nacl/crypto_verify_32.h \ + nacl/randombytes.h + +EXTRA_SRC = $(NACL_EXPORT) \ + nacl/version.h.in + +nobase_include_HEADERS = $(NACL_EXPORT) diff --git a/src/libnacl-ref/include/nacl/crypto_auth_hmacsha256.h b/src/libnacl-ref/include/nacl/crypto_auth_hmacsha256.h new file mode 100644 index 00000000..5ee65505 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_auth_hmacsha256.h @@ -0,0 +1,26 @@ +#ifndef crypto_auth_hmacsha256_H +#define crypto_auth_hmacsha256_H + +#define crypto_auth_hmacsha256_ref_BYTES 32 +#define crypto_auth_hmacsha256_ref_KEYBYTES 32 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_auth_hmacsha256_ref(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_auth_hmacsha256_ref_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_auth_hmacsha256 crypto_auth_hmacsha256_ref +#define crypto_auth_hmacsha256_verify crypto_auth_hmacsha256_ref_verify +#define crypto_auth_hmacsha256_BYTES crypto_auth_hmacsha256_ref_BYTES +#define crypto_auth_hmacsha256_KEYBYTES crypto_auth_hmacsha256_ref_KEYBYTES +#define crypto_auth_hmacsha256_IMPLEMENTATION "crypto_auth/hmacsha256/ref" +#ifndef crypto_auth_hmacsha256_ref_VERSION +#define crypto_auth_hmacsha256_ref_VERSION "-" +#endif +#define crypto_auth_hmacsha256_VERSION crypto_auth_hmacsha256_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_auth_hmacsha512256.h b/src/libnacl-ref/include/nacl/crypto_auth_hmacsha512256.h new file mode 100644 index 00000000..0806264d --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_auth_hmacsha512256.h @@ -0,0 +1,26 @@ +#ifndef crypto_auth_hmacsha512256_H +#define crypto_auth_hmacsha512256_H + +#define crypto_auth_hmacsha512256_ref_BYTES 32 +#define crypto_auth_hmacsha512256_ref_KEYBYTES 32 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_auth_hmacsha512256_ref(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_auth_hmacsha512256_ref_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_auth_hmacsha512256 crypto_auth_hmacsha512256_ref +#define crypto_auth_hmacsha512256_verify crypto_auth_hmacsha512256_ref_verify +#define crypto_auth_hmacsha512256_BYTES crypto_auth_hmacsha512256_ref_BYTES +#define crypto_auth_hmacsha512256_KEYBYTES crypto_auth_hmacsha512256_ref_KEYBYTES +#define crypto_auth_hmacsha512256_IMPLEMENTATION "crypto_auth/hmacsha512256/ref" +#ifndef crypto_auth_hmacsha512256_ref_VERSION +#define crypto_auth_hmacsha512256_ref_VERSION "-" +#endif +#define crypto_auth_hmacsha512256_VERSION crypto_auth_hmacsha512256_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_box.h b/src/libnacl-ref/include/nacl/crypto_box.h new file mode 100644 index 00000000..a6f1c4f6 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_box.h @@ -0,0 +1,22 @@ +#ifndef crypto_box_H +#define crypto_box_H + +#include "crypto_box_curve25519xsalsa20poly1305.h" + +#define crypto_box crypto_box_curve25519xsalsa20poly1305 +#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open +#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair +#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm +#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm +#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm +#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES +#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES +#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES +#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES +#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES +#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES +#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305" +#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION +#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_box_curve25519xsalsa20poly1305.h b/src/libnacl-ref/include/nacl/crypto_box_curve25519xsalsa20poly1305.h new file mode 100644 index 00000000..8f82c269 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_box_curve25519xsalsa20poly1305.h @@ -0,0 +1,42 @@ +#ifndef crypto_box_curve25519xsalsa20poly1305_H +#define crypto_box_curve25519xsalsa20poly1305_H + +#define crypto_box_curve25519xsalsa20poly1305_ref_PUBLICKEYBYTES 32 +#define crypto_box_curve25519xsalsa20poly1305_ref_SECRETKEYBYTES 32 +#define crypto_box_curve25519xsalsa20poly1305_ref_BEFORENMBYTES 32 +#define crypto_box_curve25519xsalsa20poly1305_ref_NONCEBYTES 24 +#define crypto_box_curve25519xsalsa20poly1305_ref_ZEROBYTES 32 +#define crypto_box_curve25519xsalsa20poly1305_ref_BOXZEROBYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_box_curve25519xsalsa20poly1305_ref(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); +extern int crypto_box_curve25519xsalsa20poly1305_ref_open(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); +extern int crypto_box_curve25519xsalsa20poly1305_ref_keypair(unsigned char *,unsigned char *); +extern int crypto_box_curve25519xsalsa20poly1305_ref_beforenm(unsigned char *,const unsigned char *,const unsigned char *); +extern int crypto_box_curve25519xsalsa20poly1305_ref_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_box_curve25519xsalsa20poly1305_ref_open_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_box_curve25519xsalsa20poly1305 crypto_box_curve25519xsalsa20poly1305_ref +#define crypto_box_curve25519xsalsa20poly1305_open crypto_box_curve25519xsalsa20poly1305_ref_open +#define crypto_box_curve25519xsalsa20poly1305_keypair crypto_box_curve25519xsalsa20poly1305_ref_keypair +#define crypto_box_curve25519xsalsa20poly1305_beforenm crypto_box_curve25519xsalsa20poly1305_ref_beforenm +#define crypto_box_curve25519xsalsa20poly1305_afternm crypto_box_curve25519xsalsa20poly1305_ref_afternm +#define crypto_box_curve25519xsalsa20poly1305_open_afternm crypto_box_curve25519xsalsa20poly1305_ref_open_afternm +#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_ref_PUBLICKEYBYTES +#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_ref_SECRETKEYBYTES +#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_ref_BEFORENMBYTES +#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_ref_NONCEBYTES +#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ref_ZEROBYTES +#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_ref_BOXZEROBYTES +#define crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION "crypto_box/curve25519xsalsa20poly1305/ref" +#ifndef crypto_box_curve25519xsalsa20poly1305_ref_VERSION +#define crypto_box_curve25519xsalsa20poly1305_ref_VERSION "-" +#endif +#define crypto_box_curve25519xsalsa20poly1305_VERSION crypto_box_curve25519xsalsa20poly1305_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_core_hsalsa20.h b/src/libnacl-ref/include/nacl/crypto_core_hsalsa20.h new file mode 100644 index 00000000..7330eeb0 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_core_hsalsa20.h @@ -0,0 +1,28 @@ +#ifndef crypto_core_hsalsa20_H +#define crypto_core_hsalsa20_H + +#define crypto_core_hsalsa20_ref2_OUTPUTBYTES 32 +#define crypto_core_hsalsa20_ref2_INPUTBYTES 16 +#define crypto_core_hsalsa20_ref2_KEYBYTES 32 +#define crypto_core_hsalsa20_ref2_CONSTBYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_core_hsalsa20_ref2(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_core_hsalsa20 crypto_core_hsalsa20_ref2 +#define crypto_core_hsalsa20_OUTPUTBYTES crypto_core_hsalsa20_ref2_OUTPUTBYTES +#define crypto_core_hsalsa20_INPUTBYTES crypto_core_hsalsa20_ref2_INPUTBYTES +#define crypto_core_hsalsa20_KEYBYTES crypto_core_hsalsa20_ref2_KEYBYTES +#define crypto_core_hsalsa20_CONSTBYTES crypto_core_hsalsa20_ref2_CONSTBYTES +#define crypto_core_hsalsa20_IMPLEMENTATION "crypto_core/hsalsa20/ref2" +#ifndef crypto_core_hsalsa20_ref2_VERSION +#define crypto_core_hsalsa20_ref2_VERSION "-" +#endif +#define crypto_core_hsalsa20_VERSION crypto_core_hsalsa20_ref2_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_core_salsa20.h b/src/libnacl-ref/include/nacl/crypto_core_salsa20.h new file mode 100644 index 00000000..bd8fbf99 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_core_salsa20.h @@ -0,0 +1,28 @@ +#ifndef crypto_core_salsa20_H +#define crypto_core_salsa20_H + +#define crypto_core_salsa20_ref_OUTPUTBYTES 64 +#define crypto_core_salsa20_ref_INPUTBYTES 16 +#define crypto_core_salsa20_ref_KEYBYTES 32 +#define crypto_core_salsa20_ref_CONSTBYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_core_salsa20_ref(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_core_salsa20 crypto_core_salsa20_ref +#define crypto_core_salsa20_OUTPUTBYTES crypto_core_salsa20_ref_OUTPUTBYTES +#define crypto_core_salsa20_INPUTBYTES crypto_core_salsa20_ref_INPUTBYTES +#define crypto_core_salsa20_KEYBYTES crypto_core_salsa20_ref_KEYBYTES +#define crypto_core_salsa20_CONSTBYTES crypto_core_salsa20_ref_CONSTBYTES +#define crypto_core_salsa20_IMPLEMENTATION "crypto_core/salsa20/ref" +#ifndef crypto_core_salsa20_ref_VERSION +#define crypto_core_salsa20_ref_VERSION "-" +#endif +#define crypto_core_salsa20_VERSION crypto_core_salsa20_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_core_salsa2012.h b/src/libnacl-ref/include/nacl/crypto_core_salsa2012.h new file mode 100644 index 00000000..36c1ce2d --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_core_salsa2012.h @@ -0,0 +1,28 @@ +#ifndef crypto_core_salsa2012_H +#define crypto_core_salsa2012_H + +#define crypto_core_salsa2012_ref_OUTPUTBYTES 64 +#define crypto_core_salsa2012_ref_INPUTBYTES 16 +#define crypto_core_salsa2012_ref_KEYBYTES 32 +#define crypto_core_salsa2012_ref_CONSTBYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_core_salsa2012_ref(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_core_salsa2012 crypto_core_salsa2012_ref +#define crypto_core_salsa2012_OUTPUTBYTES crypto_core_salsa2012_ref_OUTPUTBYTES +#define crypto_core_salsa2012_INPUTBYTES crypto_core_salsa2012_ref_INPUTBYTES +#define crypto_core_salsa2012_KEYBYTES crypto_core_salsa2012_ref_KEYBYTES +#define crypto_core_salsa2012_CONSTBYTES crypto_core_salsa2012_ref_CONSTBYTES +#define crypto_core_salsa2012_IMPLEMENTATION "crypto_core/salsa2012/ref" +#ifndef crypto_core_salsa2012_ref_VERSION +#define crypto_core_salsa2012_ref_VERSION "-" +#endif +#define crypto_core_salsa2012_VERSION crypto_core_salsa2012_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_core_salsa208.h b/src/libnacl-ref/include/nacl/crypto_core_salsa208.h new file mode 100644 index 00000000..3aee4cd3 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_core_salsa208.h @@ -0,0 +1,28 @@ +#ifndef crypto_core_salsa208_H +#define crypto_core_salsa208_H + +#define crypto_core_salsa208_ref_OUTPUTBYTES 64 +#define crypto_core_salsa208_ref_INPUTBYTES 16 +#define crypto_core_salsa208_ref_KEYBYTES 32 +#define crypto_core_salsa208_ref_CONSTBYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_core_salsa208_ref(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_core_salsa208 crypto_core_salsa208_ref +#define crypto_core_salsa208_OUTPUTBYTES crypto_core_salsa208_ref_OUTPUTBYTES +#define crypto_core_salsa208_INPUTBYTES crypto_core_salsa208_ref_INPUTBYTES +#define crypto_core_salsa208_KEYBYTES crypto_core_salsa208_ref_KEYBYTES +#define crypto_core_salsa208_CONSTBYTES crypto_core_salsa208_ref_CONSTBYTES +#define crypto_core_salsa208_IMPLEMENTATION "crypto_core/salsa208/ref" +#ifndef crypto_core_salsa208_ref_VERSION +#define crypto_core_salsa208_ref_VERSION "-" +#endif +#define crypto_core_salsa208_VERSION crypto_core_salsa208_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_hash_sha256.h b/src/libnacl-ref/include/nacl/crypto_hash_sha256.h new file mode 100644 index 00000000..62e61c76 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_hash_sha256.h @@ -0,0 +1,22 @@ +#ifndef crypto_hash_sha256_H +#define crypto_hash_sha256_H + +#define crypto_hash_sha256_ref_BYTES 32 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_hash_sha256_ref(unsigned char *,const unsigned char *,unsigned long long); +#ifdef __cplusplus +} +#endif + +#define crypto_hash_sha256 crypto_hash_sha256_ref +#define crypto_hash_sha256_BYTES crypto_hash_sha256_ref_BYTES +#define crypto_hash_sha256_IMPLEMENTATION "crypto_hash/sha256/ref" +#ifndef crypto_hash_sha256_ref_VERSION +#define crypto_hash_sha256_ref_VERSION "-" +#endif +#define crypto_hash_sha256_VERSION crypto_hash_sha256_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_hash_sha512.h b/src/libnacl-ref/include/nacl/crypto_hash_sha512.h new file mode 100644 index 00000000..8c3459c0 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_hash_sha512.h @@ -0,0 +1,22 @@ +#ifndef crypto_hash_sha512_H +#define crypto_hash_sha512_H + +#define crypto_hash_sha512_ref_BYTES 64 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_hash_sha512_ref(unsigned char *,const unsigned char *,unsigned long long); +#ifdef __cplusplus +} +#endif + +#define crypto_hash_sha512 crypto_hash_sha512_ref +#define crypto_hash_sha512_BYTES crypto_hash_sha512_ref_BYTES +#define crypto_hash_sha512_IMPLEMENTATION "crypto_hash/sha512/ref" +#ifndef crypto_hash_sha512_ref_VERSION +#define crypto_hash_sha512_ref_VERSION "-" +#endif +#define crypto_hash_sha512_VERSION crypto_hash_sha512_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_hashblocks_sha256.h b/src/libnacl-ref/include/nacl/crypto_hashblocks_sha256.h new file mode 100644 index 00000000..d12eda33 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_hashblocks_sha256.h @@ -0,0 +1,24 @@ +#ifndef crypto_hashblocks_sha256_H +#define crypto_hashblocks_sha256_H + +#define crypto_hashblocks_sha256_ref_STATEBYTES 32 +#define crypto_hashblocks_sha256_ref_BLOCKBYTES 64 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_hashblocks_sha256_ref(unsigned char *,const unsigned char *,unsigned long long); +#ifdef __cplusplus +} +#endif + +#define crypto_hashblocks_sha256 crypto_hashblocks_sha256_ref +#define crypto_hashblocks_sha256_STATEBYTES crypto_hashblocks_sha256_ref_STATEBYTES +#define crypto_hashblocks_sha256_BLOCKBYTES crypto_hashblocks_sha256_ref_BLOCKBYTES +#define crypto_hashblocks_sha256_IMPLEMENTATION "crypto_hashblocks/sha256/ref" +#ifndef crypto_hashblocks_sha256_ref_VERSION +#define crypto_hashblocks_sha256_ref_VERSION "-" +#endif +#define crypto_hashblocks_sha256_VERSION crypto_hashblocks_sha256_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_hashblocks_sha512.h b/src/libnacl-ref/include/nacl/crypto_hashblocks_sha512.h new file mode 100644 index 00000000..af61e8f7 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_hashblocks_sha512.h @@ -0,0 +1,24 @@ +#ifndef crypto_hashblocks_sha512_H +#define crypto_hashblocks_sha512_H + +#define crypto_hashblocks_sha512_ref_STATEBYTES 64 +#define crypto_hashblocks_sha512_ref_BLOCKBYTES 128 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_hashblocks_sha512_ref(unsigned char *,const unsigned char *,unsigned long long); +#ifdef __cplusplus +} +#endif + +#define crypto_hashblocks_sha512 crypto_hashblocks_sha512_ref +#define crypto_hashblocks_sha512_STATEBYTES crypto_hashblocks_sha512_ref_STATEBYTES +#define crypto_hashblocks_sha512_BLOCKBYTES crypto_hashblocks_sha512_ref_BLOCKBYTES +#define crypto_hashblocks_sha512_IMPLEMENTATION "crypto_hashblocks/sha512/ref" +#ifndef crypto_hashblocks_sha512_ref_VERSION +#define crypto_hashblocks_sha512_ref_VERSION "-" +#endif +#define crypto_hashblocks_sha512_VERSION crypto_hashblocks_sha512_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_onetimeauth_poly1305.h b/src/libnacl-ref/include/nacl/crypto_onetimeauth_poly1305.h new file mode 100644 index 00000000..d8963308 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_onetimeauth_poly1305.h @@ -0,0 +1,26 @@ +#ifndef crypto_onetimeauth_poly1305_H +#define crypto_onetimeauth_poly1305_H + +#define crypto_onetimeauth_poly1305_ref_BYTES 16 +#define crypto_onetimeauth_poly1305_ref_KEYBYTES 32 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_onetimeauth_poly1305_ref(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_onetimeauth_poly1305_ref_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_onetimeauth_poly1305 crypto_onetimeauth_poly1305_ref +#define crypto_onetimeauth_poly1305_verify crypto_onetimeauth_poly1305_ref_verify +#define crypto_onetimeauth_poly1305_BYTES crypto_onetimeauth_poly1305_ref_BYTES +#define crypto_onetimeauth_poly1305_KEYBYTES crypto_onetimeauth_poly1305_ref_KEYBYTES +#define crypto_onetimeauth_poly1305_IMPLEMENTATION "crypto_onetimeauth/poly1305/ref" +#ifndef crypto_onetimeauth_poly1305_ref_VERSION +#define crypto_onetimeauth_poly1305_ref_VERSION "-" +#endif +#define crypto_onetimeauth_poly1305_VERSION crypto_onetimeauth_poly1305_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_scalarmult_curve25519.h b/src/libnacl-ref/include/nacl/crypto_scalarmult_curve25519.h new file mode 100644 index 00000000..d3f677ab --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_scalarmult_curve25519.h @@ -0,0 +1,26 @@ +#ifndef crypto_scalarmult_curve25519_H +#define crypto_scalarmult_curve25519_H + +#define crypto_scalarmult_curve25519_ref_BYTES 32 +#define crypto_scalarmult_curve25519_ref_SCALARBYTES 32 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_scalarmult_curve25519_ref(unsigned char *,const unsigned char *,const unsigned char *); +extern int crypto_scalarmult_curve25519_ref_base(unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_scalarmult_curve25519 crypto_scalarmult_curve25519_ref +#define crypto_scalarmult_curve25519_base crypto_scalarmult_curve25519_ref_base +#define crypto_scalarmult_curve25519_BYTES crypto_scalarmult_curve25519_ref_BYTES +#define crypto_scalarmult_curve25519_SCALARBYTES crypto_scalarmult_curve25519_ref_SCALARBYTES +#define crypto_scalarmult_curve25519_IMPLEMENTATION "crypto_scalarmult/curve25519/ref" +#ifndef crypto_scalarmult_curve25519_ref_VERSION +#define crypto_scalarmult_curve25519_ref_VERSION "-" +#endif +#define crypto_scalarmult_curve25519_VERSION crypto_scalarmult_curve25519_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_secretbox_xsalsa20poly1305.h b/src/libnacl-ref/include/nacl/crypto_secretbox_xsalsa20poly1305.h new file mode 100644 index 00000000..f6079fc8 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_secretbox_xsalsa20poly1305.h @@ -0,0 +1,30 @@ +#ifndef crypto_secretbox_xsalsa20poly1305_H +#define crypto_secretbox_xsalsa20poly1305_H + +#define crypto_secretbox_xsalsa20poly1305_ref_KEYBYTES 32 +#define crypto_secretbox_xsalsa20poly1305_ref_NONCEBYTES 24 +#define crypto_secretbox_xsalsa20poly1305_ref_ZEROBYTES 32 +#define crypto_secretbox_xsalsa20poly1305_ref_BOXZEROBYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_secretbox_xsalsa20poly1305_ref(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_secretbox_xsalsa20poly1305_ref_open(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_secretbox_xsalsa20poly1305 crypto_secretbox_xsalsa20poly1305_ref +#define crypto_secretbox_xsalsa20poly1305_open crypto_secretbox_xsalsa20poly1305_ref_open +#define crypto_secretbox_xsalsa20poly1305_KEYBYTES crypto_secretbox_xsalsa20poly1305_ref_KEYBYTES +#define crypto_secretbox_xsalsa20poly1305_NONCEBYTES crypto_secretbox_xsalsa20poly1305_ref_NONCEBYTES +#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ref_ZEROBYTES +#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_ref_BOXZEROBYTES +#define crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION "crypto_secretbox/xsalsa20poly1305/ref" +#ifndef crypto_secretbox_xsalsa20poly1305_ref_VERSION +#define crypto_secretbox_xsalsa20poly1305_ref_VERSION "-" +#endif +#define crypto_secretbox_xsalsa20poly1305_VERSION crypto_secretbox_xsalsa20poly1305_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_sign_ed25519.h b/src/libnacl-ref/include/nacl/crypto_sign_ed25519.h new file mode 100644 index 00000000..a07b8bb1 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_sign_ed25519.h @@ -0,0 +1,31 @@ +#ifndef crypto_sign_ed25519_H +#define crypto_sign_ed25519_H + +#define crypto_sign_ed25519_ref_SECRETKEYBYTES 64 +#define crypto_sign_ed25519_ref_PUBLICKEYBYTES 32 +#define crypto_sign_ed25519_ref_BYTES 64 + +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_sign_ed25519_ref(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_sign_ed25519_ref_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_sign_ed25519_ref_keypair(unsigned char *,unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_sign_ed25519 crypto_sign_ed25519_ref +#define crypto_sign_ed25519_open crypto_sign_ed25519_ref_open +#define crypto_sign_ed25519_keypair crypto_sign_ed25519_ref_keypair +#define crypto_sign_ed25519_BYTES crypto_sign_ed25519_ref_BYTES +#define crypto_sign_ed25519_PUBLICKEYBYTES crypto_sign_ed25519_ref_PUBLICKEYBYTES +#define crypto_sign_ed25519_SECRETKEYBYTES crypto_sign_ed25519_ref_SECRETKEYBYTES +#define crypto_sign_ed25519_IMPLEMENTATION "crypto_sign/ed25519/ref" +#ifndef crypto_sign_ed25519_ref_VERSION +#define crypto_sign_ed25519_ref_VERSION "-" +#endif +#define crypto_sign_ed25519_VERSION crypto_sign_ed25519_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_sign_edwards25519sha512batch.h b/src/libnacl-ref/include/nacl/crypto_sign_edwards25519sha512batch.h new file mode 100644 index 00000000..c6da6fe3 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_sign_edwards25519sha512batch.h @@ -0,0 +1,30 @@ +#ifndef crypto_sign_edwards25519sha512batch_H +#define crypto_sign_edwards25519sha512batch_H + +#define crypto_sign_edwards25519sha512batch_ref_SECRETKEYBYTES 64 +#define crypto_sign_edwards25519sha512batch_ref_PUBLICKEYBYTES 32 +#define crypto_sign_edwards25519sha512batch_ref_BYTES 64 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_sign_edwards25519sha512batch_ref(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_sign_edwards25519sha512batch_ref_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); +extern int crypto_sign_edwards25519sha512batch_ref_keypair(unsigned char *,unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_sign_edwards25519sha512batch crypto_sign_edwards25519sha512batch_ref +#define crypto_sign_edwards25519sha512batch_open crypto_sign_edwards25519sha512batch_ref_open +#define crypto_sign_edwards25519sha512batch_keypair crypto_sign_edwards25519sha512batch_ref_keypair +#define crypto_sign_edwards25519sha512batch_BYTES crypto_sign_edwards25519sha512batch_ref_BYTES +#define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES crypto_sign_edwards25519sha512batch_ref_PUBLICKEYBYTES +#define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES crypto_sign_edwards25519sha512batch_ref_SECRETKEYBYTES +#define crypto_sign_edwards25519sha512batch_IMPLEMENTATION "crypto_sign/edwards25519sha512batch/ref" +#ifndef crypto_sign_edwards25519sha512batch_ref_VERSION +#define crypto_sign_edwards25519sha512batch_ref_VERSION "-" +#endif +#define crypto_sign_edwards25519sha512batch_VERSION crypto_sign_edwards25519sha512batch_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_stream_aes128ctr.h b/src/libnacl-ref/include/nacl/crypto_stream_aes128ctr.h new file mode 100644 index 00000000..3ce8ffce --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_stream_aes128ctr.h @@ -0,0 +1,34 @@ +#ifndef crypto_stream_aes128ctr_H +#define crypto_stream_aes128ctr_H + +#define crypto_stream_aes128ctr_portable_KEYBYTES 16 +#define crypto_stream_aes128ctr_portable_NONCEBYTES 16 +#define crypto_stream_aes128ctr_portable_BEFORENMBYTES 1408 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_stream_aes128ctr_portable(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_aes128ctr_portable_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_aes128ctr_portable_beforenm(unsigned char *,const unsigned char *); +extern int crypto_stream_aes128ctr_portable_afternm(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_aes128ctr_portable_xor_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_stream_aes128ctr crypto_stream_aes128ctr_portable +#define crypto_stream_aes128ctr_xor crypto_stream_aes128ctr_portable_xor +#define crypto_stream_aes128ctr_beforenm crypto_stream_aes128ctr_portable_beforenm +#define crypto_stream_aes128ctr_afternm crypto_stream_aes128ctr_portable_afternm +#define crypto_stream_aes128ctr_xor_afternm crypto_stream_aes128ctr_portable_xor_afternm +#define crypto_stream_aes128ctr_KEYBYTES crypto_stream_aes128ctr_portable_KEYBYTES +#define crypto_stream_aes128ctr_NONCEBYTES crypto_stream_aes128ctr_portable_NONCEBYTES +#define crypto_stream_aes128ctr_BEFORENMBYTES crypto_stream_aes128ctr_portable_BEFORENMBYTES +#define crypto_stream_aes128ctr_IMPLEMENTATION "crypto_stream/aes128ctr/portable" +#ifndef crypto_stream_aes128ctr_portable_VERSION +#define crypto_stream_aes128ctr_portable_VERSION "-" +#endif +#define crypto_stream_aes128ctr_VERSION crypto_stream_aes128ctr_portable_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_stream_salsa20.h b/src/libnacl-ref/include/nacl/crypto_stream_salsa20.h new file mode 100644 index 00000000..d8563ed9 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_stream_salsa20.h @@ -0,0 +1,33 @@ +#ifndef crypto_stream_salsa20_H +#define crypto_stream_salsa20_H + +#define crypto_stream_salsa20_ref_KEYBYTES 32 +#define crypto_stream_salsa20_ref_NONCEBYTES 8 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_stream_salsa20_ref(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa20_ref_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa20_ref_beforenm(unsigned char *,const unsigned char *); +extern int crypto_stream_salsa20_ref_afternm(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa20_ref_xor_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_stream_salsa20 crypto_stream_salsa20_ref +#define crypto_stream_salsa20_xor crypto_stream_salsa20_ref_xor +#define crypto_stream_salsa20_beforenm crypto_stream_salsa20_ref_beforenm +#define crypto_stream_salsa20_afternm crypto_stream_salsa20_ref_afternm +#define crypto_stream_salsa20_xor_afternm crypto_stream_salsa20_ref_xor_afternm +#define crypto_stream_salsa20_KEYBYTES crypto_stream_salsa20_ref_KEYBYTES +#define crypto_stream_salsa20_NONCEBYTES crypto_stream_salsa20_ref_NONCEBYTES +#define crypto_stream_salsa20_BEFORENMBYTES crypto_stream_salsa20_ref_BEFORENMBYTES +#define crypto_stream_salsa20_IMPLEMENTATION "crypto_stream/salsa20/ref" +#ifndef crypto_stream_salsa20_ref_VERSION +#define crypto_stream_salsa20_ref_VERSION "-" +#endif +#define crypto_stream_salsa20_VERSION crypto_stream_salsa20_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_stream_salsa2012.h b/src/libnacl-ref/include/nacl/crypto_stream_salsa2012.h new file mode 100644 index 00000000..fc5e8fd3 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_stream_salsa2012.h @@ -0,0 +1,33 @@ +#ifndef crypto_stream_salsa2012_H +#define crypto_stream_salsa2012_H + +#define crypto_stream_salsa2012_ref_KEYBYTES 32 +#define crypto_stream_salsa2012_ref_NONCEBYTES 8 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_stream_salsa2012_ref(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa2012_ref_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa2012_ref_beforenm(unsigned char *,const unsigned char *); +extern int crypto_stream_salsa2012_ref_afternm(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa2012_ref_xor_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_stream_salsa2012 crypto_stream_salsa2012_ref +#define crypto_stream_salsa2012_xor crypto_stream_salsa2012_ref_xor +#define crypto_stream_salsa2012_beforenm crypto_stream_salsa2012_ref_beforenm +#define crypto_stream_salsa2012_afternm crypto_stream_salsa2012_ref_afternm +#define crypto_stream_salsa2012_xor_afternm crypto_stream_salsa2012_ref_xor_afternm +#define crypto_stream_salsa2012_KEYBYTES crypto_stream_salsa2012_ref_KEYBYTES +#define crypto_stream_salsa2012_NONCEBYTES crypto_stream_salsa2012_ref_NONCEBYTES +#define crypto_stream_salsa2012_BEFORENMBYTES crypto_stream_salsa2012_ref_BEFORENMBYTES +#define crypto_stream_salsa2012_IMPLEMENTATION "crypto_stream/salsa2012/ref" +#ifndef crypto_stream_salsa2012_ref_VERSION +#define crypto_stream_salsa2012_ref_VERSION "-" +#endif +#define crypto_stream_salsa2012_VERSION crypto_stream_salsa2012_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_stream_salsa208.h b/src/libnacl-ref/include/nacl/crypto_stream_salsa208.h new file mode 100644 index 00000000..1a15e3c0 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_stream_salsa208.h @@ -0,0 +1,33 @@ +#ifndef crypto_stream_salsa208_H +#define crypto_stream_salsa208_H + +#define crypto_stream_salsa208_ref_KEYBYTES 32 +#define crypto_stream_salsa208_ref_NONCEBYTES 8 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_stream_salsa208_ref(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa208_ref_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa208_ref_beforenm(unsigned char *,const unsigned char *); +extern int crypto_stream_salsa208_ref_afternm(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_salsa208_ref_xor_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_stream_salsa208 crypto_stream_salsa208_ref +#define crypto_stream_salsa208_xor crypto_stream_salsa208_ref_xor +#define crypto_stream_salsa208_beforenm crypto_stream_salsa208_ref_beforenm +#define crypto_stream_salsa208_afternm crypto_stream_salsa208_ref_afternm +#define crypto_stream_salsa208_xor_afternm crypto_stream_salsa208_ref_xor_afternm +#define crypto_stream_salsa208_KEYBYTES crypto_stream_salsa208_ref_KEYBYTES +#define crypto_stream_salsa208_NONCEBYTES crypto_stream_salsa208_ref_NONCEBYTES +#define crypto_stream_salsa208_BEFORENMBYTES crypto_stream_salsa208_ref_BEFORENMBYTES +#define crypto_stream_salsa208_IMPLEMENTATION "crypto_stream/salsa208/ref" +#ifndef crypto_stream_salsa208_ref_VERSION +#define crypto_stream_salsa208_ref_VERSION "-" +#endif +#define crypto_stream_salsa208_VERSION crypto_stream_salsa208_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_stream_xsalsa20.h b/src/libnacl-ref/include/nacl/crypto_stream_xsalsa20.h new file mode 100644 index 00000000..72e8c2e8 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_stream_xsalsa20.h @@ -0,0 +1,33 @@ +#ifndef crypto_stream_xsalsa20_H +#define crypto_stream_xsalsa20_H + +#define crypto_stream_xsalsa20_ref_KEYBYTES 32 +#define crypto_stream_xsalsa20_ref_NONCEBYTES 24 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_stream_xsalsa20_ref(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_xsalsa20_ref_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_xsalsa20_ref_beforenm(unsigned char *,const unsigned char *); +extern int crypto_stream_xsalsa20_ref_afternm(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +extern int crypto_stream_xsalsa20_ref_xor_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_stream_xsalsa20 crypto_stream_xsalsa20_ref +#define crypto_stream_xsalsa20_xor crypto_stream_xsalsa20_ref_xor +#define crypto_stream_xsalsa20_beforenm crypto_stream_xsalsa20_ref_beforenm +#define crypto_stream_xsalsa20_afternm crypto_stream_xsalsa20_ref_afternm +#define crypto_stream_xsalsa20_xor_afternm crypto_stream_xsalsa20_ref_xor_afternm +#define crypto_stream_xsalsa20_KEYBYTES crypto_stream_xsalsa20_ref_KEYBYTES +#define crypto_stream_xsalsa20_NONCEBYTES crypto_stream_xsalsa20_ref_NONCEBYTES +#define crypto_stream_xsalsa20_BEFORENMBYTES crypto_stream_xsalsa20_ref_BEFORENMBYTES +#define crypto_stream_xsalsa20_IMPLEMENTATION "crypto_stream/xsalsa20/ref" +#ifndef crypto_stream_xsalsa20_ref_VERSION +#define crypto_stream_xsalsa20_ref_VERSION "-" +#endif +#define crypto_stream_xsalsa20_VERSION crypto_stream_xsalsa20_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_uint16.h b/src/libnacl-ref/include/nacl/crypto_uint16.h new file mode 100644 index 00000000..6be4e347 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_uint16.h @@ -0,0 +1,8 @@ +#ifndef crypto_uint16_H +#define crypto_uint16_H + +#include + +typedef uint16_t crypto_uint16; + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_uint32.h b/src/libnacl-ref/include/nacl/crypto_uint32.h new file mode 100644 index 00000000..ba66cecc --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_uint32.h @@ -0,0 +1,8 @@ +#ifndef crypto_uint32_H +#define crypto_uint32_H + +#include + +typedef uint32_t crypto_uint32; + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_uint64.h b/src/libnacl-ref/include/nacl/crypto_uint64.h new file mode 100644 index 00000000..98b3f6d3 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_uint64.h @@ -0,0 +1,8 @@ +#ifndef crypto_uint64_H +#define crypto_uint64_H + +#include + +typedef uint64_t crypto_uint64; + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_uint8.h b/src/libnacl-ref/include/nacl/crypto_uint8.h new file mode 100644 index 00000000..789613ba --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_uint8.h @@ -0,0 +1,8 @@ +#ifndef crypto_uint8_H +#define crypto_uint8_H + +#include + +typedef uint8_t crypto_uint8; + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_verify_16.h b/src/libnacl-ref/include/nacl/crypto_verify_16.h new file mode 100644 index 00000000..3f396522 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_verify_16.h @@ -0,0 +1,22 @@ +#ifndef crypto_verify_16_H +#define crypto_verify_16_H + +#define crypto_verify_16_ref_BYTES 16 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_verify_16_ref(const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_verify_16 crypto_verify_16_ref +#define crypto_verify_16_BYTES crypto_verify_16_ref_BYTES +#define crypto_verify_16_IMPLEMENTATION "crypto_verify/16/ref" +#ifndef crypto_verify_16_ref_VERSION +#define crypto_verify_16_ref_VERSION "-" +#endif +#define crypto_verify_16_VERSION crypto_verify_16_ref_VERSION + +#endif diff --git a/src/libnacl-ref/include/nacl/crypto_verify_32.h b/src/libnacl-ref/include/nacl/crypto_verify_32.h new file mode 100644 index 00000000..978d8452 --- /dev/null +++ b/src/libnacl-ref/include/nacl/crypto_verify_32.h @@ -0,0 +1,22 @@ +#ifndef crypto_verify_32_H +#define crypto_verify_32_H + +#define crypto_verify_32_ref_BYTES 32 +#ifdef __cplusplus +#include +extern "C" { +#endif +extern int crypto_verify_32_ref(const unsigned char *,const unsigned char *); +#ifdef __cplusplus +} +#endif + +#define crypto_verify_32 crypto_verify_32_ref +#define crypto_verify_32_BYTES crypto_verify_32_ref_BYTES +#define crypto_verify_32_IMPLEMENTATION "crypto_verify/32/ref" +#ifndef crypto_verify_32_ref_VERSION +#define crypto_verify_32_ref_VERSION "-" +#endif +#define crypto_verify_32_VERSION crypto_verify_32_ref_VERSION + +#endif diff --git a/src/libnacl/randombytes/devurandom.h b/src/libnacl-ref/include/nacl/randombytes.h similarity index 100% rename from src/libnacl/randombytes/devurandom.h rename to src/libnacl-ref/include/nacl/randombytes.h diff --git a/src/libnacl-ref/include/nacl/version.h.in b/src/libnacl-ref/include/nacl/version.h.in new file mode 100644 index 00000000..c6843a06 --- /dev/null +++ b/src/libnacl-ref/include/nacl/version.h.in @@ -0,0 +1,10 @@ + +#ifndef __NACL_VERSION_H__ +#define __NACL_VERSION_H__ + +#define NACL_VERSION_STRING "@VERSION@" + +#define NACL_VERSION_MAJOR 0 +#define NACL_VERSION_MINOR 1 + +#endif diff --git a/src/libnacl/randombytes/devurandom.c b/src/libnacl-ref/randombytes/devurandom.c similarity index 100% rename from src/libnacl/randombytes/devurandom.c rename to src/libnacl-ref/randombytes/devurandom.c diff --git a/src/libnacl-ref/randombytes/devurandom.h b/src/libnacl-ref/randombytes/devurandom.h new file mode 100644 index 00000000..2e0caf8a --- /dev/null +++ b/src/libnacl-ref/randombytes/devurandom.h @@ -0,0 +1,24 @@ +/* +randombytes/devurandom.h version 20080713 +D. J. Bernstein +Public domain. +*/ + +#ifndef randombytes_devurandom_H +#define randombytes_devurandom_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern void randombytes(unsigned char *,unsigned long long); + +#ifdef __cplusplus +} +#endif + +#ifndef randombytes_implementation +#define randombytes_implementation "devurandom" +#endif + +#endif diff --git a/src/libnacl/MACROS b/src/libnacl/MACROS deleted file mode 100644 index 26f6cd02..00000000 --- a/src/libnacl/MACROS +++ /dev/null @@ -1,56 +0,0 @@ -crypto_verify -crypto_verify_BYTES -crypto_core -crypto_core_OUTPUTBYTES -crypto_core_INPUTBYTES -crypto_core_KEYBYTES -crypto_core_CONSTBYTES -crypto_hashblocks -crypto_hashblocks_STATEBYTES -crypto_hashblocks_BLOCKBYTES -crypto_hash -crypto_hash_BYTES -crypto_stream -crypto_stream_xor -crypto_stream_beforenm -crypto_stream_afternm -crypto_stream_xor_afternm -crypto_stream_KEYBYTES -crypto_stream_NONCEBYTES -crypto_stream_BEFORENMBYTES -crypto_onetimeauth -crypto_onetimeauth_verify -crypto_onetimeauth_BYTES -crypto_onetimeauth_KEYBYTES -crypto_auth -crypto_auth_verify -crypto_auth_BYTES -crypto_auth_KEYBYTES -crypto_secretbox -crypto_secretbox_open -crypto_secretbox_KEYBYTES -crypto_secretbox_NONCEBYTES -crypto_secretbox_ZEROBYTES -crypto_secretbox_BOXZEROBYTES -crypto_scalarmult -crypto_scalarmult_base -crypto_scalarmult_BYTES -crypto_scalarmult_SCALARBYTES -crypto_box -crypto_box_open -crypto_box_keypair -crypto_box_beforenm -crypto_box_afternm -crypto_box_open_afternm -crypto_box_PUBLICKEYBYTES -crypto_box_SECRETKEYBYTES -crypto_box_BEFORENMBYTES -crypto_box_NONCEBYTES -crypto_box_ZEROBYTES -crypto_box_BOXZEROBYTES -crypto_sign -crypto_sign_open -crypto_sign_keypair -crypto_sign_BYTES -crypto_sign_PUBLICKEYBYTES -crypto_sign_SECRETKEYBYTES diff --git a/src/libnacl/Makefile.in b/src/libnacl/Makefile.in deleted file mode 100644 index d785e86a..00000000 --- a/src/libnacl/Makefile.in +++ /dev/null @@ -1,44 +0,0 @@ - -all: .done - -.done: - ./do - touch .done - -test: - cd tests && $(MAKE) $(AM_MAKEFLAGS) test - -clean: - cd tests && $(MAKE) $(AM_MAKEFLAGS) clean - -$(RM) .done - -$(RM) -r okcompilers/bin - -$(RM) -r okcompilers/oldbin - -$(RM) -r build/* - -distclean: clean - cd tests && $(MAKE) $(AM_MAKEFLAGS) distclean - -$(RM) okcompilers/c - -$(RM) okcompilers/do - -install: -install-data: -install-exec: -uninstall: -install-dvi: -install-html: -install-info: -install-ps: -install-pdf: -installdirs: -check: -installcheck: -mostlyclean: clean -maintainer-clean: distclean - -distdir: - while read dir ; do @MKDIR_P@ "$(distdir)/$$dir" ; done < dist-dirs - while read file ; do @INSTALL@ "$$file" "$(distdir)/$$file" ; done < dist-files - -EMPTY_AUTOMAKE_TARGETS = dvi pdf ps info html tags ctags -.PHONY: $(EMPTY_AUTOMAKE_TARGETS) -$(EMPTY_AUTOMAKE_TARGETS): diff --git a/src/libnacl/OPERATIONS b/src/libnacl/OPERATIONS deleted file mode 100644 index 5fc25d35..00000000 --- a/src/libnacl/OPERATIONS +++ /dev/null @@ -1,11 +0,0 @@ -crypto_verify -crypto_core -crypto_hashblocks -crypto_hash -crypto_stream -crypto_onetimeauth -crypto_auth -crypto_secretbox -crypto_scalarmult -crypto_box -crypto_sign diff --git a/src/libnacl/PROTOTYPES.c b/src/libnacl/PROTOTYPES.c deleted file mode 100644 index bc8ca531..00000000 --- a/src/libnacl/PROTOTYPES.c +++ /dev/null @@ -1,26 +0,0 @@ -extern int crypto_verify(const unsigned char *,const unsigned char *); -extern int crypto_core(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_hashblocks(unsigned char *,const unsigned char *,unsigned long long); -extern int crypto_hash(unsigned char *,const unsigned char *,unsigned long long); -extern int crypto_stream(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_stream_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_stream_beforenm(unsigned char *,const unsigned char *); -extern int crypto_stream_afternm(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_stream_xor_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_onetimeauth(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_onetimeauth_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_auth(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_auth_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_secretbox(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_secretbox_open(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_scalarmult(unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_scalarmult_base(unsigned char *,const unsigned char *); -extern int crypto_box(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_box_open(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_box_keypair(unsigned char *,unsigned char *); -extern int crypto_box_beforenm(unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_box_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_box_open_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_sign(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_sign_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_sign_keypair(unsigned char *,unsigned char *); diff --git a/src/libnacl/commandline/nacl-sha256.c b/src/libnacl/commandline/nacl-sha256.c deleted file mode 100644 index 8e0df453..00000000 --- a/src/libnacl/commandline/nacl-sha256.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -commandline/nacl-sha256.c version 20080713 -D. J. Bernstein -Public domain. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "crypto_hash_sha256.h" - -unsigned char *input; -unsigned long long inputalloc; -unsigned long long inputlen; - -unsigned char h[crypto_hash_sha256_BYTES]; - -void h_print(void) -{ - int i; - for (i = 0;i < crypto_hash_sha256_BYTES;++i) printf("%02x",255 & (int) h[i]); - printf("\n"); -} - -int main() -{ - struct stat st; - int ch; - - if (fstat(0,&st) == 0) { - input = mmap(0,st.st_size,PROT_READ,MAP_SHARED,0,0); - if (input != MAP_FAILED) { - crypto_hash_sha256(h,input,st.st_size); - h_print(); - return 0; - } - } - - input = 0; - inputalloc = 0; - inputlen = 0; - - while ((ch = getchar()) != EOF) { - if (inputlen >= inputalloc) { - void *newinput; - while (inputlen >= inputalloc) - inputalloc = inputalloc * 2 + 1; - if (posix_memalign(&newinput,16,inputalloc) != 0) return 111; - memcpy(newinput,input,inputlen); - free(input); - input = newinput; - } - input[inputlen++] = ch; - } - - crypto_hash_sha256(h,input,inputlen); - h_print(); - - return 0; -} diff --git a/src/libnacl/commandline/nacl-sha512.c b/src/libnacl/commandline/nacl-sha512.c deleted file mode 100644 index 6864c76a..00000000 --- a/src/libnacl/commandline/nacl-sha512.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -commandline/nacl-sha512.c version 20080713 -D. J. Bernstein -Public domain. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "crypto_hash_sha512.h" - -unsigned char *input; -unsigned long long inputalloc; -unsigned long long inputlen; - -unsigned char h[crypto_hash_sha512_BYTES]; - -void h_print(void) -{ - int i; - for (i = 0;i < crypto_hash_sha512_BYTES;++i) printf("%02x",255 & (int) h[i]); - printf("\n"); -} - -int main() -{ - struct stat st; - int ch; - - if (fstat(0,&st) == 0) { - input = mmap(0,st.st_size,PROT_READ,MAP_SHARED,0,0); - if (input != MAP_FAILED) { - crypto_hash_sha512(h,input,st.st_size); - h_print(); - return 0; - } - } - - input = 0; - inputalloc = 0; - inputlen = 0; - - while ((ch = getchar()) != EOF) { - if (inputlen >= inputalloc) { - void *newinput; - while (inputlen >= inputalloc) - inputalloc = inputalloc * 2 + 1; - if (posix_memalign(&newinput,16,inputalloc) != 0) return 111; - memcpy(newinput,input,inputlen); - free(input); - input = newinput; - } - input[inputlen++] = ch; - } - - crypto_hash_sha512(h,input,inputlen); - h_print(); - - return 0; -} diff --git a/src/libnacl/cpucycles/alpha.c b/src/libnacl/cpucycles/alpha.c deleted file mode 100644 index ef497999..00000000 --- a/src/libnacl/cpucycles/alpha.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -cpucycles/alpha.c version 20060316 -D. J. Bernstein -Public domain. -*/ - -#include -#include -#include - -static long long tod(void) -{ - struct timeval t; - gettimeofday(&t,(struct timezone *) 0); - return t.tv_sec * (long long) 1000000 + t.tv_usec; -} - -static long long rpcc(void) -{ - unsigned long long t; - asm volatile("rpcc %0" : "=r"(t)); - return t & 0xffffffff; -} - -static long long firstrpcc; -static long long firsttod; -static long long lastrpcc; -static long long lasttod; -static double mhz = 0; - -static void init(void) -{ - firstrpcc = rpcc(); - firsttod = tod(); - - do { - lastrpcc = rpcc(); - lasttod = tod(); - } while (lasttod - firsttod < 10000); - - lastrpcc -= firstrpcc; lastrpcc &= 0xffffffff; - lasttod -= firsttod; - - mhz = (double) lastrpcc / (double) lasttod; -} - -long long cpucycles_alpha(void) -{ - double x; - long long y; - - if (!mhz) init(); - - lastrpcc = rpcc(); - lasttod = tod(); - - lastrpcc -= firstrpcc; lastrpcc &= 0xffffffff; - lasttod -= firsttod; - - /* Number of cycles since firstrpcc is lastrpcc + 2^32 y for unknown y. */ - /* Number of microseconds since firsttod is lasttod. */ - - x = (lasttod * mhz - lastrpcc) * 0.00000000023283064365386962890625; - y = x; - while (x > y + 0.5) y += 1; - while (x < y - 0.5) y -= 1; - - y *= 4294967296ULL; - lastrpcc += y; - - mhz = (double) lastrpcc / (double) lasttod; - - return firstrpcc + lastrpcc; -} - -long long cpucycles_alpha_persecond(void) -{ - if (!mhz) init(); - return 1000000.0 * mhz; -} diff --git a/src/libnacl/cpucycles/alpha.h b/src/libnacl/cpucycles/alpha.h deleted file mode 100644 index c97672af..00000000 --- a/src/libnacl/cpucycles/alpha.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles alpha.h version 20060318 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_alpha_h -#define CPUCYCLES_alpha_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_alpha(void); -extern long long cpucycles_alpha_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "alpha" -#define cpucycles cpucycles_alpha -#define cpucycles_persecond cpucycles_alpha_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/amd64cpuinfo.c b/src/libnacl/cpucycles/amd64cpuinfo.c deleted file mode 100644 index 729f2612..00000000 --- a/src/libnacl/cpucycles/amd64cpuinfo.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include "osfreq.c" - -long long cpucycles_amd64cpuinfo(void) -{ - unsigned long long result; - asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax" - : "=a" (result) :: "%rdx"); - return result; -} - -long long cpucycles_amd64cpuinfo_persecond(void) -{ - return osfreq(); -} diff --git a/src/libnacl/cpucycles/amd64cpuinfo.h b/src/libnacl/cpucycles/amd64cpuinfo.h deleted file mode 100644 index 8f858ae7..00000000 --- a/src/libnacl/cpucycles/amd64cpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles amd64cpuinfo.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_amd64cpuinfo_h -#define CPUCYCLES_amd64cpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_amd64cpuinfo(void); -extern long long cpucycles_amd64cpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "amd64cpuinfo" -#define cpucycles cpucycles_amd64cpuinfo -#define cpucycles_persecond cpucycles_amd64cpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/amd64cpuspeed.c b/src/libnacl/cpucycles/amd64cpuspeed.c deleted file mode 100644 index 7e89511c..00000000 --- a/src/libnacl/cpucycles/amd64cpuspeed.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#include - -long long cpucycles_amd64cpuspeed(void) -{ - unsigned long long result; - asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax" - : "=a" (result) :: "%rdx"); - return result; -} - -long long cpucycles_amd64cpuspeed_persecond(void) -{ - int oid[2]; - int val; - size_t size; - oid[0] = CTL_HW; - oid[1] = HW_CPUSPEED; - size = sizeof val; - if (sysctl(oid,2,&val,&size,0,0) == -1) return 0; - if (size != sizeof val) return 0; - return val * 1000000LL; -} diff --git a/src/libnacl/cpucycles/amd64cpuspeed.h b/src/libnacl/cpucycles/amd64cpuspeed.h deleted file mode 100644 index 1f6ed54d..00000000 --- a/src/libnacl/cpucycles/amd64cpuspeed.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles amd64cpuspeed.h version 20090716 -Matthew Dempsky -Public domain. -*/ - -#ifndef CPUCYCLES_amd64cpuspeed_h -#define CPUCYCLES_amd64cpuspeed_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_amd64cpuspeed(void); -extern long long cpucycles_amd64cpuspeed_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "amd64cpuspeed" -#define cpucycles cpucycles_amd64cpuspeed -#define cpucycles_persecond cpucycles_amd64cpuspeed_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/amd64tscfreq.c b/src/libnacl/cpucycles/amd64tscfreq.c deleted file mode 100644 index ef182c1b..00000000 --- a/src/libnacl/cpucycles/amd64tscfreq.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -long long cpucycles_amd64tscfreq(void) -{ - unsigned long long result; - asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax" - : "=a" (result) :: "%rdx"); - return result; -} - -long long cpucycles_amd64tscfreq_persecond(void) -{ - long result = 0; - size_t resultlen = sizeof(long); - sysctlbyname("machdep.tsc_freq",&result,&resultlen,0,0); - return result; -} diff --git a/src/libnacl/cpucycles/amd64tscfreq.h b/src/libnacl/cpucycles/amd64tscfreq.h deleted file mode 100644 index a3c7aa6f..00000000 --- a/src/libnacl/cpucycles/amd64tscfreq.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles amd64tscfreq.h version 20060318 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_amd64tscfreq_h -#define CPUCYCLES_amd64tscfreq_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_amd64tscfreq(void); -extern long long cpucycles_amd64tscfreq_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "amd64tscfreq" -#define cpucycles cpucycles_amd64tscfreq -#define cpucycles_persecond cpucycles_amd64tscfreq_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/celllinux.c b/src/libnacl/cpucycles/celllinux.c deleted file mode 100644 index 83a0c38a..00000000 --- a/src/libnacl/cpucycles/celllinux.c +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include -#include -#include -#include -#include - -static long myround(double u) -{ - long result = u; - while (result + 0.5 < u) result += 1; - while (result - 0.5 > u) result -= 1; - return result; -} - -static long long microseconds(void) -{ - struct timeval t; - gettimeofday(&t,(struct timezone *) 0); - return t.tv_sec * (long long) 1000000 + t.tv_usec; -} - -static long long timebase(void) -{ - unsigned long long result; - result = -spu_read_decrementer(); - return 0xffffffff & result; -} - -static double cpufrequency = 0; -static long tbcycles = 0; - -static double guesstbcycles(void) -{ - long long tb0; long long us0; - long long tb1; long long us1; - - tb0 = timebase(); - us0 = microseconds(); - do { - tb1 = timebase(); - us1 = microseconds(); - } while (us1 - us0 < 10000 || tb1 - tb0 < 1000); - if (tb1 <= tb0) return 0; - tb1 -= tb0; - us1 -= us0; - return (cpufrequency * 0.000001 * (double) us1) / (double) tb1; -} - -static void init(void) -{ - int loop; - double guess1; - double guess2; - - spu_write_decrementer(0xffffffff); - - cpufrequency = 3192000000.0; - - for (loop = 0;loop < 100;++loop) { - guess1 = guesstbcycles(); - guess2 = guesstbcycles(); - tbcycles = myround(guess1); - if (guess1 - tbcycles > 0.1) continue; - if (tbcycles - guess1 > 0.1) continue; - if (guess2 - tbcycles > 0.1) continue; - if (tbcycles - guess2 > 0.1) continue; - return; - } - tbcycles = 0; -} - -long long cpucycles_celllinux(void) -{ - if (!tbcycles) init(); - return timebase() * tbcycles; -} - -long long cpucycles_celllinux_persecond(void) -{ - if (!tbcycles) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/celllinux.h b/src/libnacl/cpucycles/celllinux.h deleted file mode 100644 index 75a5a3f2..00000000 --- a/src/libnacl/cpucycles/celllinux.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles celllinux.h version 20081201 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_celllinux_h -#define CPUCYCLES_celllinux_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_celllinux(void); -extern long long cpucycles_celllinux_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "celllinux" -#define cpucycles cpucycles_celllinux -#define cpucycles_persecond cpucycles_celllinux_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/cortex.c b/src/libnacl/cpucycles/cortex.c deleted file mode 100644 index ef1a42cd..00000000 --- a/src/libnacl/cpucycles/cortex.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -cpucycles/cortex.c version 20101203 -D. J. Bernstein -Public domain. -*/ - -#define SCALE 1 -#include -#include -#include - -static int enabled = 0; - -static int prev[3]; -static unsigned long long prevcycles = 0; -static int now[3]; -static long long cyclespersec = 0; - -static void readticks(unsigned int *result) -{ - struct timeval t; - unsigned int cc; - if (!enabled) { - asm volatile("mcr p15, 0, %0, c9, c12, 0" :: "r"(17)); - asm volatile("mcr p15, 0, %0, c9, c12, 1" :: "r"(0x8000000f)); - asm volatile("mcr p15, 0, %0, c9, c12, 3" :: "r"(0x8000000f)); - enabled = 1; - } - asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(cc)); - gettimeofday(&t,(struct timezone *) 0); - result[0] = cc; - result[1] = t.tv_usec; - result[2] = t.tv_sec; -} - -long long cpucycles_cortex(void) -{ - unsigned long long delta4; - int deltan; - int deltas; - unsigned long long guesscycles; - - readticks(now); - delta4 = (unsigned int) (now[0] - prev[0]); /* unsigned change in number of cycles mod 2^32 */ - deltan = now[1] - prev[1]; /* signed change in number of nanoseconds mod 10^9 */ - deltas = now[2] - prev[2]; /* signed change in number of seconds */ - if ((deltas == 0 && deltan < 200000) || (deltas == 1 && deltan < -800000)) - return (prevcycles + delta4) * SCALE; - - prev[0] = now[0]; - prev[1] = now[1]; - prev[2] = now[2]; - - if ((deltas == 0 && deltan < 300000) || (deltas == 1 && deltan < -700000)) { - // actual number of cycles cannot have increased by 2^32 in <0.3ms - cyclespersec = 1000000 * (unsigned long long) delta4; - cyclespersec /= deltan + 1000000 * (long long) deltas; - } else { - guesscycles = deltas * cyclespersec; - guesscycles += (deltan * cyclespersec) / 1000000; - while (delta4 + 2147483648ULL < guesscycles) delta4 += 4294967296ULL; - /* XXX: could do longer-term extrapolation here */ - } - - prevcycles += delta4; - return prevcycles * SCALE; -} - -long long cpucycles_cortex_persecond(void) -{ - while (!cyclespersec) cpucycles_cortex(); - return cyclespersec * SCALE; -} diff --git a/src/libnacl/cpucycles/cortex.h b/src/libnacl/cpucycles/cortex.h deleted file mode 100644 index e622f132..00000000 --- a/src/libnacl/cpucycles/cortex.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles cortex.h version 20100912 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_cortex_h -#define CPUCYCLES_cortex_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_cortex(void); -extern long long cpucycles_cortex_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "cortex" -#define cpucycles cpucycles_cortex -#define cpucycles_persecond cpucycles_cortex_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/dev4ns.c b/src/libnacl/cpucycles/dev4ns.c deleted file mode 100644 index 08dd562b..00000000 --- a/src/libnacl/cpucycles/dev4ns.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -#include -#include -#include - -static int fddev = -1; -static int prev[3]; -static unsigned long long prevcycles = 0; -static int now[3]; -static long long cyclespersec = 0; - -static void readdev(unsigned int *result) -{ - if (read(fddev,result,12) == 12) return; - result[0] = result[1] = result[2] = 0; -} - -long long cpucycles_dev4ns(void) -{ - unsigned long long delta4; - int deltan; - int deltas; - unsigned long long guesscycles; - - if (fddev == -1) { - fddev = open("/dev/cpucycles4ns",O_RDONLY); - readdev(prev); - } - - readdev(now); - delta4 = (unsigned int) (now[0] - prev[0]); /* unsigned change in number of cycles mod 2^32 */ - deltan = now[1] - prev[1]; /* signed change in number of nanoseconds mod 10^9 */ - deltas = now[2] - prev[2]; /* signed change in number of seconds */ - if ((deltas == 0 && deltan < 200000000) || (deltas == 1 && deltan < -800000000)) - return prevcycles + delta4; - - prev[0] = now[0]; - prev[1] = now[1]; - prev[2] = now[2]; - - if ((deltas == 0 && deltan < 300000000) || (deltas == 1 && deltan < -700000000)) { - // actual number of cycles cannot have increased by 2^32 in <0.3ms - cyclespersec = 1000000000 * (unsigned long long) delta4; - cyclespersec /= deltan + 1000000000 * (long long) deltas; - } else { - guesscycles = deltas * cyclespersec; - guesscycles += (deltan * cyclespersec) / 1000000000; - while (delta4 + 2147483648ULL < guesscycles) delta4 += 4294967296ULL; - /* XXX: could do longer-term extrapolation here */ - } - - prevcycles += delta4; - return prevcycles; -} - -long long cpucycles_dev4ns_persecond(void) -{ - while (!cyclespersec) cpucycles_dev4ns(); - return cyclespersec; -} diff --git a/src/libnacl/cpucycles/dev4ns.h b/src/libnacl/cpucycles/dev4ns.h deleted file mode 100644 index 1d99639a..00000000 --- a/src/libnacl/cpucycles/dev4ns.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles dev4ns.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_dev4ns_h -#define CPUCYCLES_dev4ns_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_dev4ns(void); -extern long long cpucycles_dev4ns_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "dev4ns" -#define cpucycles cpucycles_dev4ns -#define cpucycles_persecond cpucycles_dev4ns_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/do b/src/libnacl/cpucycles/do deleted file mode 100755 index ee25b208..00000000 --- a/src/libnacl/cpucycles/do +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -e - -okabi | ( - while read abi - do - - rm -f cpucycles.o cpucycles.h - - ( - echo monotoniccpuinfo - echo monotonic - echo gettimeofday - ) | ( - while read n - do - okc-$abi | ( - while read c - do - echo "=== `date` === Trying $n.c with $c..." >&2 - rm -f test cpucycles-impl.o cpucycles-impl.h cpucycles-impl.c - cp $n.c cpucycles-impl.c || continue - cp $n.h cpucycles-impl.h || continue - $c -c cpucycles-impl.c || continue - $c -o test test.c cpucycles-impl.o || continue - echo "=== `date` === Success. Using $n.c." >&2 - mkdir -p lib/$abi - mv cpucycles-impl.o lib/$abi/cpucycles.o - mkdir -p include/$abi - mv cpucycles-impl.h include/$abi/cpucycles.h - exit 0 - done - exit 111 - ) && exit 0 - done - exit 111 - ) || ( - echo ===== Giving up. >&2 - rm -f test cpucycles-impl.o cpucycles-impl.h cpucycles-impl.c - exit 111 - ) || exit 0 - - done - exit 0 -) || exit 111 diff --git a/src/libnacl/cpucycles/gettimeofday.c b/src/libnacl/cpucycles/gettimeofday.c deleted file mode 100644 index 0bf5e03c..00000000 --- a/src/libnacl/cpucycles/gettimeofday.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include -#include -#include "osfreq.c" - -static double cpufrequency = 0; - -static void init(void) -{ - cpufrequency = osfreq(); -} - -long long cpucycles_gettimeofday(void) -{ - double result; - struct timeval t; - if (!cpufrequency) init(); - gettimeofday(&t,(struct timezone *) 0); - result = t.tv_usec; - result *= 0.000001; - result += (double) t.tv_sec; - result *= cpufrequency; - return result; -} - -long long cpucycles_gettimeofday_persecond(void) -{ - if (!cpufrequency) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/gettimeofday.h b/src/libnacl/cpucycles/gettimeofday.h deleted file mode 100644 index 147b127b..00000000 --- a/src/libnacl/cpucycles/gettimeofday.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles gettimeofday.h version 20060318 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_gettimeofday_h -#define CPUCYCLES_gettimeofday_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_gettimeofday(void); -extern long long cpucycles_gettimeofday_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "gettimeofday" -#define cpucycles cpucycles_gettimeofday -#define cpucycles_persecond cpucycles_gettimeofday_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/hppapstat.c b/src/libnacl/cpucycles/hppapstat.c deleted file mode 100644 index 5ae1e843..00000000 --- a/src/libnacl/cpucycles/hppapstat.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include -#include -#include - -long long cpucycles_hppapstat(void) -{ - register long long result; - _MFCTL(16,result); - return result; -} - -long long cpucycles_hppapstat_persecond(void) -{ - struct pst_processor pst; - union pstun pu; - double result; - - pu.pst_processor = &pst; - if (pstat(PSTAT_PROCESSOR,pu,sizeof(pst),1,0) < 0) return 0; - result = pst.psp_iticksperclktick; - result *= (double) sysconf(_SC_CLK_TCK); - return result; -} diff --git a/src/libnacl/cpucycles/hppapstat.h b/src/libnacl/cpucycles/hppapstat.h deleted file mode 100644 index 721814bb..00000000 --- a/src/libnacl/cpucycles/hppapstat.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles hppapstat.h version 20060319 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_hppapstat_h -#define CPUCYCLES_hppapstat_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_hppapstat(void); -extern long long cpucycles_hppapstat_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "hppapstat" -#define cpucycles cpucycles_hppapstat -#define cpucycles_persecond cpucycles_hppapstat_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/ia64cpuinfo.c b/src/libnacl/cpucycles/ia64cpuinfo.c deleted file mode 100644 index 580c6cee..00000000 --- a/src/libnacl/cpucycles/ia64cpuinfo.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "osfreq.c" - -long long cpucycles_ia64cpuinfo(void) -{ - long long result; - asm volatile("mov %0=ar.itc" : "=r"(result)); - return result; -} - -long long cpucycles_ia64cpuinfo_persecond(void) -{ - return osfreq(); -} diff --git a/src/libnacl/cpucycles/ia64cpuinfo.h b/src/libnacl/cpucycles/ia64cpuinfo.h deleted file mode 100644 index a6bcf47d..00000000 --- a/src/libnacl/cpucycles/ia64cpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles ia64cpuinfo.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_ia64cpuinfo_h -#define CPUCYCLES_ia64cpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_ia64cpuinfo(void); -extern long long cpucycles_ia64cpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "ia64cpuinfo" -#define cpucycles cpucycles_ia64cpuinfo -#define cpucycles_persecond cpucycles_ia64cpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/mips.c b/src/libnacl/cpucycles/mips.c deleted file mode 100644 index d9736f00..00000000 --- a/src/libnacl/cpucycles/mips.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -cpucycles/mips.c version 20100803 -D. J. Bernstein -Public domain. -*/ - -#define SCALE 2 -#include -#include -#include - -static int prev[3]; -static unsigned long long prevcycles = 0; -static int now[3]; -static long long cyclespersec = 0; - -static void readticks(unsigned int *result) -{ - struct timeval t; - unsigned int cc; - asm volatile(".byte 59; .byte 16; .byte 2; .byte 124; move %0,$2" : "=r"(cc) : : "$2"); - gettimeofday(&t,(struct timezone *) 0); - result[0] = cc; - result[1] = t.tv_usec; - result[2] = t.tv_sec; -} - -long long cpucycles_mips(void) -{ - unsigned long long delta4; - int deltan; - int deltas; - unsigned long long guesscycles; - - readticks(now); - delta4 = (unsigned int) (now[0] - prev[0]); /* unsigned change in number of cycles mod 2^32 */ - deltan = now[1] - prev[1]; /* signed change in number of nanoseconds mod 10^9 */ - deltas = now[2] - prev[2]; /* signed change in number of seconds */ - if ((deltas == 0 && deltan < 200000) || (deltas == 1 && deltan < -800000)) - return (prevcycles + delta4) * SCALE; - - prev[0] = now[0]; - prev[1] = now[1]; - prev[2] = now[2]; - - if ((deltas == 0 && deltan < 300000) || (deltas == 1 && deltan < -700000)) { - // actual number of cycles cannot have increased by 2^32 in <0.3ms - cyclespersec = 1000000 * (unsigned long long) delta4; - cyclespersec /= deltan + 1000000 * (long long) deltas; - } else { - guesscycles = deltas * cyclespersec; - guesscycles += (deltan * cyclespersec) / 1000000; - while (delta4 + 2147483648ULL < guesscycles) delta4 += 4294967296ULL; - /* XXX: could do longer-term extrapolation here */ - } - - prevcycles += delta4; - return prevcycles * SCALE; -} - -long long cpucycles_mips_persecond(void) -{ - while (!cyclespersec) cpucycles_mips(); - return cyclespersec * SCALE; -} diff --git a/src/libnacl/cpucycles/mips.h b/src/libnacl/cpucycles/mips.h deleted file mode 100644 index 6f1b26c3..00000000 --- a/src/libnacl/cpucycles/mips.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles mips.h version 20100802 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_mips_h -#define CPUCYCLES_mips_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_mips(void); -extern long long cpucycles_mips_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "mips" -#define cpucycles cpucycles_mips -#define cpucycles_persecond cpucycles_mips_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/monotonic.c b/src/libnacl/cpucycles/monotonic.c deleted file mode 100644 index 321afd9a..00000000 --- a/src/libnacl/cpucycles/monotonic.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -static double cpufrequency = 0; - -static void init(void) -{ - long result = 0; size_t resultlen = sizeof(long); - sysctlbyname("machdep.tsc_freq",&result,&resultlen,0,0); - cpufrequency = result; -} - -long long cpucycles_monotonic(void) -{ - double result; - struct timespec t; - if (!cpufrequency) init(); - clock_gettime(CLOCK_MONOTONIC,&t); - result = t.tv_nsec; - result *= 0.000000001; - result += (double) t.tv_sec; - result *= cpufrequency; - return result; -} - -long long cpucycles_monotonic_persecond(void) -{ - if (!cpufrequency) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/monotonic.h b/src/libnacl/cpucycles/monotonic.h deleted file mode 100644 index 9070860b..00000000 --- a/src/libnacl/cpucycles/monotonic.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles monotonic.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_monotonic_h -#define CPUCYCLES_monotonic_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_monotonic(void); -extern long long cpucycles_monotonic_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "monotonic" -#define cpucycles cpucycles_monotonic -#define cpucycles_persecond cpucycles_monotonic_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/monotoniccpuinfo.c b/src/libnacl/cpucycles/monotoniccpuinfo.c deleted file mode 100644 index 890e6b24..00000000 --- a/src/libnacl/cpucycles/monotoniccpuinfo.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "osfreq.c" - -static double cpufrequency = 0; - -static void init(void) -{ - cpufrequency = osfreq(); -} - -long long cpucycles_monotoniccpuinfo(void) -{ - double result; - struct timespec t; - if (!cpufrequency) init(); - clock_gettime(CLOCK_MONOTONIC,&t); - result = t.tv_nsec; - result *= 0.000000001; - result += (double) t.tv_sec; - result *= cpufrequency; - return result; -} - -long long cpucycles_monotoniccpuinfo_persecond(void) -{ - if (!cpufrequency) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/monotoniccpuinfo.h b/src/libnacl/cpucycles/monotoniccpuinfo.h deleted file mode 100644 index d4ba7ea8..00000000 --- a/src/libnacl/cpucycles/monotoniccpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles monotoniccpuinfo.h version 20100804 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_monotoniccpuinfo_h -#define CPUCYCLES_monotoniccpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_monotoniccpuinfo(void); -extern long long cpucycles_monotoniccpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "monotoniccpuinfo" -#define cpucycles cpucycles_monotoniccpuinfo -#define cpucycles_persecond cpucycles_monotoniccpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/osfreq.c b/src/libnacl/cpucycles/osfreq.c deleted file mode 100644 index 4e106a23..00000000 --- a/src/libnacl/cpucycles/osfreq.c +++ /dev/null @@ -1,65 +0,0 @@ -static double osfreq(void) -{ - FILE *f; - double result; - int s; - - f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", "r"); - if (f) { - s = fscanf(f,"%lf",&result); - fclose(f); - if (s > 0) return 1000.0 * result; - } - - f = fopen("/sys/devices/system/cpu/cpu0/clock_tick", "r"); - if (f) { - s = fscanf(f,"%lf",&result); - fclose(f); - if (s > 0) return result; - } - - f = fopen("/proc/cpuinfo","r"); - if (f) { - for (;;) { - s = fscanf(f,"cpu MHz : %lf",&result); - if (s > 0) break; - if (s == 0) s = fscanf(f,"%*[^\n]\n"); - if (s < 0) { result = 0; break; } - } - fclose(f); - if (result) return 1000000.0 * result; - } - - f = fopen("/proc/cpuinfo","r"); - if (f) { - for (;;) { - s = fscanf(f,"clock : %lf",&result); - if (s > 0) break; - if (s == 0) s = fscanf(f,"%*[^\n]\n"); - if (s < 0) { result = 0; break; } - } - fclose(f); - if (result) return 1000000.0 * result; - } - - f = popen("/usr/sbin/lsattr -E -l proc0 -a frequency 2>/dev/null","r"); - if (f) { - s = fscanf(f,"frequency %lf",&result); - pclose(f); - if (s > 0) return result; - } - - f = popen("/usr/sbin/psrinfo -v 2>/dev/null","r"); - if (f) { - for (;;) { - s = fscanf(f," The %*s processor operates at %lf MHz",&result); - if (s > 0) break; - if (s == 0) s = fscanf(f,"%*[^\n]\n"); - if (s < 0) { result = 0; break; } - } - pclose(f); - if (result) return 1000000.0 * result; - } - - return 0; -} diff --git a/src/libnacl/cpucycles/powerpccpuinfo.c b/src/libnacl/cpucycles/powerpccpuinfo.c deleted file mode 100644 index b70c745a..00000000 --- a/src/libnacl/cpucycles/powerpccpuinfo.c +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include -#include -#include -#include -#include "osfreq.c" - -static long myround(double u) -{ - long result = u; - while (result + 0.5 < u) result += 1; - while (result - 0.5 > u) result -= 1; - return result; -} - -static long long microseconds(void) -{ - struct timeval t; - gettimeofday(&t,(struct timezone *) 0); - return t.tv_sec * (long long) 1000000 + t.tv_usec; -} - -static int tbshift = 0; - -static long long timebase(void) -{ - unsigned long high; - unsigned long low; - unsigned long newhigh; - unsigned long long result; - asm volatile( - "7:mftbu %0;mftb %1;mftbu %2;cmpw %0,%2;bne 7b" - : "=r" (high), "=r" (low), "=r" (newhigh) - ); - result = high; - result <<= 32; - result |= low; - return result >> tbshift; -} - -static double cpufrequency = 0; -static long tbcycles = 0; - -static double guesstbcycles(void) -{ - long long tb0; long long us0; - long long tb1; long long us1; - - tb0 = timebase(); - us0 = microseconds(); - do { - tb1 = timebase(); - us1 = microseconds(); - } while (us1 - us0 < 10000 || tb1 - tb0 < 1000); - if (tb1 <= tb0) return 0; - tb1 -= tb0; - us1 -= us0; - return (cpufrequency * 0.000001 * (double) us1) / (double) tb1; -} - -static void init(void) -{ - int loop; - double guess1; - double guess2; - - cpufrequency = osfreq(); - if (!cpufrequency) return; - - for (tbshift = 0;tbshift < 10;++tbshift) { - for (loop = 0;loop < 100;++loop) { - guess1 = guesstbcycles(); - guess2 = guesstbcycles(); - tbcycles = myround(guess1); - if (guess1 - tbcycles > 0.1) continue; - if (tbcycles - guess1 > 0.1) continue; - if (guess2 - tbcycles > 0.1) continue; - if (tbcycles - guess2 > 0.1) continue; - return; - } - } - tbcycles = 0; -} - -long long cpucycles_powerpccpuinfo(void) -{ - if (!tbcycles) init(); - return timebase() * tbcycles; -} - -long long cpucycles_powerpccpuinfo_persecond(void) -{ - if (!tbcycles) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/powerpccpuinfo.h b/src/libnacl/cpucycles/powerpccpuinfo.h deleted file mode 100644 index c763a1b4..00000000 --- a/src/libnacl/cpucycles/powerpccpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles powerpccpuinfo.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_powerpccpuinfo_h -#define CPUCYCLES_powerpccpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_powerpccpuinfo(void); -extern long long cpucycles_powerpccpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "powerpccpuinfo" -#define cpucycles cpucycles_powerpccpuinfo -#define cpucycles_persecond cpucycles_powerpccpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/powerpcmacos.c b/src/libnacl/cpucycles/powerpcmacos.c deleted file mode 100644 index f855b276..00000000 --- a/src/libnacl/cpucycles/powerpcmacos.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -#define timebase mach_absolute_time - -static int cpumib[2] = { CTL_HW, HW_CPU_FREQ } ; -static int tbmib[2] = { CTL_HW, HW_TB_FREQ } ; - -static long myround(double u) -{ - long result = u; - while (result + 0.5 < u) result += 1; - while (result - 0.5 > u) result -= 1; - return result; -} - -static long tbcycles = 0; - -static void init(void) -{ - unsigned int cpufrequency = 0; size_t cpufrequencylen = sizeof(unsigned int); - unsigned int tbfrequency = 0; size_t tbfrequencylen = sizeof(unsigned int); - sysctl(cpumib,2,&cpufrequency,&cpufrequencylen,0,0); - sysctl(tbmib,2,&tbfrequency,&tbfrequencylen,0,0); - if (tbfrequency > 0) - tbcycles = myround((double) (unsigned long long) cpufrequency - / (double) (unsigned long long) tbfrequency); -} - -long long cpucycles_powerpcmacos(void) -{ - if (!tbcycles) init(); - return timebase() * tbcycles; -} - -long long cpucycles_powerpcmacos_persecond(void) -{ - unsigned int result = 0; size_t resultlen = sizeof(unsigned int); - sysctl(cpumib,2,&result,&resultlen,0,0); - return (unsigned long long) result; -} diff --git a/src/libnacl/cpucycles/powerpcmacos.h b/src/libnacl/cpucycles/powerpcmacos.h deleted file mode 100644 index f66c0e36..00000000 --- a/src/libnacl/cpucycles/powerpcmacos.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles powerpcmacos.h version 20060319 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_powerpcmacos_h -#define CPUCYCLES_powerpcmacos_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_powerpcmacos(void); -extern long long cpucycles_powerpcmacos_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "powerpcmacos" -#define cpucycles cpucycles_powerpcmacos -#define cpucycles_persecond cpucycles_powerpcmacos_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/sgi.c b/src/libnacl/cpucycles/sgi.c deleted file mode 100644 index c0e731f6..00000000 --- a/src/libnacl/cpucycles/sgi.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -static double cpufrequency = 0; - -static void init(void) -{ - FILE *f; - - f = popen("hinv -c processor | awk '{if ($3==\"MHZ\") print $2*1000000}'","r"); - if (!f) return; - if (fscanf(f,"%lf",&cpufrequency) < 1) cpufrequency = 0; - pclose(f); - if (!cpufrequency) return; -} - -long long cpucycles_sgi(void) -{ - double result; - struct timespec t; - if (!cpufrequency) init(); - clock_gettime(CLOCK_SGI_CYCLE,&t); - result = t.tv_nsec; - result *= 0.000000001; - result += (double) t.tv_sec; - result *= cpufrequency; - return result; -} - -long long cpucycles_sgi_persecond(void) -{ - if (!cpufrequency) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/sgi.h b/src/libnacl/cpucycles/sgi.h deleted file mode 100644 index 56bad976..00000000 --- a/src/libnacl/cpucycles/sgi.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles sgi.h version 20070916 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_sgi_h -#define CPUCYCLES_sgi_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_sgi(void); -extern long long cpucycles_sgi_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "sgi" -#define cpucycles cpucycles_sgi -#define cpucycles_persecond cpucycles_sgi_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/sparc32cpuinfo.c b/src/libnacl/cpucycles/sparc32cpuinfo.c deleted file mode 100644 index 1fc53d06..00000000 --- a/src/libnacl/cpucycles/sparc32cpuinfo.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include "osfreq.c" - -long long cpucycles_sparc32cpuinfo(void) -{ - long long result; - asm volatile(".word 2202075136; .word 2570088480; srl %%g1,0,%L0; mov %%o4,%H0" - : "=r" (result) : : "g1","o4"); - return result; -} - -long long cpucycles_sparc32cpuinfo_persecond(void) -{ - return osfreq(); -} diff --git a/src/libnacl/cpucycles/sparc32cpuinfo.h b/src/libnacl/cpucycles/sparc32cpuinfo.h deleted file mode 100644 index 9d39dc65..00000000 --- a/src/libnacl/cpucycles/sparc32cpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles sparc32cpuinfo.h version 20100804 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_sparc32cpuinfo_h -#define CPUCYCLES_sparc32cpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_sparc32cpuinfo(void); -extern long long cpucycles_sparc32cpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "sparc32cpuinfo" -#define cpucycles cpucycles_sparc32cpuinfo -#define cpucycles_persecond cpucycles_sparc32cpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/sparccpuinfo.c b/src/libnacl/cpucycles/sparccpuinfo.c deleted file mode 100644 index d07aafec..00000000 --- a/src/libnacl/cpucycles/sparccpuinfo.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "osfreq.c" - -long long cpucycles_sparccpuinfo(void) -{ - long long result; - asm volatile("rd %%tick,%0" : "=r" (result)); - return result; -} - -long long cpucycles_sparccpuinfo_persecond(void) -{ - return osfreq(); -} diff --git a/src/libnacl/cpucycles/sparccpuinfo.h b/src/libnacl/cpucycles/sparccpuinfo.h deleted file mode 100644 index badb2144..00000000 --- a/src/libnacl/cpucycles/sparccpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles sparccpuinfo.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_sparccpuinfo_h -#define CPUCYCLES_sparccpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_sparccpuinfo(void); -extern long long cpucycles_sparccpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "sparccpuinfo" -#define cpucycles cpucycles_sparccpuinfo -#define cpucycles_persecond cpucycles_sparccpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/test.c b/src/libnacl/cpucycles/test.c deleted file mode 100644 index 30a37230..00000000 --- a/src/libnacl/cpucycles/test.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include -#include -#include "cpucycles-impl.h" - -static long long tod(void) -{ - struct timeval t; - gettimeofday(&t,(struct timezone *) 0); - return t.tv_sec * (long long) 1000000 + t.tv_usec; -} - -long long todstart; -long long todend; -long long cpustart; -long long cpuend; - -long long cyclespersecond; -long long cyclespertod; - -long long t[1001]; - -int main() -{ - return 0; -} diff --git a/src/libnacl/cpucycles/x86cpuinfo.c b/src/libnacl/cpucycles/x86cpuinfo.c deleted file mode 100644 index 3fb0a1b0..00000000 --- a/src/libnacl/cpucycles/x86cpuinfo.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "osfreq.c" - -long long cpucycles_x86cpuinfo(void) -{ - long long result; - asm volatile(".byte 15;.byte 49" : "=A" (result)); - return result; -} - -long long cpucycles_x86cpuinfo_persecond(void) -{ - return osfreq(); -} diff --git a/src/libnacl/cpucycles/x86cpuinfo.h b/src/libnacl/cpucycles/x86cpuinfo.h deleted file mode 100644 index 88f151dd..00000000 --- a/src/libnacl/cpucycles/x86cpuinfo.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles x86cpuinfo.h version 20100803 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_x86cpuinfo_h -#define CPUCYCLES_x86cpuinfo_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_x86cpuinfo(void); -extern long long cpucycles_x86cpuinfo_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "x86cpuinfo" -#define cpucycles cpucycles_x86cpuinfo -#define cpucycles_persecond cpucycles_x86cpuinfo_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/x86cpuspeed.c b/src/libnacl/cpucycles/x86cpuspeed.c deleted file mode 100644 index 34222565..00000000 --- a/src/libnacl/cpucycles/x86cpuspeed.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include -#include - -long long cpucycles_x86cpuspeed(void) -{ - long long result; - asm volatile(".byte 15;.byte 49" : "=A" (result)); - return result; -} - -long long cpucycles_x86cpuspeed_persecond(void) -{ - int oid[2]; - int val; - size_t size; - oid[0] = CTL_HW; - oid[1] = HW_CPUSPEED; - size = sizeof val; - if (sysctl(oid,2,&val,&size,0,0) == -1) return 0; - if (size != sizeof val) return 0; - return val * 1000000LL; -} diff --git a/src/libnacl/cpucycles/x86cpuspeed.h b/src/libnacl/cpucycles/x86cpuspeed.h deleted file mode 100644 index 43005cda..00000000 --- a/src/libnacl/cpucycles/x86cpuspeed.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles x86cpuspeed.h version 20090716 -Matthew Dempsky -Public domain. -*/ - -#ifndef CPUCYCLES_x86cpuspeed_h -#define CPUCYCLES_x86cpuspeed_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_x86cpuspeed(void); -extern long long cpucycles_x86cpuspeed_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "x86cpuspeed" -#define cpucycles cpucycles_x86cpuspeed -#define cpucycles_persecond cpucycles_x86cpuspeed_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/x86estimate.c b/src/libnacl/cpucycles/x86estimate.c deleted file mode 100644 index cd8e1c4b..00000000 --- a/src/libnacl/cpucycles/x86estimate.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include -#include - -long long cpucycles_x86estimate(void) -{ - long long result; - asm volatile(".byte 15;.byte 49" : "=A" (result)); - return result; -} - -static long long microseconds(void) -{ - struct timeval t; - gettimeofday(&t,(struct timezone *) 0); - return t.tv_sec * (long long) 1000000 + t.tv_usec; -} - -static double guessfreq(void) -{ - long long tb0; long long us0; - long long tb1; long long us1; - - tb0 = cpucycles_x86estimate(); - us0 = microseconds(); - do { - tb1 = cpucycles_x86estimate(); - us1 = microseconds(); - } while (us1 - us0 < 10000 || tb1 - tb0 < 1000); - if (tb1 <= tb0) return 0; - tb1 -= tb0; - us1 -= us0; - return ((double) tb1) / (0.000001 * (double) us1); -} - -static double cpufrequency = 0; - -static void init(void) -{ - double guess1; - double guess2; - int loop; - - for (loop = 0;loop < 100;++loop) { - guess1 = guessfreq(); - guess2 = guessfreq(); - if (guess1 > 1.01 * guess2) continue; - if (guess2 > 1.01 * guess1) continue; - cpufrequency = 0.5 * (guess1 + guess2); - break; - } -} - -long long cpucycles_x86estimate_persecond(void) -{ - if (!cpufrequency) init(); - return cpufrequency; -} diff --git a/src/libnacl/cpucycles/x86estimate.h b/src/libnacl/cpucycles/x86estimate.h deleted file mode 100644 index 98f2dd15..00000000 --- a/src/libnacl/cpucycles/x86estimate.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles x86estimate.h version 20070121 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_x86estimate_h -#define CPUCYCLES_x86estimate_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_x86estimate(void); -extern long long cpucycles_x86estimate_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "x86estimate" -#define cpucycles cpucycles_x86estimate -#define cpucycles_persecond cpucycles_x86estimate_persecond -#endif - -#endif diff --git a/src/libnacl/cpucycles/x86tscfreq.c b/src/libnacl/cpucycles/x86tscfreq.c deleted file mode 100644 index 400da941..00000000 --- a/src/libnacl/cpucycles/x86tscfreq.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include - -long long cpucycles_x86tscfreq(void) -{ - long long result; - asm volatile(".byte 15;.byte 49" : "=A" (result)); - return result; -} - -long long cpucycles_x86tscfreq_persecond(void) -{ - long result = 0; - size_t resultlen = sizeof(long); - sysctlbyname("machdep.tsc_freq",&result,&resultlen,0,0); - return result; -} diff --git a/src/libnacl/cpucycles/x86tscfreq.h b/src/libnacl/cpucycles/x86tscfreq.h deleted file mode 100644 index abf616e5..00000000 --- a/src/libnacl/cpucycles/x86tscfreq.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -cpucycles x86tscfreq.h version 20060318 -D. J. Bernstein -Public domain. -*/ - -#ifndef CPUCYCLES_x86tscfreq_h -#define CPUCYCLES_x86tscfreq_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern long long cpucycles_x86tscfreq(void); -extern long long cpucycles_x86tscfreq_persecond(void); - -#ifdef __cplusplus -} -#endif - -#ifndef cpucycles_implementation -#define cpucycles_implementation "x86tscfreq" -#define cpucycles cpucycles_x86tscfreq -#define cpucycles_persecond cpucycles_x86tscfreq_persecond -#endif - -#endif diff --git a/src/libnacl/cpuid/cbytes.c b/src/libnacl/cpuid/cbytes.c deleted file mode 100644 index bd5d1444..00000000 --- a/src/libnacl/cpuid/cbytes.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int main() -{ - char ch; - int loop = 0; - while (scanf("%c",&ch) == 1) { - printf("0x%02x,",255 & (int) ch); - if (++loop == 16) { - loop = 0; - printf("\n"); - } - } - printf("0x00\n"); - return 0; -} diff --git a/src/libnacl/cpuid/cpuid.c b/src/libnacl/cpuid/cpuid.c deleted file mode 100644 index 1a5c6b8e..00000000 --- a/src/libnacl/cpuid/cpuid.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -#include - -void nope() -{ - exit(1); -} - -int main() -{ - unsigned long x[4]; - unsigned long y[4]; - int i; - int j; - char c; - - signal(SIGILL,nope); - - x[0] = 0; - x[1] = 0; - x[2] = 0; - x[3] = 0; - - asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) ); - if (!x[0]) return 0; - asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) ); - - for (i = 1;i < 4;++i) - for (j = 0;j < 4;++j) { - c = x[i] >> (8 * j); - if (c < 32) c = 32; - if (c > 126) c = 126; - putchar(c); - } - - printf("-%08x-%08x\n",y[0],y[3]); - - return 0; -} diff --git a/src/libnacl/cpuid/do b/src/libnacl/cpuid/do deleted file mode 100755 index 8a3a6f7b..00000000 --- a/src/libnacl/cpuid/do +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -e - -mkdir include - -( - echo x86 - echo unknown -) | ( - while read n - do - okabi | ( - while read abi - do - okc-$abi | ( - while read c - do - echo "=== `date` === Trying $n.c with $c..." >&2 - rm -f cpuid.c - cp $n.c cpuid.c || continue - $c -o cpuid cpuid.c || continue - $c -o cbytes cbytes.c || continue - ./cpuid > cpuid.out || continue - echo 'static const char cpuid[] = {' > cpuid.h || continue - ./cbytes < cpuid.out >> cpuid.h || continue - echo '} ;' >> cpuid.h || continue - cp cpuid.h include/cpuid.h || continue - cat cpuid.out - exit 0 - done - exit 111 - ) && exit 0 - done - exit 111 - ) && exit 0 - done - exit 111 -) diff --git a/src/libnacl/cpuid/unknown.c b/src/libnacl/cpuid/unknown.c deleted file mode 100644 index 786a5e72..00000000 --- a/src/libnacl/cpuid/unknown.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -main() -{ - printf("unknown CPU ID\n"); - return 0; -} diff --git a/src/libnacl/cpuid/x86.c b/src/libnacl/cpuid/x86.c deleted file mode 100644 index 99e6a0c4..00000000 --- a/src/libnacl/cpuid/x86.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -#include - -void nope() -{ - exit(1); -} - -int main() -{ - unsigned long x[4]; - unsigned long y[4]; - int i; - int j; - char c; - - signal(SIGILL,nope); - - x[0] = 0; - x[1] = 0; - x[2] = 0; - x[3] = 0; - - asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) ); - if (!x[0]) return 0; - asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) ); - - for (i = 1;i < 4;++i) - for (j = 0;j < 4;++j) { - c = x[i] >> (8 * j); - if (c < 32) c = 32; - if (c > 126) c = 126; - putchar(c); - } - - printf("-%08x-%08x\n",(unsigned int) y[0],(unsigned int) y[3]); - - return 0; -} diff --git a/src/libnacl/crypto_auth/hmacsha256/used b/src/libnacl/crypto_auth/hmacsha256/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_auth/hmacsha512256/selected b/src/libnacl/crypto_auth/hmacsha512256/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_auth/hmacsha512256/used b/src/libnacl/crypto_auth/hmacsha512256/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/selected b/src/libnacl/crypto_box/curve25519xsalsa20poly1305/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_box/curve25519xsalsa20poly1305/used b/src/libnacl/crypto_box/curve25519xsalsa20poly1305/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_core/hsalsa20/used b/src/libnacl/crypto_core/hsalsa20/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_core/measure.c b/src/libnacl/crypto_core/measure.c deleted file mode 100644 index dd7bac81..00000000 --- a/src/libnacl/crypto_core/measure.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "crypto_core.h" - -const char *primitiveimplementation = crypto_core_IMPLEMENTATION; -const char *implementationversion = crypto_core_VERSION; -const char *sizenames[] = { "outputbytes", "inputbytes", "keybytes", "constbytes", 0 }; -const long long sizes[] = { crypto_core_OUTPUTBYTES, crypto_core_INPUTBYTES, crypto_core_KEYBYTES, crypto_core_CONSTBYTES }; - -void preallocate(void) -{ -} - -void allocate(void) -{ -} - -void measure(void) -{ -} diff --git a/src/libnacl/crypto_core/salsa20/used b/src/libnacl/crypto_core/salsa20/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_core/salsa2012/used b/src/libnacl/crypto_core/salsa2012/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_core/salsa208/used b/src/libnacl/crypto_core/salsa208/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_core/try.c b/src/libnacl/crypto_core/try.c deleted file mode 100644 index 6f5534e7..00000000 --- a/src/libnacl/crypto_core/try.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * crypto_core/try.c version 20090118 - * D. J. Bernstein - * Public domain. - */ - -#include -#include "crypto_core.h" -#include "windows/windows-quirks.h" - -extern unsigned char *alignedcalloc(unsigned long long); - -const char *primitiveimplementation = crypto_core_IMPLEMENTATION; - -static unsigned char *h; -static unsigned char *n; -static unsigned char *k; -static unsigned char *c; -static unsigned char *h2; -static unsigned char *n2; -static unsigned char *k2; -static unsigned char *c2; - -#define hlen crypto_core_OUTPUTBYTES -#define nlen crypto_core_INPUTBYTES -#define klen crypto_core_KEYBYTES -#define clen crypto_core_CONSTBYTES - -void preallocate(void) -{ -} - -void allocate(void) -{ - h = alignedcalloc(hlen); - n = alignedcalloc(nlen); - k = alignedcalloc(klen); - c = alignedcalloc(clen); - h2 = alignedcalloc(hlen); - n2 = alignedcalloc(nlen + crypto_core_OUTPUTBYTES); - k2 = alignedcalloc(klen + crypto_core_OUTPUTBYTES); - c2 = alignedcalloc(clen + crypto_core_OUTPUTBYTES); -} - -void predoit(void) -{ -} - -void doit(void) -{ - crypto_core(h,n,k,c); -} - -static unsigned char newbyte(void) -{ - unsigned long long x; - long long j; - x = 8675309; - for (j = 0;j < hlen;++j) { x += h[j]; x *= x; x += (x >> 31); } - for (j = 0;j < nlen;++j) { x += n[j]; x *= x; x += (x >> 31); } - for (j = 0;j < klen;++j) { x += k[j]; x *= x; x += (x >> 31); } - for (j = 0;j < clen;++j) { x += c[j]; x *= x; x += (x >> 31); } - for (j = 0;j < 100;++j) { x += j ; x *= x; x += (x >> 31); } - return x; -} - -char checksum[hlen * 2 + 1]; - -const char *checksum_compute(void) -{ - long long i; - long long j; - - for (i = 0;i < 100;++i) { - for (j = -16;j < 0;++j) h[j] = random(); - for (j = hlen;j < hlen + 16;++j) h[j] = random(); - for (j = -16;j < hlen + 16;++j) h2[j] = h[j]; - for (j = -16;j < 0;++j) n[j] = random(); - for (j = nlen;j < nlen + 16;++j) n[j] = random(); - for (j = -16;j < nlen + 16;++j) n2[j] = n[j]; - for (j = -16;j < 0;++j) k[j] = random(); - for (j = klen;j < klen + 16;++j) k[j] = random(); - for (j = -16;j < klen + 16;++j) k2[j] = k[j]; - for (j = -16;j < 0;++j) c[j] = random(); - for (j = clen;j < clen + 16;++j) c[j] = random(); - for (j = -16;j < clen + 16;++j) c2[j] = c[j]; - if (crypto_core(h,n,k,c) != 0) return "crypto_core returns nonzero"; - for (j = -16;j < 0;++j) if (h2[j] != h[j]) return "crypto_core writes before output"; - for (j = hlen;j < hlen + 16;++j) if (h2[j] != h[j]) return "crypto_core writes after output"; - for (j = -16;j < klen + 16;++j) if (k2[j] != k[j]) return "crypto_core writes to k"; - for (j = -16;j < nlen + 16;++j) if (n2[j] != n[j]) return "crypto_core writes to n"; - for (j = -16;j < clen + 16;++j) if (c2[j] != c[j]) return "crypto_core writes to c"; - - if (crypto_core(n2,n2,k,c) != 0) return "crypto_core returns nonzero"; - for (j = 0;j < hlen;++j) if (h[j] != n2[j]) return "crypto_core does not handle n overlap"; - for (j = 0;j < hlen;++j) n2[j] = n[j]; - if (crypto_core(k2,n2,k2,c) != 0) return "crypto_core returns nonzero"; - for (j = 0;j < hlen;++j) if (h[j] != k2[j]) return "crypto_core does not handle k overlap"; - for (j = 0;j < hlen;++j) k2[j] = k[j]; - if (crypto_core(c2,n2,k2,c2) != 0) return "crypto_core returns nonzero"; - for (j = 0;j < hlen;++j) if (h[j] != c2[j]) return "crypto_core does not handle c overlap"; - for (j = 0;j < hlen;++j) c2[j] = c[j]; - - for (j = 0;j < nlen;++j) n[j] = newbyte(); - if (crypto_core(h,n,k,c) != 0) return "crypto_core returns nonzero"; - for (j = 0;j < klen;++j) k[j] = newbyte(); - if (crypto_core(h,n,k,c) != 0) return "crypto_core returns nonzero"; - for (j = 0;j < clen;++j) c[j] = newbyte(); - } - - for (i = 0;i < hlen;++i) { - checksum[2 * i] = "0123456789abcdef"[15 & (h[i] >> 4)]; - checksum[2 * i + 1] = "0123456789abcdef"[15 & h[i]]; - } - checksum[2 * i] = 0; - return 0; -} diff --git a/src/libnacl/crypto_hash/sha256/used b/src/libnacl/crypto_hash/sha256/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_hash/sha512/selected b/src/libnacl/crypto_hash/sha512/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_hash/sha512/used b/src/libnacl/crypto_hash/sha512/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_hashblocks/sha256/used b/src/libnacl/crypto_hashblocks/sha256/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_hashblocks/sha512/selected b/src/libnacl/crypto_hashblocks/sha512/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_hashblocks/sha512/used b/src/libnacl/crypto_hashblocks/sha512/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_onetimeauth/poly1305/53/auth.c b/src/libnacl/crypto_onetimeauth/poly1305/53/auth.c deleted file mode 100644 index a4a9c3f6..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/53/auth.c +++ /dev/null @@ -1,1616 +0,0 @@ -/* -20080910 -D. J. Bernstein -Public domain. -*/ - -#include "crypto_onetimeauth.h" - -typedef unsigned char uchar; -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; - -static const double poly1305_53_constants[] = { - 0.00000000558793544769287109375 /* alpham80 = 3 2^(-29) */ -, 24.0 /* alpham48 = 3 2^3 */ -, 103079215104.0 /* alpham16 = 3 2^35 */ -, 6755399441055744.0 /* alpha0 = 3 2^51 */ -, 1770887431076116955136.0 /* alpha18 = 3 2^69 */ -, 29014219670751100192948224.0 /* alpha32 = 3 2^83 */ -, 7605903601369376408980219232256.0 /* alpha50 = 3 2^101 */ -, 124615124604835863084731911901282304.0 /* alpha64 = 3 2^115 */ -, 32667107224410092492483962313449748299776.0 /* alpha82 = 3 2^133 */ -, 535217884764734955396857238543560676143529984.0 /* alpha96 = 3 2^147 */ -, 35076039295941670036888435985190792471742381031424.0 /* alpha112 = 3 2^163 */ -, 9194973245195333150150082162901855101712434733101613056.0 /* alpha130 = 3 2^181 */ -, 0.0000000000000000000000000000000000000036734198463196484624023016788195177431833298649127735047148490821200539357960224151611328125 /* scale = 5 2^(-130) */ -, 6755408030990331.0 /* offset0 = alpha0 + 2^33 - 5 */ -, 29014256564239239022116864.0 /* offset1 = alpha32 + 2^65 - 2^33 */ -, 124615283061160854719918951570079744.0 /* offset2 = alpha64 + 2^97 - 2^65 */ -, 535219245894202480694386063513315216128475136.0 /* offset3 = alpha96 + 2^130 - 2^97 */ -} ; - -int crypto_onetimeauth(unsigned char *out,const unsigned char *m,unsigned long long l,const unsigned char *k) -{ - register const unsigned char *r = k; - register const unsigned char *s = k + 16; - double r0high_stack; - double r1high_stack; - double r1low_stack; - double sr1high_stack; - double r2low_stack; - double sr2high_stack; - double r0low_stack; - double sr1low_stack; - double r2high_stack; - double sr2low_stack; - double r3high_stack; - double sr3high_stack; - double r3low_stack; - double sr3low_stack; - int64 d0; - int64 d1; - int64 d2; - int64 d3; - register double scale; - register double alpha0; - register double alpha32; - register double alpha64; - register double alpha96; - register double alpha130; - register double h0; - register double h1; - register double h2; - register double h3; - register double h4; - register double h5; - register double h6; - register double h7; - register double y7; - register double y6; - register double y1; - register double y0; - register double y5; - register double y4; - register double x7; - register double x6; - register double x1; - register double x0; - register double y3; - register double y2; - register double r3low; - register double r0low; - register double r3high; - register double r0high; - register double sr1low; - register double x5; - register double r3lowx0; - register double sr1high; - register double x4; - register double r0lowx6; - register double r1low; - register double x3; - register double r3highx0; - register double r1high; - register double x2; - register double r0highx6; - register double sr2low; - register double r0lowx0; - register double sr2high; - register double sr1lowx6; - register double r2low; - register double r0highx0; - register double r2high; - register double sr1highx6; - register double sr3low; - register double r1lowx0; - register double sr3high; - register double sr2lowx6; - register double r1highx0; - register double sr2highx6; - register double r2lowx0; - register double sr3lowx6; - register double r2highx0; - register double sr3highx6; - register double r1highx4; - register double r1lowx4; - register double r0highx4; - register double r0lowx4; - register double sr3highx4; - register double sr3lowx4; - register double sr2highx4; - register double sr2lowx4; - register double r0lowx2; - register double r0highx2; - register double r1lowx2; - register double r1highx2; - register double r2lowx2; - register double r2highx2; - register double sr3lowx2; - register double sr3highx2; - register double z0; - register double z1; - register double z2; - register double z3; - register int64 r0; - register int64 r1; - register int64 r2; - register int64 r3; - register uint32 r00; - register uint32 r01; - register uint32 r02; - register uint32 r03; - register uint32 r10; - register uint32 r11; - register uint32 r12; - register uint32 r13; - register uint32 r20; - register uint32 r21; - register uint32 r22; - register uint32 r23; - register uint32 r30; - register uint32 r31; - register uint32 r32; - register uint32 r33; - register int64 m0; - register int64 m1; - register int64 m2; - register int64 m3; - register uint32 m00; - register uint32 m01; - register uint32 m02; - register uint32 m03; - register uint32 m10; - register uint32 m11; - register uint32 m12; - register uint32 m13; - register uint32 m20; - register uint32 m21; - register uint32 m22; - register uint32 m23; - register uint32 m30; - register uint32 m31; - register uint32 m32; - register uint64 m33; - register char *constants; - register int32 lbelow2; - register int32 lbelow3; - register int32 lbelow4; - register int32 lbelow5; - register int32 lbelow6; - register int32 lbelow7; - register int32 lbelow8; - register int32 lbelow9; - register int32 lbelow10; - register int32 lbelow11; - register int32 lbelow12; - register int32 lbelow13; - register int32 lbelow14; - register int32 lbelow15; - register double alpham80; - register double alpham48; - register double alpham16; - register double alpha18; - register double alpha50; - register double alpha82; - register double alpha112; - register double offset0; - register double offset1; - register double offset2; - register double offset3; - register uint32 s00; - register uint32 s01; - register uint32 s02; - register uint32 s03; - register uint32 s10; - register uint32 s11; - register uint32 s12; - register uint32 s13; - register uint32 s20; - register uint32 s21; - register uint32 s22; - register uint32 s23; - register uint32 s30; - register uint32 s31; - register uint32 s32; - register uint32 s33; - register uint64 bits32; - register uint64 f; - register uint64 f0; - register uint64 f1; - register uint64 f2; - register uint64 f3; - register uint64 f4; - register uint64 g; - register uint64 g0; - register uint64 g1; - register uint64 g2; - register uint64 g3; - register uint64 g4; - - r00 = *(uchar *) (r + 0); - constants = (char *) &poly1305_53_constants; - - r01 = *(uchar *) (r + 1); - - r02 = *(uchar *) (r + 2); - r0 = 2151; - - r03 = *(uchar *) (r + 3); r03 &= 15; - r0 <<= 51; - - r10 = *(uchar *) (r + 4); r10 &= 252; - r01 <<= 8; - r0 += r00; - - r11 = *(uchar *) (r + 5); - r02 <<= 16; - r0 += r01; - - r12 = *(uchar *) (r + 6); - r03 <<= 24; - r0 += r02; - - r13 = *(uchar *) (r + 7); r13 &= 15; - r1 = 2215; - r0 += r03; - - d0 = r0; - r1 <<= 51; - r2 = 2279; - - r20 = *(uchar *) (r + 8); r20 &= 252; - r11 <<= 8; - r1 += r10; - - r21 = *(uchar *) (r + 9); - r12 <<= 16; - r1 += r11; - - r22 = *(uchar *) (r + 10); - r13 <<= 24; - r1 += r12; - - r23 = *(uchar *) (r + 11); r23 &= 15; - r2 <<= 51; - r1 += r13; - - d1 = r1; - r21 <<= 8; - r2 += r20; - - r30 = *(uchar *) (r + 12); r30 &= 252; - r22 <<= 16; - r2 += r21; - - r31 = *(uchar *) (r + 13); - r23 <<= 24; - r2 += r22; - - r32 = *(uchar *) (r + 14); - r2 += r23; - r3 = 2343; - - d2 = r2; - r3 <<= 51; - alpha32 = *(double *) (constants + 40); - - r33 = *(uchar *) (r + 15); r33 &= 15; - r31 <<= 8; - r3 += r30; - - r32 <<= 16; - r3 += r31; - - r33 <<= 24; - r3 += r32; - - r3 += r33; - h0 = alpha32 - alpha32; - - d3 = r3; - h1 = alpha32 - alpha32; - - alpha0 = *(double *) (constants + 24); - h2 = alpha32 - alpha32; - - alpha64 = *(double *) (constants + 56); - h3 = alpha32 - alpha32; - - alpha18 = *(double *) (constants + 32); - h4 = alpha32 - alpha32; - - r0low = *(double *) &d0; - h5 = alpha32 - alpha32; - - r1low = *(double *) &d1; - h6 = alpha32 - alpha32; - - r2low = *(double *) &d2; - h7 = alpha32 - alpha32; - - alpha50 = *(double *) (constants + 48); - r0low -= alpha0; - - alpha82 = *(double *) (constants + 64); - r1low -= alpha32; - - scale = *(double *) (constants + 96); - r2low -= alpha64; - - alpha96 = *(double *) (constants + 72); - r0high = r0low + alpha18; - - r3low = *(double *) &d3; - - alpham80 = *(double *) (constants + 0); - r1high = r1low + alpha50; - sr1low = scale * r1low; - - alpham48 = *(double *) (constants + 8); - r2high = r2low + alpha82; - sr2low = scale * r2low; - - r0high -= alpha18; - r0high_stack = r0high; - - r3low -= alpha96; - - r1high -= alpha50; - r1high_stack = r1high; - - sr1high = sr1low + alpham80; - - alpha112 = *(double *) (constants + 80); - r0low -= r0high; - - alpham16 = *(double *) (constants + 16); - r2high -= alpha82; - sr3low = scale * r3low; - - alpha130 = *(double *) (constants + 88); - sr2high = sr2low + alpham48; - - r1low -= r1high; - r1low_stack = r1low; - - sr1high -= alpham80; - sr1high_stack = sr1high; - - r2low -= r2high; - r2low_stack = r2low; - - sr2high -= alpham48; - sr2high_stack = sr2high; - - r3high = r3low + alpha112; - r0low_stack = r0low; - - sr1low -= sr1high; - sr1low_stack = sr1low; - - sr3high = sr3low + alpham16; - r2high_stack = r2high; - - sr2low -= sr2high; - sr2low_stack = sr2low; - - r3high -= alpha112; - r3high_stack = r3high; - - - sr3high -= alpham16; - sr3high_stack = sr3high; - - - r3low -= r3high; - r3low_stack = r3low; - - - sr3low -= sr3high; - sr3low_stack = sr3low; - -if (l < 16) goto addatmost15bytes; - - m00 = *(uchar *) (m + 0); - m0 = 2151; - - m0 <<= 51; - m1 = 2215; - m01 = *(uchar *) (m + 1); - - m1 <<= 51; - m2 = 2279; - m02 = *(uchar *) (m + 2); - - m2 <<= 51; - m3 = 2343; - m03 = *(uchar *) (m + 3); - - m10 = *(uchar *) (m + 4); - m01 <<= 8; - m0 += m00; - - m11 = *(uchar *) (m + 5); - m02 <<= 16; - m0 += m01; - - m12 = *(uchar *) (m + 6); - m03 <<= 24; - m0 += m02; - - m13 = *(uchar *) (m + 7); - m3 <<= 51; - m0 += m03; - - m20 = *(uchar *) (m + 8); - m11 <<= 8; - m1 += m10; - - m21 = *(uchar *) (m + 9); - m12 <<= 16; - m1 += m11; - - m22 = *(uchar *) (m + 10); - m13 <<= 24; - m1 += m12; - - m23 = *(uchar *) (m + 11); - m1 += m13; - - m30 = *(uchar *) (m + 12); - m21 <<= 8; - m2 += m20; - - m31 = *(uchar *) (m + 13); - m22 <<= 16; - m2 += m21; - - m32 = *(uchar *) (m + 14); - m23 <<= 24; - m2 += m22; - - m33 = *(uchar *) (m + 15); - m2 += m23; - - d0 = m0; - m31 <<= 8; - m3 += m30; - - d1 = m1; - m32 <<= 16; - m3 += m31; - - d2 = m2; - m33 += 256; - - m33 <<= 24; - m3 += m32; - - m3 += m33; - d3 = m3; - - m += 16; - l -= 16; - - z0 = *(double *) &d0; - - z1 = *(double *) &d1; - - z2 = *(double *) &d2; - - z3 = *(double *) &d3; - - z0 -= alpha0; - - z1 -= alpha32; - - z2 -= alpha64; - - z3 -= alpha96; - - h0 += z0; - - h1 += z1; - - h3 += z2; - - h5 += z3; - -if (l < 16) goto multiplyaddatmost15bytes; - -multiplyaddatleast16bytes:; - - m2 = 2279; - m20 = *(uchar *) (m + 8); - y7 = h7 + alpha130; - - m2 <<= 51; - m3 = 2343; - m21 = *(uchar *) (m + 9); - y6 = h6 + alpha130; - - m3 <<= 51; - m0 = 2151; - m22 = *(uchar *) (m + 10); - y1 = h1 + alpha32; - - m0 <<= 51; - m1 = 2215; - m23 = *(uchar *) (m + 11); - y0 = h0 + alpha32; - - m1 <<= 51; - m30 = *(uchar *) (m + 12); - y7 -= alpha130; - - m21 <<= 8; - m2 += m20; - m31 = *(uchar *) (m + 13); - y6 -= alpha130; - - m22 <<= 16; - m2 += m21; - m32 = *(uchar *) (m + 14); - y1 -= alpha32; - - m23 <<= 24; - m2 += m22; - m33 = *(uchar *) (m + 15); - y0 -= alpha32; - - m2 += m23; - m00 = *(uchar *) (m + 0); - y5 = h5 + alpha96; - - m31 <<= 8; - m3 += m30; - m01 = *(uchar *) (m + 1); - y4 = h4 + alpha96; - - m32 <<= 16; - m02 = *(uchar *) (m + 2); - x7 = h7 - y7; - y7 *= scale; - - m33 += 256; - m03 = *(uchar *) (m + 3); - x6 = h6 - y6; - y6 *= scale; - - m33 <<= 24; - m3 += m31; - m10 = *(uchar *) (m + 4); - x1 = h1 - y1; - - m01 <<= 8; - m3 += m32; - m11 = *(uchar *) (m + 5); - x0 = h0 - y0; - - m3 += m33; - m0 += m00; - m12 = *(uchar *) (m + 6); - y5 -= alpha96; - - m02 <<= 16; - m0 += m01; - m13 = *(uchar *) (m + 7); - y4 -= alpha96; - - m03 <<= 24; - m0 += m02; - d2 = m2; - x1 += y7; - - m0 += m03; - d3 = m3; - x0 += y6; - - m11 <<= 8; - m1 += m10; - d0 = m0; - x7 += y5; - - m12 <<= 16; - m1 += m11; - x6 += y4; - - m13 <<= 24; - m1 += m12; - y3 = h3 + alpha64; - - m1 += m13; - d1 = m1; - y2 = h2 + alpha64; - - x0 += x1; - - x6 += x7; - - y3 -= alpha64; - r3low = r3low_stack; - - y2 -= alpha64; - r0low = r0low_stack; - - x5 = h5 - y5; - r3lowx0 = r3low * x0; - r3high = r3high_stack; - - x4 = h4 - y4; - r0lowx6 = r0low * x6; - r0high = r0high_stack; - - x3 = h3 - y3; - r3highx0 = r3high * x0; - sr1low = sr1low_stack; - - x2 = h2 - y2; - r0highx6 = r0high * x6; - sr1high = sr1high_stack; - - x5 += y3; - r0lowx0 = r0low * x0; - r1low = r1low_stack; - - h6 = r3lowx0 + r0lowx6; - sr1lowx6 = sr1low * x6; - r1high = r1high_stack; - - x4 += y2; - r0highx0 = r0high * x0; - sr2low = sr2low_stack; - - h7 = r3highx0 + r0highx6; - sr1highx6 = sr1high * x6; - sr2high = sr2high_stack; - - x3 += y1; - r1lowx0 = r1low * x0; - r2low = r2low_stack; - - h0 = r0lowx0 + sr1lowx6; - sr2lowx6 = sr2low * x6; - r2high = r2high_stack; - - x2 += y0; - r1highx0 = r1high * x0; - sr3low = sr3low_stack; - - h1 = r0highx0 + sr1highx6; - sr2highx6 = sr2high * x6; - sr3high = sr3high_stack; - - x4 += x5; - r2lowx0 = r2low * x0; - z2 = *(double *) &d2; - - h2 = r1lowx0 + sr2lowx6; - sr3lowx6 = sr3low * x6; - - x2 += x3; - r2highx0 = r2high * x0; - z3 = *(double *) &d3; - - h3 = r1highx0 + sr2highx6; - sr3highx6 = sr3high * x6; - - r1highx4 = r1high * x4; - z2 -= alpha64; - - h4 = r2lowx0 + sr3lowx6; - r1lowx4 = r1low * x4; - - r0highx4 = r0high * x4; - z3 -= alpha96; - - h5 = r2highx0 + sr3highx6; - r0lowx4 = r0low * x4; - - h7 += r1highx4; - sr3highx4 = sr3high * x4; - - h6 += r1lowx4; - sr3lowx4 = sr3low * x4; - - h5 += r0highx4; - sr2highx4 = sr2high * x4; - - h4 += r0lowx4; - sr2lowx4 = sr2low * x4; - - h3 += sr3highx4; - r0lowx2 = r0low * x2; - - h2 += sr3lowx4; - r0highx2 = r0high * x2; - - h1 += sr2highx4; - r1lowx2 = r1low * x2; - - h0 += sr2lowx4; - r1highx2 = r1high * x2; - - h2 += r0lowx2; - r2lowx2 = r2low * x2; - - h3 += r0highx2; - r2highx2 = r2high * x2; - - h4 += r1lowx2; - sr3lowx2 = sr3low * x2; - - h5 += r1highx2; - sr3highx2 = sr3high * x2; - alpha0 = *(double *) (constants + 24); - - m += 16; - h6 += r2lowx2; - - l -= 16; - h7 += r2highx2; - - z1 = *(double *) &d1; - h0 += sr3lowx2; - - z0 = *(double *) &d0; - h1 += sr3highx2; - - z1 -= alpha32; - - z0 -= alpha0; - - h5 += z3; - - h3 += z2; - - h1 += z1; - - h0 += z0; - -if (l >= 16) goto multiplyaddatleast16bytes; - -multiplyaddatmost15bytes:; - - y7 = h7 + alpha130; - - y6 = h6 + alpha130; - - y1 = h1 + alpha32; - - y0 = h0 + alpha32; - - y7 -= alpha130; - - y6 -= alpha130; - - y1 -= alpha32; - - y0 -= alpha32; - - y5 = h5 + alpha96; - - y4 = h4 + alpha96; - - x7 = h7 - y7; - y7 *= scale; - - x6 = h6 - y6; - y6 *= scale; - - x1 = h1 - y1; - - x0 = h0 - y0; - - y5 -= alpha96; - - y4 -= alpha96; - - x1 += y7; - - x0 += y6; - - x7 += y5; - - x6 += y4; - - y3 = h3 + alpha64; - - y2 = h2 + alpha64; - - x0 += x1; - - x6 += x7; - - y3 -= alpha64; - r3low = r3low_stack; - - y2 -= alpha64; - r0low = r0low_stack; - - x5 = h5 - y5; - r3lowx0 = r3low * x0; - r3high = r3high_stack; - - x4 = h4 - y4; - r0lowx6 = r0low * x6; - r0high = r0high_stack; - - x3 = h3 - y3; - r3highx0 = r3high * x0; - sr1low = sr1low_stack; - - x2 = h2 - y2; - r0highx6 = r0high * x6; - sr1high = sr1high_stack; - - x5 += y3; - r0lowx0 = r0low * x0; - r1low = r1low_stack; - - h6 = r3lowx0 + r0lowx6; - sr1lowx6 = sr1low * x6; - r1high = r1high_stack; - - x4 += y2; - r0highx0 = r0high * x0; - sr2low = sr2low_stack; - - h7 = r3highx0 + r0highx6; - sr1highx6 = sr1high * x6; - sr2high = sr2high_stack; - - x3 += y1; - r1lowx0 = r1low * x0; - r2low = r2low_stack; - - h0 = r0lowx0 + sr1lowx6; - sr2lowx6 = sr2low * x6; - r2high = r2high_stack; - - x2 += y0; - r1highx0 = r1high * x0; - sr3low = sr3low_stack; - - h1 = r0highx0 + sr1highx6; - sr2highx6 = sr2high * x6; - sr3high = sr3high_stack; - - x4 += x5; - r2lowx0 = r2low * x0; - - h2 = r1lowx0 + sr2lowx6; - sr3lowx6 = sr3low * x6; - - x2 += x3; - r2highx0 = r2high * x0; - - h3 = r1highx0 + sr2highx6; - sr3highx6 = sr3high * x6; - - r1highx4 = r1high * x4; - - h4 = r2lowx0 + sr3lowx6; - r1lowx4 = r1low * x4; - - r0highx4 = r0high * x4; - - h5 = r2highx0 + sr3highx6; - r0lowx4 = r0low * x4; - - h7 += r1highx4; - sr3highx4 = sr3high * x4; - - h6 += r1lowx4; - sr3lowx4 = sr3low * x4; - - h5 += r0highx4; - sr2highx4 = sr2high * x4; - - h4 += r0lowx4; - sr2lowx4 = sr2low * x4; - - h3 += sr3highx4; - r0lowx2 = r0low * x2; - - h2 += sr3lowx4; - r0highx2 = r0high * x2; - - h1 += sr2highx4; - r1lowx2 = r1low * x2; - - h0 += sr2lowx4; - r1highx2 = r1high * x2; - - h2 += r0lowx2; - r2lowx2 = r2low * x2; - - h3 += r0highx2; - r2highx2 = r2high * x2; - - h4 += r1lowx2; - sr3lowx2 = sr3low * x2; - - h5 += r1highx2; - sr3highx2 = sr3high * x2; - - h6 += r2lowx2; - - h7 += r2highx2; - - h0 += sr3lowx2; - - h1 += sr3highx2; - -addatmost15bytes:; - -if (l == 0) goto nomorebytes; - - lbelow2 = l - 2; - - lbelow3 = l - 3; - - lbelow2 >>= 31; - lbelow4 = l - 4; - - m00 = *(uchar *) (m + 0); - lbelow3 >>= 31; - m += lbelow2; - - m01 = *(uchar *) (m + 1); - lbelow4 >>= 31; - m += lbelow3; - - m02 = *(uchar *) (m + 2); - m += lbelow4; - m0 = 2151; - - m03 = *(uchar *) (m + 3); - m0 <<= 51; - m1 = 2215; - - m0 += m00; - m01 &= ~lbelow2; - - m02 &= ~lbelow3; - m01 -= lbelow2; - - m01 <<= 8; - m03 &= ~lbelow4; - - m0 += m01; - lbelow2 -= lbelow3; - - m02 += lbelow2; - lbelow3 -= lbelow4; - - m02 <<= 16; - m03 += lbelow3; - - m03 <<= 24; - m0 += m02; - - m0 += m03; - lbelow5 = l - 5; - - lbelow6 = l - 6; - lbelow7 = l - 7; - - lbelow5 >>= 31; - lbelow8 = l - 8; - - lbelow6 >>= 31; - m += lbelow5; - - m10 = *(uchar *) (m + 4); - lbelow7 >>= 31; - m += lbelow6; - - m11 = *(uchar *) (m + 5); - lbelow8 >>= 31; - m += lbelow7; - - m12 = *(uchar *) (m + 6); - m1 <<= 51; - m += lbelow8; - - m13 = *(uchar *) (m + 7); - m10 &= ~lbelow5; - lbelow4 -= lbelow5; - - m10 += lbelow4; - lbelow5 -= lbelow6; - - m11 &= ~lbelow6; - m11 += lbelow5; - - m11 <<= 8; - m1 += m10; - - m1 += m11; - m12 &= ~lbelow7; - - lbelow6 -= lbelow7; - m13 &= ~lbelow8; - - m12 += lbelow6; - lbelow7 -= lbelow8; - - m12 <<= 16; - m13 += lbelow7; - - m13 <<= 24; - m1 += m12; - - m1 += m13; - m2 = 2279; - - lbelow9 = l - 9; - m3 = 2343; - - lbelow10 = l - 10; - lbelow11 = l - 11; - - lbelow9 >>= 31; - lbelow12 = l - 12; - - lbelow10 >>= 31; - m += lbelow9; - - m20 = *(uchar *) (m + 8); - lbelow11 >>= 31; - m += lbelow10; - - m21 = *(uchar *) (m + 9); - lbelow12 >>= 31; - m += lbelow11; - - m22 = *(uchar *) (m + 10); - m2 <<= 51; - m += lbelow12; - - m23 = *(uchar *) (m + 11); - m20 &= ~lbelow9; - lbelow8 -= lbelow9; - - m20 += lbelow8; - lbelow9 -= lbelow10; - - m21 &= ~lbelow10; - m21 += lbelow9; - - m21 <<= 8; - m2 += m20; - - m2 += m21; - m22 &= ~lbelow11; - - lbelow10 -= lbelow11; - m23 &= ~lbelow12; - - m22 += lbelow10; - lbelow11 -= lbelow12; - - m22 <<= 16; - m23 += lbelow11; - - m23 <<= 24; - m2 += m22; - - m3 <<= 51; - lbelow13 = l - 13; - - lbelow13 >>= 31; - lbelow14 = l - 14; - - lbelow14 >>= 31; - m += lbelow13; - lbelow15 = l - 15; - - m30 = *(uchar *) (m + 12); - lbelow15 >>= 31; - m += lbelow14; - - m31 = *(uchar *) (m + 13); - m += lbelow15; - m2 += m23; - - m32 = *(uchar *) (m + 14); - m30 &= ~lbelow13; - lbelow12 -= lbelow13; - - m30 += lbelow12; - lbelow13 -= lbelow14; - - m3 += m30; - m31 &= ~lbelow14; - - m31 += lbelow13; - m32 &= ~lbelow15; - - m31 <<= 8; - lbelow14 -= lbelow15; - - m3 += m31; - m32 += lbelow14; - d0 = m0; - - m32 <<= 16; - m33 = lbelow15 + 1; - d1 = m1; - - m33 <<= 24; - m3 += m32; - d2 = m2; - - m3 += m33; - d3 = m3; - - alpha0 = *(double *) (constants + 24); - - z3 = *(double *) &d3; - - z2 = *(double *) &d2; - - z1 = *(double *) &d1; - - z0 = *(double *) &d0; - - z3 -= alpha96; - - z2 -= alpha64; - - z1 -= alpha32; - - z0 -= alpha0; - - h5 += z3; - - h3 += z2; - - h1 += z1; - - h0 += z0; - - y7 = h7 + alpha130; - - y6 = h6 + alpha130; - - y1 = h1 + alpha32; - - y0 = h0 + alpha32; - - y7 -= alpha130; - - y6 -= alpha130; - - y1 -= alpha32; - - y0 -= alpha32; - - y5 = h5 + alpha96; - - y4 = h4 + alpha96; - - x7 = h7 - y7; - y7 *= scale; - - x6 = h6 - y6; - y6 *= scale; - - x1 = h1 - y1; - - x0 = h0 - y0; - - y5 -= alpha96; - - y4 -= alpha96; - - x1 += y7; - - x0 += y6; - - x7 += y5; - - x6 += y4; - - y3 = h3 + alpha64; - - y2 = h2 + alpha64; - - x0 += x1; - - x6 += x7; - - y3 -= alpha64; - r3low = r3low_stack; - - y2 -= alpha64; - r0low = r0low_stack; - - x5 = h5 - y5; - r3lowx0 = r3low * x0; - r3high = r3high_stack; - - x4 = h4 - y4; - r0lowx6 = r0low * x6; - r0high = r0high_stack; - - x3 = h3 - y3; - r3highx0 = r3high * x0; - sr1low = sr1low_stack; - - x2 = h2 - y2; - r0highx6 = r0high * x6; - sr1high = sr1high_stack; - - x5 += y3; - r0lowx0 = r0low * x0; - r1low = r1low_stack; - - h6 = r3lowx0 + r0lowx6; - sr1lowx6 = sr1low * x6; - r1high = r1high_stack; - - x4 += y2; - r0highx0 = r0high * x0; - sr2low = sr2low_stack; - - h7 = r3highx0 + r0highx6; - sr1highx6 = sr1high * x6; - sr2high = sr2high_stack; - - x3 += y1; - r1lowx0 = r1low * x0; - r2low = r2low_stack; - - h0 = r0lowx0 + sr1lowx6; - sr2lowx6 = sr2low * x6; - r2high = r2high_stack; - - x2 += y0; - r1highx0 = r1high * x0; - sr3low = sr3low_stack; - - h1 = r0highx0 + sr1highx6; - sr2highx6 = sr2high * x6; - sr3high = sr3high_stack; - - x4 += x5; - r2lowx0 = r2low * x0; - - h2 = r1lowx0 + sr2lowx6; - sr3lowx6 = sr3low * x6; - - x2 += x3; - r2highx0 = r2high * x0; - - h3 = r1highx0 + sr2highx6; - sr3highx6 = sr3high * x6; - - r1highx4 = r1high * x4; - - h4 = r2lowx0 + sr3lowx6; - r1lowx4 = r1low * x4; - - r0highx4 = r0high * x4; - - h5 = r2highx0 + sr3highx6; - r0lowx4 = r0low * x4; - - h7 += r1highx4; - sr3highx4 = sr3high * x4; - - h6 += r1lowx4; - sr3lowx4 = sr3low * x4; - - h5 += r0highx4; - sr2highx4 = sr2high * x4; - - h4 += r0lowx4; - sr2lowx4 = sr2low * x4; - - h3 += sr3highx4; - r0lowx2 = r0low * x2; - - h2 += sr3lowx4; - r0highx2 = r0high * x2; - - h1 += sr2highx4; - r1lowx2 = r1low * x2; - - h0 += sr2lowx4; - r1highx2 = r1high * x2; - - h2 += r0lowx2; - r2lowx2 = r2low * x2; - - h3 += r0highx2; - r2highx2 = r2high * x2; - - h4 += r1lowx2; - sr3lowx2 = sr3low * x2; - - h5 += r1highx2; - sr3highx2 = sr3high * x2; - - h6 += r2lowx2; - - h7 += r2highx2; - - h0 += sr3lowx2; - - h1 += sr3highx2; - - -nomorebytes:; - - offset0 = *(double *) (constants + 104); - y7 = h7 + alpha130; - - offset1 = *(double *) (constants + 112); - y0 = h0 + alpha32; - - offset2 = *(double *) (constants + 120); - y1 = h1 + alpha32; - - offset3 = *(double *) (constants + 128); - y2 = h2 + alpha64; - - y7 -= alpha130; - - y3 = h3 + alpha64; - - y4 = h4 + alpha96; - - y5 = h5 + alpha96; - - x7 = h7 - y7; - y7 *= scale; - - y0 -= alpha32; - - y1 -= alpha32; - - y2 -= alpha64; - - h6 += x7; - - y3 -= alpha64; - - y4 -= alpha96; - - y5 -= alpha96; - - y6 = h6 + alpha130; - - x0 = h0 - y0; - - x1 = h1 - y1; - - x2 = h2 - y2; - - y6 -= alpha130; - - x0 += y7; - - x3 = h3 - y3; - - x4 = h4 - y4; - - x5 = h5 - y5; - - x6 = h6 - y6; - - y6 *= scale; - - x2 += y0; - - x3 += y1; - - x4 += y2; - - x0 += y6; - - x5 += y3; - - x6 += y4; - - x2 += x3; - - x0 += x1; - - x4 += x5; - - x6 += y5; - - x2 += offset1; - *(double *) &d1 = x2; - - x0 += offset0; - *(double *) &d0 = x0; - - x4 += offset2; - *(double *) &d2 = x4; - - x6 += offset3; - *(double *) &d3 = x6; - - - - - f0 = d0; - - f1 = d1; - bits32 = -1; - - f2 = d2; - bits32 >>= 32; - - f3 = d3; - f = f0 >> 32; - - f0 &= bits32; - f &= 255; - - f1 += f; - g0 = f0 + 5; - - g = g0 >> 32; - g0 &= bits32; - - f = f1 >> 32; - f1 &= bits32; - - f &= 255; - g1 = f1 + g; - - g = g1 >> 32; - f2 += f; - - f = f2 >> 32; - g1 &= bits32; - - f2 &= bits32; - f &= 255; - - f3 += f; - g2 = f2 + g; - - g = g2 >> 32; - g2 &= bits32; - - f4 = f3 >> 32; - f3 &= bits32; - - f4 &= 255; - g3 = f3 + g; - - g = g3 >> 32; - g3 &= bits32; - - g4 = f4 + g; - - g4 = g4 - 4; - s00 = *(uchar *) (s + 0); - - f = (int64) g4 >> 63; - s01 = *(uchar *) (s + 1); - - f0 &= f; - g0 &= ~f; - s02 = *(uchar *) (s + 2); - - f1 &= f; - f0 |= g0; - s03 = *(uchar *) (s + 3); - - g1 &= ~f; - f2 &= f; - s10 = *(uchar *) (s + 4); - - f3 &= f; - g2 &= ~f; - s11 = *(uchar *) (s + 5); - - g3 &= ~f; - f1 |= g1; - s12 = *(uchar *) (s + 6); - - f2 |= g2; - f3 |= g3; - s13 = *(uchar *) (s + 7); - - s01 <<= 8; - f0 += s00; - s20 = *(uchar *) (s + 8); - - s02 <<= 16; - f0 += s01; - s21 = *(uchar *) (s + 9); - - s03 <<= 24; - f0 += s02; - s22 = *(uchar *) (s + 10); - - s11 <<= 8; - f1 += s10; - s23 = *(uchar *) (s + 11); - - s12 <<= 16; - f1 += s11; - s30 = *(uchar *) (s + 12); - - s13 <<= 24; - f1 += s12; - s31 = *(uchar *) (s + 13); - - f0 += s03; - f1 += s13; - s32 = *(uchar *) (s + 14); - - s21 <<= 8; - f2 += s20; - s33 = *(uchar *) (s + 15); - - s22 <<= 16; - f2 += s21; - - s23 <<= 24; - f2 += s22; - - s31 <<= 8; - f3 += s30; - - s32 <<= 16; - f3 += s31; - - s33 <<= 24; - f3 += s32; - - f2 += s23; - f3 += s33; - - *(uchar *) (out + 0) = f0; - f0 >>= 8; - *(uchar *) (out + 1) = f0; - f0 >>= 8; - *(uchar *) (out + 2) = f0; - f0 >>= 8; - *(uchar *) (out + 3) = f0; - f0 >>= 8; - f1 += f0; - - *(uchar *) (out + 4) = f1; - f1 >>= 8; - *(uchar *) (out + 5) = f1; - f1 >>= 8; - *(uchar *) (out + 6) = f1; - f1 >>= 8; - *(uchar *) (out + 7) = f1; - f1 >>= 8; - f2 += f1; - - *(uchar *) (out + 8) = f2; - f2 >>= 8; - *(uchar *) (out + 9) = f2; - f2 >>= 8; - *(uchar *) (out + 10) = f2; - f2 >>= 8; - *(uchar *) (out + 11) = f2; - f2 >>= 8; - f3 += f2; - - *(uchar *) (out + 12) = f3; - f3 >>= 8; - *(uchar *) (out + 13) = f3; - f3 >>= 8; - *(uchar *) (out + 14) = f3; - f3 >>= 8; - *(uchar *) (out + 15) = f3; - - return 0; -} diff --git a/src/libnacl/crypto_onetimeauth/poly1305/amd64/api.h b/src/libnacl/crypto_onetimeauth/poly1305/amd64/api.h deleted file mode 100644 index acc133ed..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/amd64/api.h +++ /dev/null @@ -1,2 +0,0 @@ -#define CRYPTO_BYTES 16 -#define CRYPTO_KEYBYTES 32 diff --git a/src/libnacl/crypto_onetimeauth/poly1305/amd64/verify.c b/src/libnacl/crypto_onetimeauth/poly1305/amd64/verify.c deleted file mode 100644 index c7e063f1..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/amd64/verify.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "crypto_verify_16.h" -#include "crypto_onetimeauth.h" - -int crypto_onetimeauth_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k) -{ - unsigned char correct[16]; - crypto_onetimeauth(correct,in,inlen,k); - return crypto_verify_16(h,correct); -} diff --git a/src/libnacl/crypto_onetimeauth/poly1305/ref/api.h b/src/libnacl/crypto_onetimeauth/poly1305/ref/api.h deleted file mode 100644 index acc133ed..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/ref/api.h +++ /dev/null @@ -1,2 +0,0 @@ -#define CRYPTO_BYTES 16 -#define CRYPTO_KEYBYTES 32 diff --git a/src/libnacl/crypto_onetimeauth/poly1305/ref/verify.c b/src/libnacl/crypto_onetimeauth/poly1305/ref/verify.c deleted file mode 100644 index c7e063f1..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/ref/verify.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "crypto_verify_16.h" -#include "crypto_onetimeauth.h" - -int crypto_onetimeauth_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k) -{ - unsigned char correct[16]; - crypto_onetimeauth(correct,in,inlen,k); - return crypto_verify_16(h,correct); -} diff --git a/src/libnacl/crypto_onetimeauth/poly1305/selected b/src/libnacl/crypto_onetimeauth/poly1305/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_onetimeauth/poly1305/used b/src/libnacl/crypto_onetimeauth/poly1305/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_onetimeauth/poly1305/x86/api.h b/src/libnacl/crypto_onetimeauth/poly1305/x86/api.h deleted file mode 100644 index acc133ed..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/x86/api.h +++ /dev/null @@ -1,2 +0,0 @@ -#define CRYPTO_BYTES 16 -#define CRYPTO_KEYBYTES 32 diff --git a/src/libnacl/crypto_onetimeauth/poly1305/x86/verify.c b/src/libnacl/crypto_onetimeauth/poly1305/x86/verify.c deleted file mode 100644 index c7e063f1..00000000 --- a/src/libnacl/crypto_onetimeauth/poly1305/x86/verify.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "crypto_verify_16.h" -#include "crypto_onetimeauth.h" - -int crypto_onetimeauth_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k) -{ - unsigned char correct[16]; - crypto_onetimeauth(correct,in,inlen,k); - return crypto_verify_16(h,correct); -} diff --git a/src/libnacl/crypto_scalarmult/curve25519/used b/src/libnacl/crypto_scalarmult/curve25519/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_secretbox/xsalsa20poly1305/selected b/src/libnacl/crypto_secretbox/xsalsa20poly1305/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_secretbox/xsalsa20poly1305/used b/src/libnacl/crypto_secretbox/xsalsa20poly1305/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_sign/ed25519/selected b/src/libnacl/crypto_sign/ed25519/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_sign/ed25519/used b/src/libnacl/crypto_sign/ed25519/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/selected b/src/libnacl/crypto_sign/edwards25519sha512batch/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_sign/edwards25519sha512batch/used b/src/libnacl/crypto_sign/edwards25519sha512batch/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_stream/aes128ctr/used b/src/libnacl/crypto_stream/aes128ctr/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_stream/salsa20/used b/src/libnacl/crypto_stream/salsa20/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_stream/salsa2012/used b/src/libnacl/crypto_stream/salsa2012/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_stream/salsa208/used b/src/libnacl/crypto_stream/salsa208/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_stream/xsalsa20/selected b/src/libnacl/crypto_stream/xsalsa20/selected deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_stream/xsalsa20/used b/src/libnacl/crypto_stream/xsalsa20/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_verify/16/used b/src/libnacl/crypto_verify/16/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_verify/32/used b/src/libnacl/crypto_verify/32/used deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/dist-dirs b/src/libnacl/dist-dirs deleted file mode 100644 index e22060fc..00000000 --- a/src/libnacl/dist-dirs +++ /dev/null @@ -1,74 +0,0 @@ -. -./commandline -./cpucycles -./cpuid -./crypto_auth -./crypto_auth/hmacsha256 -./crypto_auth/hmacsha256/ref -./crypto_auth/hmacsha512256 -./crypto_auth/hmacsha512256/ref -./crypto_box -./crypto_box/curve25519xsalsa20poly1305 -./crypto_box/curve25519xsalsa20poly1305/ref -./crypto_core -./crypto_core/hsalsa20 -./crypto_core/hsalsa20/ref -./crypto_core/hsalsa20/ref2 -./crypto_core/salsa20 -./crypto_core/salsa20/ref -./crypto_core/salsa2012 -./crypto_core/salsa2012/ref -./crypto_core/salsa208 -./crypto_core/salsa208/ref -./crypto_hash -./crypto_hash/sha256 -./crypto_hash/sha256/ref -./crypto_hash/sha512 -./crypto_hash/sha512/ref -./crypto_hashblocks -./crypto_hashblocks/sha256 -./crypto_hashblocks/sha256/inplace -./crypto_hashblocks/sha256/ref -./crypto_hashblocks/sha512 -./crypto_hashblocks/sha512/inplace -./crypto_hashblocks/sha512/ref -./crypto_onetimeauth -./crypto_onetimeauth/poly1305 -./crypto_onetimeauth/poly1305/53 -./crypto_onetimeauth/poly1305/amd64 -./crypto_onetimeauth/poly1305/ref -./crypto_onetimeauth/poly1305/x86 -./crypto_scalarmult -./crypto_scalarmult/curve25519 -./crypto_scalarmult/curve25519/donna_c64 -./crypto_scalarmult/curve25519/ref -./crypto_secretbox -./crypto_secretbox/xsalsa20poly1305 -./crypto_secretbox/xsalsa20poly1305/ref -./crypto_sign -./crypto_sign/ed25519 -./crypto_sign/ed25519/ref -./crypto_sign/edwards25519sha512batch -./crypto_sign/edwards25519sha512batch/ref -./crypto_stream -./crypto_stream/aes128ctr -./crypto_stream/aes128ctr/portable -./crypto_stream/salsa20 -./crypto_stream/salsa20/ref -./crypto_stream/salsa2012 -./crypto_stream/salsa2012/ref -./crypto_stream/salsa208 -./crypto_stream/salsa208/ref -./crypto_stream/xsalsa20 -./crypto_stream/xsalsa20/ref -./crypto_verify -./crypto_verify/16 -./crypto_verify/16/ref -./crypto_verify/32 -./crypto_verify/32/ref -./inttypes -./okcompilers -./randombytes -./tests -./windows -./windows/include diff --git a/src/libnacl/dist-files b/src/libnacl/dist-files deleted file mode 100644 index 9cb2eee7..00000000 --- a/src/libnacl/dist-files +++ /dev/null @@ -1,376 +0,0 @@ -./commandline/nacl-sha256.c -./commandline/nacl-sha512.c -./cpucycles/alpha.c -./cpucycles/alpha.h -./cpucycles/amd64cpuinfo.c -./cpucycles/amd64cpuinfo.h -./cpucycles/amd64cpuspeed.c -./cpucycles/amd64cpuspeed.h -./cpucycles/amd64tscfreq.c -./cpucycles/amd64tscfreq.h -./cpucycles/celllinux.c -./cpucycles/celllinux.h -./cpucycles/cortex.c -./cpucycles/cortex.h -./cpucycles/dev4ns.c -./cpucycles/dev4ns.h -./cpucycles/do -./cpucycles/gettimeofday.c -./cpucycles/gettimeofday.h -./cpucycles/hppapstat.c -./cpucycles/hppapstat.h -./cpucycles/ia64cpuinfo.c -./cpucycles/ia64cpuinfo.h -./cpucycles/mips.c -./cpucycles/mips.h -./cpucycles/monotonic.c -./cpucycles/monotonic.h -./cpucycles/monotoniccpuinfo.c -./cpucycles/monotoniccpuinfo.h -./cpucycles/osfreq.c -./cpucycles/powerpccpuinfo.c -./cpucycles/powerpccpuinfo.h -./cpucycles/powerpcmacos.c -./cpucycles/powerpcmacos.h -./cpucycles/sgi.c -./cpucycles/sgi.h -./cpucycles/sparc32cpuinfo.c -./cpucycles/sparc32cpuinfo.h -./cpucycles/sparccpuinfo.c -./cpucycles/sparccpuinfo.h -./cpucycles/test.c -./cpucycles/x86cpuinfo.c -./cpucycles/x86cpuinfo.h -./cpucycles/x86cpuspeed.c -./cpucycles/x86cpuspeed.h -./cpucycles/x86estimate.c -./cpucycles/x86estimate.h -./cpucycles/x86tscfreq.c -./cpucycles/x86tscfreq.h -./cpuid/cbytes.c -./cpuid/cpuid.c -./cpuid/do -./cpuid/unknown.c -./cpuid/x86.c -./crypto_auth/hmacsha256/checksum -./crypto_auth/hmacsha256/ref/api.h -./crypto_auth/hmacsha256/ref/hmac.c -./crypto_auth/hmacsha256/ref/verify.c -./crypto_auth/hmacsha256/used -./crypto_auth/hmacsha512256/checksum -./crypto_auth/hmacsha512256/ref/api.h -./crypto_auth/hmacsha512256/ref/hmac.c -./crypto_auth/hmacsha512256/ref/verify.c -./crypto_auth/hmacsha512256/selected -./crypto_auth/hmacsha512256/used -./crypto_auth/measure.c -./crypto_auth/try.c -./crypto_box/curve25519xsalsa20poly1305/checksum -./crypto_box/curve25519xsalsa20poly1305/ref/after.c -./crypto_box/curve25519xsalsa20poly1305/ref/api.h -./crypto_box/curve25519xsalsa20poly1305/ref/before.c -./crypto_box/curve25519xsalsa20poly1305/ref/box.c -./crypto_box/curve25519xsalsa20poly1305/ref/keypair.c -./crypto_box/curve25519xsalsa20poly1305/selected -./crypto_box/curve25519xsalsa20poly1305/used -./crypto_box/measure.c -./crypto_box/try.c -./crypto_core/hsalsa20/checksum -./crypto_core/hsalsa20/ref/api.h -./crypto_core/hsalsa20/ref/core.c -./crypto_core/hsalsa20/ref/implementors -./crypto_core/hsalsa20/ref2/api.h -./crypto_core/hsalsa20/ref2/core.c -./crypto_core/hsalsa20/ref2/implementors -./crypto_core/hsalsa20/used -./crypto_core/measure.c -./crypto_core/salsa20/checksum -./crypto_core/salsa20/ref/api.h -./crypto_core/salsa20/ref/core.c -./crypto_core/salsa20/ref/implementors -./crypto_core/salsa20/used -./crypto_core/salsa2012/checksum -./crypto_core/salsa2012/ref/api.h -./crypto_core/salsa2012/ref/core.c -./crypto_core/salsa2012/ref/implementors -./crypto_core/salsa2012/used -./crypto_core/salsa208/checksum -./crypto_core/salsa208/ref/api.h -./crypto_core/salsa208/ref/core.c -./crypto_core/salsa208/ref/implementors -./crypto_core/salsa208/used -./crypto_core/try.c -./crypto_hash/measure.c -./crypto_hash/sha256/checksum -./crypto_hash/sha256/ref/api.h -./crypto_hash/sha256/ref/hash.c -./crypto_hash/sha256/ref/implementors -./crypto_hash/sha256/used -./crypto_hash/sha512/checksum -./crypto_hash/sha512/ref/api.h -./crypto_hash/sha512/ref/hash.c -./crypto_hash/sha512/ref/implementors -./crypto_hash/sha512/selected -./crypto_hash/sha512/used -./crypto_hash/try.c -./crypto_hashblocks/measure.c -./crypto_hashblocks/sha256/checksum -./crypto_hashblocks/sha256/inplace/api.h -./crypto_hashblocks/sha256/inplace/blocks.c -./crypto_hashblocks/sha256/inplace/implementors -./crypto_hashblocks/sha256/ref/api.h -./crypto_hashblocks/sha256/ref/blocks.c -./crypto_hashblocks/sha256/ref/implementors -./crypto_hashblocks/sha256/used -./crypto_hashblocks/sha512/checksum -./crypto_hashblocks/sha512/inplace/api.h -./crypto_hashblocks/sha512/inplace/blocks.c -./crypto_hashblocks/sha512/inplace/implementors -./crypto_hashblocks/sha512/ref/api.h -./crypto_hashblocks/sha512/ref/blocks.c -./crypto_hashblocks/sha512/ref/implementors -./crypto_hashblocks/sha512/selected -./crypto_hashblocks/sha512/used -./crypto_hashblocks/try.c -./crypto_onetimeauth/measure.c -./crypto_onetimeauth/poly1305/53/api.h -./crypto_onetimeauth/poly1305/53/auth.c -./crypto_onetimeauth/poly1305/53/verify.c -./crypto_onetimeauth/poly1305/amd64/api.h -./crypto_onetimeauth/poly1305/amd64/auth.s -./crypto_onetimeauth/poly1305/amd64/constants.s -./crypto_onetimeauth/poly1305/amd64/verify.c -./crypto_onetimeauth/poly1305/checksum -./crypto_onetimeauth/poly1305/ref/api.h -./crypto_onetimeauth/poly1305/ref/auth.c -./crypto_onetimeauth/poly1305/ref/verify.c -./crypto_onetimeauth/poly1305/selected -./crypto_onetimeauth/poly1305/used -./crypto_onetimeauth/poly1305/x86/api.h -./crypto_onetimeauth/poly1305/x86/auth.s -./crypto_onetimeauth/poly1305/x86/constants.s -./crypto_onetimeauth/poly1305/x86/verify.c -./crypto_onetimeauth/try.c -./crypto_scalarmult/curve25519/checksum -./crypto_scalarmult/curve25519/donna_c64/api.h -./crypto_scalarmult/curve25519/donna_c64/base.c -./crypto_scalarmult/curve25519/donna_c64/implementors -./crypto_scalarmult/curve25519/donna_c64/smult.c -./crypto_scalarmult/curve25519/ref/api.h -./crypto_scalarmult/curve25519/ref/base.c -./crypto_scalarmult/curve25519/ref/implementors -./crypto_scalarmult/curve25519/ref/smult.c -./crypto_scalarmult/curve25519/used -./crypto_scalarmult/measure.c -./crypto_scalarmult/try.c -./crypto_secretbox/measure.c -./crypto_secretbox/try.c -./crypto_secretbox/xsalsa20poly1305/checksum -./crypto_secretbox/xsalsa20poly1305/ref/api.h -./crypto_secretbox/xsalsa20poly1305/ref/box.c -./crypto_secretbox/xsalsa20poly1305/selected -./crypto_secretbox/xsalsa20poly1305/used -./crypto_sign/ed25519/description -./crypto_sign/ed25519/designers -./crypto_sign/ed25519/ref/api.h -./crypto_sign/ed25519/ref/ed25519.c -./crypto_sign/ed25519/ref/fe25519.c -./crypto_sign/ed25519/ref/fe25519.h -./crypto_sign/ed25519/ref/ge25519.c -./crypto_sign/ed25519/ref/ge25519.h -./crypto_sign/ed25519/ref/ge25519_base.data -./crypto_sign/ed25519/ref/implementors -./crypto_sign/ed25519/ref/sc25519.c -./crypto_sign/ed25519/ref/sc25519.h -./crypto_sign/ed25519/selected -./crypto_sign/ed25519/used -./crypto_sign/edwards25519sha512batch/ref/api.h -./crypto_sign/edwards25519sha512batch/ref/fe25519.c -./crypto_sign/edwards25519sha512batch/ref/fe25519.h -./crypto_sign/edwards25519sha512batch/ref/ge25519.c -./crypto_sign/edwards25519sha512batch/ref/ge25519.h -./crypto_sign/edwards25519sha512batch/ref/sc25519.c -./crypto_sign/edwards25519sha512batch/ref/sc25519.h -./crypto_sign/edwards25519sha512batch/ref/sign.c -./crypto_sign/edwards25519sha512batch/selected -./crypto_sign/edwards25519sha512batch/used -./crypto_sign/measure.c -./crypto_sign/try.c -./crypto_stream/aes128ctr/checksum -./crypto_stream/aes128ctr/portable/afternm.c -./crypto_stream/aes128ctr/portable/api.h -./crypto_stream/aes128ctr/portable/beforenm.c -./crypto_stream/aes128ctr/portable/common.c -./crypto_stream/aes128ctr/portable/common.h -./crypto_stream/aes128ctr/portable/consts.c -./crypto_stream/aes128ctr/portable/consts.h -./crypto_stream/aes128ctr/portable/int128.c -./crypto_stream/aes128ctr/portable/int128.h -./crypto_stream/aes128ctr/portable/stream.c -./crypto_stream/aes128ctr/portable/types.h -./crypto_stream/aes128ctr/portable/xor_afternm.c -./crypto_stream/aes128ctr/used -./crypto_stream/measure.c -./crypto_stream/salsa20/checksum -./crypto_stream/salsa20/ref/api.h -./crypto_stream/salsa20/ref/implementors -./crypto_stream/salsa20/ref/stream.c -./crypto_stream/salsa20/ref/xor.c -./crypto_stream/salsa20/used -./crypto_stream/salsa2012/checksum -./crypto_stream/salsa2012/ref/api.h -./crypto_stream/salsa2012/ref/implementors -./crypto_stream/salsa2012/ref/stream.c -./crypto_stream/salsa2012/ref/xor.c -./crypto_stream/salsa2012/used -./crypto_stream/salsa208/checksum -./crypto_stream/salsa208/ref/api.h -./crypto_stream/salsa208/ref/implementors -./crypto_stream/salsa208/ref/stream.c -./crypto_stream/salsa208/ref/xor.c -./crypto_stream/salsa208/used -./crypto_stream/try.c -./crypto_stream/xsalsa20/checksum -./crypto_stream/xsalsa20/ref/api.h -./crypto_stream/xsalsa20/ref/implementors -./crypto_stream/xsalsa20/ref/stream.c -./crypto_stream/xsalsa20/ref/xor.c -./crypto_stream/xsalsa20/selected -./crypto_stream/xsalsa20/used -./crypto_verify/16/checksum -./crypto_verify/16/ref/api.h -./crypto_verify/16/ref/verify.c -./crypto_verify/16/used -./crypto_verify/32/checksum -./crypto_verify/32/ref/api.h -./crypto_verify/32/ref/verify.c -./crypto_verify/32/used -./crypto_verify/measure.c -./crypto_verify/try.c -./dist-dirs -./dist-files -./do -./inttypes/crypto_int16.c -./inttypes/crypto_int32.c -./inttypes/crypto_int64.c -./inttypes/crypto_int8.c -./inttypes/crypto_uint16.c -./inttypes/crypto_uint32.c -./inttypes/crypto_uint64.c -./inttypes/crypto_uint8.c -./inttypes/do -./inttypes/signed.h -./inttypes/unsigned.h -./MACROS -./Makefile.in -./measure-anything.c -./okcompilers/abiname.c -./okcompilers/abinames -./okcompilers/archivers -./okcompilers/c.in -./okcompilers/do.in -./okcompilers/lib.c -./okcompilers/main.c -./okcompilers/test-okar -./okcompilers/test-okc -./okcompilers/test-okc2 -./okcompilers/test-okclink -./okcompilers/test.c -./okcompilers/test10.c -./okcompilers/test5.c -./okcompilers/test6.c -./okcompilers/test9.c -./OPERATIONS -./PROTOTYPES.c -./randombytes/devurandom.c -./randombytes/devurandom.h -./randombytes/do -./randombytes/test.c -./tests/auth.c -./tests/auth.out -./tests/auth2.c -./tests/auth2.out -./tests/auth3.c -./tests/auth3.out -./tests/auth4.out -./tests/auth5.c -./tests/auth5.out -./tests/auth6.out -./tests/box.c -./tests/box.out -./tests/box2.c -./tests/box2.out -./tests/box3.out -./tests/box4.out -./tests/box5.out -./tests/box6.out -./tests/box7.c -./tests/box7.out -./tests/box8.c -./tests/box8.out -./tests/core1.c -./tests/core1.out -./tests/core2.c -./tests/core2.out -./tests/core3.c -./tests/core3.out -./tests/core4.c -./tests/core4.out -./tests/core5.c -./tests/core5.out -./tests/core6.c -./tests/core6.out -./tests/hash.c -./tests/hash.out -./tests/hash2.out -./tests/hash3.c -./tests/hash3.out -./tests/hash4.out -./tests/Makefile.in -./tests/onetimeauth.c -./tests/onetimeauth.out -./tests/onetimeauth2.c -./tests/onetimeauth2.out -./tests/onetimeauth5.out -./tests/onetimeauth6.out -./tests/onetimeauth7.c -./tests/onetimeauth7.out -./tests/onetimeauth8.out -./tests/scalarmult.c -./tests/scalarmult.out -./tests/scalarmult2.c -./tests/scalarmult2.out -./tests/scalarmult3.out -./tests/scalarmult4.out -./tests/scalarmult5.c -./tests/scalarmult5.out -./tests/scalarmult6.c -./tests/scalarmult6.out -./tests/scalarmult7.out -./tests/secretbox.c -./tests/secretbox.out -./tests/secretbox2.c -./tests/secretbox2.out -./tests/secretbox3.out -./tests/secretbox4.out -./tests/secretbox5.out -./tests/secretbox6.out -./tests/secretbox7.c -./tests/secretbox7.out -./tests/secretbox8.c -./tests/secretbox8.out -./tests/stream.c -./tests/stream.out -./tests/stream2.c -./tests/stream2.out -./tests/stream3.c -./tests/stream3.out -./tests/stream4.c -./tests/stream4.out -./tests/stream5.out -./tests/stream6.out -./tests/stream7.out -./tests/stream8.out -./try-anything.c -./version -./windows/include/windows-quirks.h diff --git a/src/libnacl/do b/src/libnacl/do deleted file mode 100755 index bb1200f1..00000000 --- a/src/libnacl/do +++ /dev/null @@ -1,309 +0,0 @@ -#!/bin/sh - -# nacl/do -# D. J. Bernstein -# Public domain. - -version=`cat version` -project=nacl -shorthostname="localhost" - -top="`pwd`/build/$shorthostname" -bin="$top/bin" -lib="$top/lib" -include="$top/include" -work="$top/work" - -PATH="/usr/local/bin:$PATH" -PATH="/usr/sfw/bin:$PATH" -PATH="$bin:$PATH" -export PATH - -LD_LIBRARY_PATH="/usr/local/lib/sparcv9:/usr/local/lib:$LD_LIBRARY_PATH" -LD_LIBRARY_PATH="/usr/sfw/lib/sparcv9:/usr/sfw/lib:$LD_LIBRARY_PATH" -export LD_LIBRARY_PATH - -# and wacky MacOS X -DYLD_LIBRARY_PATH="/usr/local/lib/sparcv9:/usr/local/lib:$DYLD_LIBRARY_PATH" -DYLD_LIBRARY_PATH="/usr/sfw/lib/sparcv9:/usr/sfw/lib:$DYLD_LIBRARY_PATH" -export DYLD_LIBRARY_PATH - -# and work around bug in GNU sort -LANG=C -export LANG - -rm -rf "$top" -mkdir -p "$top" -mkdir -p "$bin" -mkdir -p "$lib" -mkdir -p "$include" - -exec 5>"$top/data" -exec 2>"$top/errors" -exec "$work/${project}_base.c" - okc-$abi \ - | while read compiler - do - ( cd "$work" && $compiler -c ${project}_base.c ) && break - done - okar-$abi cr "$lib/$abi/lib${project}.a" "$work/${project}_base.o" - ( okranlib-$abi "$lib/$abi/lib${project}.a" || exit 0 ) -done - -ulimit -c 0 - -# loop over operations -cat OPERATIONS \ -| while read o -do - [ -d "$o" ] || continue - - selected='' - [ -f "$o/selected" ] && selected=`cat "$o/selected"` - - # for each operation, loop over primitives - ls "$o" \ - | sort \ - | while read p - do - [ -d "$o/$p" ] || continue - expectedchecksum='' - [ -f "$o/$p/checksum" ] && expectedchecksum=`cat "$o/$p/checksum"` - op="${o}_${p}" - - startdate=`date +%Y%m%d` - - # for each operation primitive, loop over abis - okabi \ - | while read abi - do - echo "=== `date` === $abi $o/$p" - libs=`"oklibs-$abi"` - libs="$lib/$abi/cpucycles.o $libs" - [ -f "$lib/$abi/lib${project}.a" ] && libs="$lib/$abi/lib${project}.a $libs" - - rm -rf "$work" - mkdir -p "$work" - mkdir -p "$work/best" - - # for each operation primitive abi, loop over implementations - find "$o/$p" -follow -name "api.h" \ - | sort \ - | while read doth - do - implementationdir=`dirname $doth` - opi=`echo "$implementationdir" | tr ./- ___` - - echo "=== `date` === $abi $implementationdir" - - rm -rf "$work/compile" - mkdir -p "$work/compile" - - cfiles=`ls "$implementationdir" | grep '\.c$' || :` - sfiles=`ls "$implementationdir" | grep '\.[sS]$' || :` - - cp -p "$o"/*.c "$work/compile/" - - cp -pr "$implementationdir"/* "$work/compile" - - cp -p "try-anything.c" "$work/compile/try-anything.c" - - cp -p MACROS "$work/compile/MACROS" - cp -p PROTOTYPES.c "$work/compile/PROTOTYPES.c" - - ( - cd "$work/compile" - ( - echo "#ifndef ${o}_H" - echo "#define ${o}_H" - echo "" - echo "#include \"${op}.h\"" - echo "" - egrep "${o}"'$|'"${o}"'\(|'"${o}"'_' < MACROS \ - | sed "s/$o/$op/" | while read mop - do - echo "#define ${mop} ${mop}" | sed "s/$op/$o/" - done - echo "#define ${o}_PRIMITIVE \"${p}\"" - echo "#define ${o}_IMPLEMENTATION ${op}_IMPLEMENTATION" - echo "#define ${o}_VERSION ${op}_VERSION" - echo "" - echo "#endif" - ) > "$o.h" - ( - echo "#ifndef ${op}_H" - echo "#define ${op}_H" - echo "" - sed 's/[ ]CRYPTO_/ '"${opi}"'_/g' < api.h - echo '#ifdef __cplusplus' - echo '#include ' - echo 'extern "C" {' - echo '#endif' - egrep "${o}"'$|'"${o}"'\(|'"${o}"'_' < PROTOTYPES.c \ - | sed "s/$o/$opi/" - echo '#ifdef __cplusplus' - echo '}' - echo '#endif' - echo "" - egrep "${o}"'$|'"${o}"'\(|'"${o}"'_' < MACROS \ - | sed "s/$o/$opi/" | while read mopi - do - echo "#define ${mopi} ${mopi}" | sed "s/$opi/$op/" - done - echo "#define ${op}_IMPLEMENTATION \"${implementationdir}\"" - echo "#ifndef ${opi}_VERSION" - echo "#define ${opi}_VERSION \"-\"" - echo "#endif" - echo "#define ${op}_VERSION ${opi}_VERSION" - echo "" - echo "#endif" - ) > "$op.h" - - okc-$abi \ - | while read compiler - do - echo "=== `date` === $abi $implementationdir $compiler" - compilerword=`echo "$compiler" | tr ' ' '_'` - ok=1 - for f in $cfiles $sfiles - do - if [ "$ok" = 1 ] - then - $compiler \ - -I. -I"$include" -I"$include/$abi" \ - -c "$f" >../errors 2>&1 || ok=0 - ( if [ `wc -l < ../errors` -lt 25 ] - then - cat ../errors - else - head ../errors - echo ... - tail ../errors - fi - ) \ - | while read err - do - echo "$version $shorthostname $abi $startdate $o $p fromcompiler $implementationdir $compilerword $f $err" >&5 - done - fi - done - - [ "$ok" = 1 ] || continue - okar-$abi cr "$op.a" *.o || continue - okranlib-$abi "$op.a" - - $compiler \ - -I. -I"$include" -I"$include/$abi" \ - -o try try.c try-anything.c \ - "$op.a" $libs >../errors 2>&1 || ok=0 - cat ../errors \ - | while read err - do - echo "$version $shorthostname $abi $startdate $o $p fromcompiler $implementationdir $compilerword try.c $err" >&5 - done - [ "$ok" = 1 ] || continue - - rm -f ../best/*.o || continue - for f in *.o - do - cp -p "$f" "../best/${opi}-$f" - done - cp -p "$op.h" "../$op.h" - cp -p "$o.h" "../$o.h" - done - ) - done - - [ -f "$o/$p/used" ] \ - && okar-$abi cr "$lib/$abi/lib${project}.a" "$work/best"/*.o \ - && ( okranlib-$abi "$lib/$abi/lib${project}.a" || exit 0 ) \ - && cp -p "$work/$op.h" "$include/$abi/$op.h" \ - && [ -f "$o/$p/selected" ] \ - && cp -p "$work/$o.h" "$include/$abi/$o.h" \ - || : - done - done -done - -echo "=== `date` === finishing" - -touch .done diff --git a/src/libnacl/inttypes/crypto_int16.c b/src/libnacl/inttypes/crypto_int16.c deleted file mode 100644 index bc160669..00000000 --- a/src/libnacl/inttypes/crypto_int16.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_int16.h" -#include "signed.h" -DOIT(16,crypto_int16) diff --git a/src/libnacl/inttypes/crypto_int32.c b/src/libnacl/inttypes/crypto_int32.c deleted file mode 100644 index 520e6822..00000000 --- a/src/libnacl/inttypes/crypto_int32.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_int32.h" -#include "signed.h" -DOIT(32,crypto_int32) diff --git a/src/libnacl/inttypes/crypto_int64.c b/src/libnacl/inttypes/crypto_int64.c deleted file mode 100644 index 77e815bf..00000000 --- a/src/libnacl/inttypes/crypto_int64.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_int64.h" -#include "signed.h" -DOIT(64,crypto_int64) diff --git a/src/libnacl/inttypes/crypto_int8.c b/src/libnacl/inttypes/crypto_int8.c deleted file mode 100644 index 5966c62e..00000000 --- a/src/libnacl/inttypes/crypto_int8.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_int8.h" -#include "signed.h" -DOIT(8,crypto_int8) diff --git a/src/libnacl/inttypes/crypto_uint16.c b/src/libnacl/inttypes/crypto_uint16.c deleted file mode 100644 index 16ce4a69..00000000 --- a/src/libnacl/inttypes/crypto_uint16.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_uint16.h" -#include "unsigned.h" -DOIT(16,crypto_uint16) diff --git a/src/libnacl/inttypes/crypto_uint32.c b/src/libnacl/inttypes/crypto_uint32.c deleted file mode 100644 index 7050b573..00000000 --- a/src/libnacl/inttypes/crypto_uint32.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_uint32.h" -#include "unsigned.h" -DOIT(32,crypto_uint32) diff --git a/src/libnacl/inttypes/crypto_uint64.c b/src/libnacl/inttypes/crypto_uint64.c deleted file mode 100644 index 808055c7..00000000 --- a/src/libnacl/inttypes/crypto_uint64.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_uint64.h" -#include "unsigned.h" -DOIT(64,crypto_uint64) diff --git a/src/libnacl/inttypes/crypto_uint8.c b/src/libnacl/inttypes/crypto_uint8.c deleted file mode 100644 index 61683391..00000000 --- a/src/libnacl/inttypes/crypto_uint8.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "crypto_uint8.h" -#include "unsigned.h" -DOIT(8,crypto_uint8) diff --git a/src/libnacl/inttypes/do b/src/libnacl/inttypes/do deleted file mode 100755 index f0028e3d..00000000 --- a/src/libnacl/inttypes/do +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -e - -okabi | ( - while read abi - do - ( - echo 'int8 int8_t' - echo 'int16 int16_t' - echo 'int32 int32_t' - echo 'int64 int64_t' - echo 'uint8 uint8_t' - echo 'uint16 uint16_t' - echo 'uint32 uint32_t' - echo 'uint64 uint64_t' - ) | ( - while read target source - do - okc-$abi | ( - while read c - do - [ -f include/$abi/crypto_$target.h ] && continue - echo "=== `date` === $abi trying $source as $target under $c..." >&2 - rm -f crypto_$target crypto_$target.h - ( - echo "#ifndef crypto_${target}_h" - echo "#define crypto_${target}_h" - echo "" - echo "#include " - echo "" - echo "typedef ${source} crypto_${target};" - echo "" - echo "#endif" - ) > crypto_$target.h - $c -o crypto_$target crypto_$target.c || continue - mkdir -p include/$abi - cp crypto_$target.h include/$abi/crypto_$target.h - done - ) - done - ) - done -) diff --git a/src/libnacl/inttypes/signed.h b/src/libnacl/inttypes/signed.h deleted file mode 100644 index 92689ff8..00000000 --- a/src/libnacl/inttypes/signed.h +++ /dev/null @@ -1,17 +0,0 @@ -#define DOIT(bits,target) \ -int main() \ -{ \ - target x; \ - int i; \ - \ - x = 1; \ - for (i = 0;i < bits;++i) { \ - if (x == 0) return 100; \ - x += x; \ - } \ - if (x != 0) return 100; \ - x -= 1; \ - if (x > 0) return 100; \ - \ - return 0; \ -} diff --git a/src/libnacl/inttypes/unsigned.h b/src/libnacl/inttypes/unsigned.h deleted file mode 100644 index 31a7a6ea..00000000 --- a/src/libnacl/inttypes/unsigned.h +++ /dev/null @@ -1,17 +0,0 @@ -#define DOIT(bits,target) \ -int main() \ -{ \ - target x; \ - int i; \ - \ - x = 1; \ - for (i = 0;i < bits;++i) { \ - if (x == 0) return 100; \ - x += x; \ - } \ - if (x != 0) return 100; \ - x -= 1; \ - if (x < 0) return 100; \ - \ - return 0; \ -} diff --git a/src/libnacl/measure-anything.c b/src/libnacl/measure-anything.c deleted file mode 100644 index 93941aa5..00000000 --- a/src/libnacl/measure-anything.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * measure-anything.c version 20090223 - * D. J. Bernstein - * Public domain. - */ - -#include -#include -#include -#include -#include -#include -#ifndef _WIN32 -# include -#endif -#include "cpucycles.h" -#include "cpuid.h" - -typedef int uint32; - -static uint32 seed[32] = { 3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4,3,3,8,3,2,7,9,5 } ; -static uint32 in[12]; -static uint32 out[8]; -static int outleft = 0; - -#define ROTATE(x,b) (((x) << (b)) | ((x) >> (32 - (b)))) -#define MUSH(i,b) x = t[i] += (((x ^ seed[i]) + sum) ^ ROTATE(x,b)); - -static void surf(void) -{ - uint32 t[12]; uint32 x; uint32 sum = 0; - int r; int i; int loop; - - for (i = 0;i < 12;++i) t[i] = in[i] ^ seed[12 + i]; - for (i = 0;i < 8;++i) out[i] = seed[24 + i]; - x = t[11]; - for (loop = 0;loop < 2;++loop) { - for (r = 0;r < 16;++r) { - sum += 0x9e3779b9; - MUSH(0,5) MUSH(1,7) MUSH(2,9) MUSH(3,13) - MUSH(4,5) MUSH(5,7) MUSH(6,9) MUSH(7,13) - MUSH(8,5) MUSH(9,7) MUSH(10,9) MUSH(11,13) - } - for (i = 0;i < 8;++i) out[i] ^= t[i + 4]; - } -} - -void randombytes(unsigned char *x,unsigned long long xlen) -{ - while (xlen > 0) { - if (!outleft) { - if (!++in[0]) if (!++in[1]) if (!++in[2]) ++in[3]; - surf(); - outleft = 8; - } - *x = out[--outleft]; - ++x; - --xlen; - } -} - -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void preallocate(void); -extern void allocate(void); -extern void measure(void); - -static void printword(const char *s) -{ - if (!*s) putchar('-'); - while (*s) { - if (*s == ' ') putchar('_'); - else if (*s == '\t') putchar('_'); - else if (*s == '\r') putchar('_'); - else if (*s == '\n') putchar('_'); - else putchar(*s); - ++s; - } - putchar(' '); -} - -static void printnum(long long x) -{ - printf("%lld ",x); -} - -static void fail(const char *why) -{ - fprintf(stderr,"measure: fatal: %s\n",why); - exit(111); -} - -unsigned char *alignedcalloc(unsigned long long len) -{ - unsigned char *x = (unsigned char *) calloc(1,len + 128); - if (!x) fail("out of memory"); - /* will never deallocate so shifting is ok */ - x += 63 & (-(unsigned long) x); - return x; -} - -static long long cyclespersecond; - -static void printimplementations(void) -{ - int i; - - printword("implementation"); - printword(primitiveimplementation); - printword(implementationversion); - printf("\n"); fflush(stdout); - - for (i = 0;sizenames[i];++i) { - printword(sizenames[i]); - printnum(sizes[i]); - printf("\n"); fflush(stdout); - } - - printword("cpuid"); - printword(cpuid); - printf("\n"); fflush(stdout); - - printword("cpucycles_persecond"); - printnum(cyclespersecond); - printf("\n"); fflush(stdout); - - printword("cpucycles_implementation"); - printword(cpucycles_implementation); - printf("\n"); fflush(stdout); - - printword("compiler"); - printword(COMPILER); -#if defined(__VERSION__) && !defined(__ICC) - printword(__VERSION__); -#elif defined(__xlc__) - printword(__xlc__); -#elif defined(__ICC) - { - char buf[256]; - - sprintf(buf, "%d.%d.%d", __ICC/100, __ICC%100, - __INTEL_COMPILER_BUILD_DATE); - printword(buf); - } -#elif defined(__PGIC__) - { - char buf[256]; - - sprintf(buf, "%d.%d.%d", __PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__); - printword(buf); - } -#elif defined(__SUNPRO_C) - { - char buf[256]; - int major, minor, micro; - - micro = __SUNPRO_C & 0xf; - minor = (__SUNPRO_C >> 4) & 0xf; - major = (__SUNPRO_C >> 8) & 0xf; - - if (micro) - sprintf(buf, "%d.%d.%d", major, minor, micro); - else - sprintf(buf, "%d.%d", major, minor); - printword(buf); - } -#else - printword("unknown compiler version"); -#endif - printf("\n"); fflush(stdout); -} - -void printentry(long long mbytes,const char *measuring,long long *m,long long mlen) -{ - long long i; - long long j; - long long belowj; - long long abovej; - - printword(measuring); - if (mbytes >= 0) printnum(mbytes); else printword(""); - if (mlen > 0) { - for (j = 0;j + 1 < mlen;++j) { - belowj = 0; - for (i = 0;i < mlen;++i) if (m[i] < m[j]) ++belowj; - abovej = 0; - for (i = 0;i < mlen;++i) if (m[i] > m[j]) ++abovej; - if (belowj * 2 < mlen && abovej * 2 < mlen) break; - } - printnum(m[j]); - if (mlen > 1) { - for (i = 0;i < mlen;++i) printnum(m[i]); - } - } - printf("\n"); fflush(stdout); -} - -void limits() -{ -#ifdef RLIM_INFINITY - struct rlimit r; - r.rlim_cur = 0; - r.rlim_max = 0; -#ifdef RLIMIT_NOFILE - setrlimit(RLIMIT_NOFILE,&r); -#endif -#ifdef RLIMIT_NPROC - setrlimit(RLIMIT_NPROC,&r); -#endif -#ifdef RLIMIT_CORE - setrlimit(RLIMIT_CORE,&r); -#endif -#endif -} - -int main() -{ - cyclespersecond = cpucycles_persecond(); - preallocate(); - limits(); - printimplementations(); - allocate(); - measure(); - return 0; -} diff --git a/src/libnacl/okcompilers/abiname.c b/src/libnacl/okcompilers/abiname.c deleted file mode 100644 index 38373201..00000000 --- a/src/libnacl/okcompilers/abiname.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -const char *abi(void) -{ -#if defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64) - return "amd64"; -#elif defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386) - return "x86"; -#elif defined(__ia64__) || defined(__IA64__) || defined(__M_IA64) - return "ia64"; -#elif defined(__SPU__) - return "cellspu"; -#elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || defined(_ARCH_PPC64) - return "ppc64"; -#elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC) - return "ppc32"; -#elif defined(__sparcv9__) || defined(__sparcv9) - return "sparcv9"; -#elif defined(__sparc_v8__) - return "sparcv8"; -#elif defined(__sparc__) || defined(__sparc) - if (sizeof(long) == 4) return "sparcv8"; - return "sparcv9"; -#elif defined(__ARM_EABI__) - return "armeabi"; -#elif defined(__arm__) - return "arm"; -#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) -# if defined(_ABIO32) - return "mipso32"; -# elif defined(_ABIN32) - return "mips32"; -# else - return "mips64"; -# endif -#else - return "default"; -#endif -} - -int main(int argc,char **argv) -{ - printf("%s %s\n",argv[1],abi()); - return 0; -} diff --git a/src/libnacl/okcompilers/abinames b/src/libnacl/okcompilers/abinames deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/okcompilers/archivers b/src/libnacl/okcompilers/archivers deleted file mode 100644 index d5851c37..00000000 --- a/src/libnacl/okcompilers/archivers +++ /dev/null @@ -1,2 +0,0 @@ -ar -ar -X64 diff --git a/src/libnacl/okcompilers/c.in b/src/libnacl/okcompilers/c.in deleted file mode 100755 index 51a83e1f..00000000 --- a/src/libnacl/okcompilers/c.in +++ /dev/null @@ -1 +0,0 @@ -@CC@ @CPPFLAGS@ @CFLAGS@ diff --git a/src/libnacl/okcompilers/do.in b/src/libnacl/okcompilers/do.in deleted file mode 100755 index 2cd9e0c4..00000000 --- a/src/libnacl/okcompilers/do.in +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -e - -mkdir -p bin - -echo '#!/bin/sh' > bin/okabi -echo 'echo local' >> bin/okabi - -exec < c -echo '#!/bin/sh' > bin/okc-local -while read compiler; do - $compiler lib.c main.c -o test-c || continue - echo "echo $compiler" >> bin/okc-local -done - -echo '#!/bin/sh' > bin/okcpp-local - -echo '#!/bin/sh' > bin/oklibs-local -echo 'echo " @LDFLAGS@ @LIBS@"' >> bin/oklibs-local - -echo '#!/bin/sh' > bin/okar-local -echo 'exec @AR@ "$@"' >> bin/okar-local - -echo '#!/bin/sh' > bin/okranlib-local -echo 'exec @RANLIB@ "$@"' >> bin/okranlib-local - -chmod +x bin/ok* diff --git a/src/libnacl/okcompilers/lib.c b/src/libnacl/okcompilers/lib.c deleted file mode 100644 index cf2e3790..00000000 --- a/src/libnacl/okcompilers/lib.c +++ /dev/null @@ -1,29 +0,0 @@ -int not3(int n) -{ - return n != 3; -} - -int bytes(int n) -{ - return (n + 7) / 8; -} - -long long shr32(long long n) -{ - return n >> 32; -} - -double double5(void) -{ - return 5.0; -} - -int intbytes(void) -{ - return sizeof(int); -} - -int longbytes(void) -{ - return sizeof(long); -} diff --git a/src/libnacl/okcompilers/main.c b/src/libnacl/okcompilers/main.c deleted file mode 100644 index 3b7efa25..00000000 --- a/src/libnacl/okcompilers/main.c +++ /dev/null @@ -1,25 +0,0 @@ -extern int not3(int); -extern int bytes(int); -extern long long shr32(long long); -extern double double5(void); -extern int longbytes(void); -extern int intbytes(void); - -int main(int argc,char **argv) -{ - if (intbytes() != sizeof(int)) return 100; - if (longbytes() != sizeof(long)) return 100; - - if (not3(3)) return 100; - - /* on ppc32, gcc -mpowerpc64 produces SIGILL for >>32 */ - if (!not3(shr32(1))) return 100; - - /* on pentium 1, gcc -march=pentium2 produces SIGILL for (...+7)/8 */ - if (bytes(not3(1)) != 1) return 100; - - /* on pentium 1, gcc -march=prescott produces SIGILL for double comparison */ - if (double5() < 0) return 100; - - return 0; -} diff --git a/src/libnacl/okcompilers/test-okar b/src/libnacl/okcompilers/test-okar deleted file mode 100755 index 8b82a5ff..00000000 --- a/src/libnacl/okcompilers/test-okar +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -PATH="/Users/j/pear/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/openssh/bin:/opt/openssh/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" -export PATH -ar "$@" diff --git a/src/libnacl/okcompilers/test-okc b/src/libnacl/okcompilers/test-okc deleted file mode 100755 index 45a48aed..00000000 --- a/src/libnacl/okcompilers/test-okc +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -PATH="/Users/j/pear/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/openssh/bin:/opt/openssh/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" -export PATH -gcc -O2 -fomit-frame-pointer "$@" diff --git a/src/libnacl/okcompilers/test-okc2 b/src/libnacl/okcompilers/test-okc2 deleted file mode 100755 index b18ee307..00000000 --- a/src/libnacl/okcompilers/test-okc2 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -PATH="/Users/j/pear/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/openssh/bin:/opt/openssh/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" -export PATH -g++ -O2 -fomit-frame-pointer "$@" diff --git a/src/libnacl/okcompilers/test-okclink b/src/libnacl/okcompilers/test-okclink deleted file mode 100755 index c4b2bca8..00000000 --- a/src/libnacl/okcompilers/test-okclink +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -PATH="/Users/j/pear/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/openssh/bin:/opt/openssh/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" -export PATH -gcc -O2 -fomit-frame-pointer "$@" -lrt -lm diff --git a/src/libnacl/okcompilers/test.c b/src/libnacl/okcompilers/test.c deleted file mode 100644 index 973a5c48..00000000 --- a/src/libnacl/okcompilers/test.c +++ /dev/null @@ -1,54 +0,0 @@ -int not3(int n) -{ - return n != 3; -} - -int bytes(int n) -{ - return (n + 7) / 8; -} - -long long shr32(long long n) -{ - return n >> 32; -} - -double double5(void) -{ - return 5.0; -} - -int intbytes(void) -{ - return sizeof(int); -} - -int longbytes(void) -{ - return sizeof(long); -} -extern int not3(int); -extern int bytes(int); -extern long long shr32(long long); -extern double double5(void); -extern int longbytes(void); -extern int intbytes(void); - -int main(int argc,char **argv) -{ - if (intbytes() != sizeof(int)) return 100; - if (longbytes() != sizeof(long)) return 100; - - if (not3(3)) return 100; - - /* on ppc32, gcc -mpowerpc64 produces SIGILL for >>32 */ - if (!not3(shr32(1))) return 100; - - /* on pentium 1, gcc -march=pentium2 produces SIGILL for (...+7)/8 */ - if (bytes(not3(1)) != 1) return 100; - - /* on pentium 1, gcc -march=prescott produces SIGILL for double comparison */ - if (double5() < 0) return 100; - - return 0; -} diff --git a/src/libnacl/okcompilers/test10.c b/src/libnacl/okcompilers/test10.c deleted file mode 100644 index cf2e3790..00000000 --- a/src/libnacl/okcompilers/test10.c +++ /dev/null @@ -1,29 +0,0 @@ -int not3(int n) -{ - return n != 3; -} - -int bytes(int n) -{ - return (n + 7) / 8; -} - -long long shr32(long long n) -{ - return n >> 32; -} - -double double5(void) -{ - return 5.0; -} - -int intbytes(void) -{ - return sizeof(int); -} - -int longbytes(void) -{ - return sizeof(long); -} diff --git a/src/libnacl/okcompilers/test5.c b/src/libnacl/okcompilers/test5.c deleted file mode 100644 index 3b7efa25..00000000 --- a/src/libnacl/okcompilers/test5.c +++ /dev/null @@ -1,25 +0,0 @@ -extern int not3(int); -extern int bytes(int); -extern long long shr32(long long); -extern double double5(void); -extern int longbytes(void); -extern int intbytes(void); - -int main(int argc,char **argv) -{ - if (intbytes() != sizeof(int)) return 100; - if (longbytes() != sizeof(long)) return 100; - - if (not3(3)) return 100; - - /* on ppc32, gcc -mpowerpc64 produces SIGILL for >>32 */ - if (!not3(shr32(1))) return 100; - - /* on pentium 1, gcc -march=pentium2 produces SIGILL for (...+7)/8 */ - if (bytes(not3(1)) != 1) return 100; - - /* on pentium 1, gcc -march=prescott produces SIGILL for double comparison */ - if (double5() < 0) return 100; - - return 0; -} diff --git a/src/libnacl/okcompilers/test6.c b/src/libnacl/okcompilers/test6.c deleted file mode 100644 index cf2e3790..00000000 --- a/src/libnacl/okcompilers/test6.c +++ /dev/null @@ -1,29 +0,0 @@ -int not3(int n) -{ - return n != 3; -} - -int bytes(int n) -{ - return (n + 7) / 8; -} - -long long shr32(long long n) -{ - return n >> 32; -} - -double double5(void) -{ - return 5.0; -} - -int intbytes(void) -{ - return sizeof(int); -} - -int longbytes(void) -{ - return sizeof(long); -} diff --git a/src/libnacl/okcompilers/test9.c b/src/libnacl/okcompilers/test9.c deleted file mode 100644 index 3b7efa25..00000000 --- a/src/libnacl/okcompilers/test9.c +++ /dev/null @@ -1,25 +0,0 @@ -extern int not3(int); -extern int bytes(int); -extern long long shr32(long long); -extern double double5(void); -extern int longbytes(void); -extern int intbytes(void); - -int main(int argc,char **argv) -{ - if (intbytes() != sizeof(int)) return 100; - if (longbytes() != sizeof(long)) return 100; - - if (not3(3)) return 100; - - /* on ppc32, gcc -mpowerpc64 produces SIGILL for >>32 */ - if (!not3(shr32(1))) return 100; - - /* on pentium 1, gcc -march=pentium2 produces SIGILL for (...+7)/8 */ - if (bytes(not3(1)) != 1) return 100; - - /* on pentium 1, gcc -march=prescott produces SIGILL for double comparison */ - if (double5() < 0) return 100; - - return 0; -} diff --git a/src/libnacl/randombytes/do b/src/libnacl/randombytes/do deleted file mode 100755 index b2db184a..00000000 --- a/src/libnacl/randombytes/do +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -e - -okabi | ( - while read abi - do - - rm -f randombytes.o randombytes.h - - ( - echo devurandom - ) | ( - while read n - do - okc-$abi | ( - while read c - do - echo "=== `date` === Trying $n.c with $c..." >&2 - rm -f test randombytes-impl.o randombytes-impl.h randombytes-impl.c - cp $n.c randombytes-impl.c || continue - cp $n.h randombytes-impl.h || continue - $c -c randombytes-impl.c || continue - $c -o test test.c randombytes-impl.o || continue - [ -r /dev/urandom ] || continue - echo "=== `date` === Success. Using $n.c." >&2 - mkdir -p lib/$abi - mv randombytes-impl.o lib/$abi/randombytes.o - mkdir -p include/$abi - mv randombytes-impl.h include/$abi/randombytes.h - exit 0 - done - exit 111 - ) && exit 0 - done - exit 111 - ) || ( - echo ===== Giving up. >&2 - rm -f test randombytes-impl.o randombytes-impl.h randombytes-impl.c - exit 111 - ) || exit 111 - - done - exit 0 -) || exit 111 diff --git a/src/libnacl/randombytes/test.c b/src/libnacl/randombytes/test.c deleted file mode 100644 index 646811ca..00000000 --- a/src/libnacl/randombytes/test.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "randombytes-impl.h" - -unsigned char x[65536]; -unsigned long long freq[256]; - -int main() -{ - unsigned long long i; - - randombytes(x,sizeof x); - for (i = 0;i < 256;++i) freq[i] = 0; - for (i = 0;i < sizeof x;++i) ++freq[255 & (int) x[i]]; - for (i = 0;i < 256;++i) if (!freq[i]) return 111; - return 0; -} diff --git a/src/libnacl/tests/Makefile.in b/src/libnacl/tests/Makefile.in deleted file mode 100644 index 164d61c8..00000000 --- a/src/libnacl/tests/Makefile.in +++ /dev/null @@ -1,43 +0,0 @@ - -CC=@CC@ -CFLAGS=@CFLAGS@ -CPP=@CPPFLAGS@ -LDFLAGS=@LDFLAGS@ -LIBS=@LIBS@ - -TESTS_RESULTS = \ - auth.res auth2.res auth5.res box.res box2.res box7.res box8.res \ - core1.res core2.res core3.res core4.res core5.res core6.res \ - hash.res hash3.res onetimeauth.res onetimeauth2.res \ - onetimeauth7.res scalarmult.res scalarmult2.res scalarmult5.res \ - scalarmult6.res secretbox.res secretbox2.res secretbox7.res \ - secretbox8.res stream.res stream2.res stream3.res stream4.res - -all: test - -run-tests: $(TESTS_RESULTS) - -test: .done - -.done: run-tests - touch .done - -.exe.res: - outfile=`echo "$@" | sed 's/.res$$/.out/'` ; \ - `pwd`/$< | cmp $$outfile || exit 1 - -.c.exe: - nacl_lib="`pwd`/../../@NACL_PATH@/lib/local" ; \ - nacl_include="`pwd`/../../@NACL_PATH@/include/local" ; \ - nacl_include_extra="`pwd`/../../@NACL_PATH@/include" ; \ - $(CC) $(CPPFLAGS) $(CFLAGS) -I$$nacl_include -I$$nacl_include_extra $< $$nacl_lib/randombytes.o -o $@ $(LDFLAGS) -L$$nacl_lib -lnacl $(LIBS) - -clean: - -rm -f .done - -rm -f *.exe - -rm -f *.res - -rm -fr *.dSYM - -distclean: clean - -.SUFFIXES: .c .cpp .res .exe diff --git a/src/libnacl/tests/auth.c b/src/libnacl/tests/auth.c deleted file mode 100644 index 5086624e..00000000 --- a/src/libnacl/tests/auth.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include "crypto_auth_hmacsha512256.h" - -/* "Test Case 2" from RFC 4231 */ -unsigned char key[32] = "Jefe"; -unsigned char c[28] = "what do ya want for nothing?"; - -unsigned char a[32]; - -main() -{ - int i; - crypto_auth_hmacsha512256(a,c,sizeof c,key); - for (i = 0;i < 32;++i) { - printf(",0x%02x",(unsigned int) a[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/auth.out b/src/libnacl/tests/auth.out deleted file mode 100644 index 35e5909d..00000000 --- a/src/libnacl/tests/auth.out +++ /dev/null @@ -1,4 +0,0 @@ -,0x16,0x4b,0x7a,0x7b,0xfc,0xf8,0x19,0xe2 -,0xe3,0x95,0xfb,0xe7,0x3b,0x56,0xe0,0xa3 -,0x87,0xbd,0x64,0x22,0x2e,0x83,0x1f,0xd6 -,0x10,0x27,0x0c,0xd7,0xea,0x25,0x05,0x54 diff --git a/src/libnacl/tests/auth2.c b/src/libnacl/tests/auth2.c deleted file mode 100644 index ba191de4..00000000 --- a/src/libnacl/tests/auth2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* "Test Case AUTH256-4" from RFC 4868 */ - -#include -#include "crypto_auth_hmacsha256.h" - -unsigned char key[32] = { - 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 -,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 -,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 -,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20 -} ; - -unsigned char c[50] = { - 0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd -} ; - -unsigned char a[32]; - -main() -{ - int i; - crypto_auth_hmacsha256(a,c,sizeof c,key); - for (i = 0;i < 32;++i) { - printf(",0x%02x",(unsigned int) a[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/auth2.out b/src/libnacl/tests/auth2.out deleted file mode 100644 index 955951a2..00000000 --- a/src/libnacl/tests/auth2.out +++ /dev/null @@ -1,4 +0,0 @@ -,0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 -,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 -,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 -,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f diff --git a/src/libnacl/tests/auth3.c b/src/libnacl/tests/auth3.c deleted file mode 100644 index b713b388..00000000 --- a/src/libnacl/tests/auth3.c +++ /dev/null @@ -1,34 +0,0 @@ -/* "Test Case AUTH256-4" from RFC 4868 */ - -#include -#include "crypto_auth_hmacsha256.h" - -unsigned char key[32] = { - 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 -,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 -,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 -,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20 -} ; - -unsigned char c[50] = { - 0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd -} ; - -unsigned char a[32] = { - 0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 -,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 -,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 -,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f -} ; - -main() -{ - printf("%d\n",crypto_auth_hmacsha256_verify(a,c,sizeof c,key)); - return 0; -} diff --git a/src/libnacl/tests/auth3.out b/src/libnacl/tests/auth3.out deleted file mode 100644 index 573541ac..00000000 --- a/src/libnacl/tests/auth3.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/src/libnacl/tests/auth4.out b/src/libnacl/tests/auth4.out deleted file mode 100644 index 573541ac..00000000 --- a/src/libnacl/tests/auth4.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/src/libnacl/tests/auth5.c b/src/libnacl/tests/auth5.c deleted file mode 100644 index 92d8fea3..00000000 --- a/src/libnacl/tests/auth5.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include "crypto_auth_hmacsha512256.h" -#include "randombytes.h" -#include "windows/windows-quirks.h" - -unsigned char key[32]; -unsigned char c[10000]; -unsigned char a[32]; - -main() -{ - int clen; - int i; - for (clen = 0;clen < 10000;++clen) { - randombytes(key,sizeof key); - randombytes(c,clen); - crypto_auth_hmacsha512256(a,c,clen,key); - if (crypto_auth_hmacsha512256_verify(a,c,clen,key) != 0) { - printf("fail %d\n",clen); - return 100; - } - if (clen > 0) { - c[random() % clen] += 1 + (random() % 255); - if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) { - printf("forgery %d\n",clen); - return 100; - } - a[random() % sizeof a] += 1 + (random() % 255); - if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) { - printf("forgery %d\n",clen); - return 100; - } - } - } - return 0; -} diff --git a/src/libnacl/tests/auth5.out b/src/libnacl/tests/auth5.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/auth6.out b/src/libnacl/tests/auth6.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/box.c b/src/libnacl/tests/box.c deleted file mode 100644 index b57a9883..00000000 --- a/src/libnacl/tests/box.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include "crypto_box_curve25519xsalsa20poly1305.h" - -unsigned char alicesk[32] = { - 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d -,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 -,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a -,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a -} ; - -unsigned char bobpk[32] = { - 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 -,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 -,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d -,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -// API requires first 32 bytes to be 0 -unsigned char m[163] = { - 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 -} ; - -unsigned char c[163]; - -main() -{ - int i; - crypto_box_curve25519xsalsa20poly1305( - c,m,163,nonce,bobpk,alicesk - ); - for (i = 16;i < 163;++i) { - printf(",0x%02x",(unsigned int) c[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/box.out b/src/libnacl/tests/box.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/src/libnacl/tests/box.out +++ /dev/null @@ -1,19 +0,0 @@ -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 diff --git a/src/libnacl/tests/box2.c b/src/libnacl/tests/box2.c deleted file mode 100644 index 0a531142..00000000 --- a/src/libnacl/tests/box2.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include "crypto_box_curve25519xsalsa20poly1305.h" - -unsigned char bobsk[32] = { - 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b -,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 -,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd -,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb -} ; - -unsigned char alicepk[32] = { - 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 -,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a -,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 -,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -// API requires first 16 bytes to be 0 -unsigned char c[163] = { - 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -unsigned char m[163]; - -main() -{ - int i; - if (crypto_box_curve25519xsalsa20poly1305_open( - m,c,163,nonce,alicepk,bobsk - ) == 0) { - for (i = 32;i < 163;++i) { - printf(",0x%02x",(unsigned int) m[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/box2.out b/src/libnacl/tests/box2.out deleted file mode 100644 index c61d4557..00000000 --- a/src/libnacl/tests/box2.out +++ /dev/null @@ -1,17 +0,0 @@ -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 diff --git a/src/libnacl/tests/box3.out b/src/libnacl/tests/box3.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/src/libnacl/tests/box3.out +++ /dev/null @@ -1,19 +0,0 @@ -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 diff --git a/src/libnacl/tests/box4.out b/src/libnacl/tests/box4.out deleted file mode 100644 index c61d4557..00000000 --- a/src/libnacl/tests/box4.out +++ /dev/null @@ -1,17 +0,0 @@ -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 diff --git a/src/libnacl/tests/box5.out b/src/libnacl/tests/box5.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/box6.out b/src/libnacl/tests/box6.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/box7.c b/src/libnacl/tests/box7.c deleted file mode 100644 index 809301c1..00000000 --- a/src/libnacl/tests/box7.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include "crypto_box.h" -#include "randombytes.h" - -unsigned char alicesk[crypto_box_SECRETKEYBYTES]; -unsigned char alicepk[crypto_box_PUBLICKEYBYTES]; -unsigned char bobsk[crypto_box_SECRETKEYBYTES]; -unsigned char bobpk[crypto_box_PUBLICKEYBYTES]; -unsigned char n[crypto_box_NONCEBYTES]; -unsigned char m[10000]; -unsigned char c[10000]; -unsigned char m2[10000]; - -main() -{ - int mlen; - int i; - - for (mlen = 0;mlen < 1000 && mlen + crypto_box_ZEROBYTES < sizeof m;++mlen) { - crypto_box_keypair(alicepk,alicesk); - crypto_box_keypair(bobpk,bobsk); - randombytes(n,crypto_box_NONCEBYTES); - randombytes(m + crypto_box_ZEROBYTES,mlen); - crypto_box(c,m,mlen + crypto_box_ZEROBYTES,n,bobpk,alicesk); - if (crypto_box_open(m2,c,mlen + crypto_box_ZEROBYTES,n,alicepk,bobsk) == 0) { - for (i = 0;i < mlen + crypto_box_ZEROBYTES;++i) - if (m2[i] != m[i]) { - printf("bad decryption\n"); - break; - } - } else { - printf("ciphertext fails verification\n"); - } - } - return 0; -} diff --git a/src/libnacl/tests/box7.out b/src/libnacl/tests/box7.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/box8.c b/src/libnacl/tests/box8.c deleted file mode 100644 index 8f2b919a..00000000 --- a/src/libnacl/tests/box8.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include "crypto_box.h" -#include "randombytes.h" -#include "windows/windows-quirks.h" - -unsigned char alicesk[crypto_box_SECRETKEYBYTES]; -unsigned char alicepk[crypto_box_PUBLICKEYBYTES]; -unsigned char bobsk[crypto_box_SECRETKEYBYTES]; -unsigned char bobpk[crypto_box_PUBLICKEYBYTES]; -unsigned char n[crypto_box_NONCEBYTES]; -unsigned char m[10000]; -unsigned char c[10000]; -unsigned char m2[10000]; - -main() -{ - int mlen; - int i; - int caught; - - for (mlen = 0;mlen < 1000 && mlen + crypto_box_ZEROBYTES < sizeof m;++mlen) { - crypto_box_keypair(alicepk,alicesk); - crypto_box_keypair(bobpk,bobsk); - randombytes(n,crypto_box_NONCEBYTES); - randombytes(m + crypto_box_ZEROBYTES,mlen); - crypto_box(c,m,mlen + crypto_box_ZEROBYTES,n,bobpk,alicesk); - caught = 0; - while (caught < 10) { - c[random() % (mlen + crypto_box_ZEROBYTES)] = random(); - if (crypto_box_open(m2,c,mlen + crypto_box_ZEROBYTES,n,alicepk,bobsk) == 0) { - for (i = 0;i < mlen + crypto_box_ZEROBYTES;++i) - if (m2[i] != m[i]) { - printf("forgery\n"); - return 100; - } - } else { - ++caught; - } - } - } - return 0; -} diff --git a/src/libnacl/tests/box8.out b/src/libnacl/tests/box8.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/core1.c b/src/libnacl/tests/core1.c deleted file mode 100644 index 9a8fc51d..00000000 --- a/src/libnacl/tests/core1.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "crypto_core_hsalsa20.h" - -unsigned char shared[32] = { - 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 -,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 -,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 -,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 -} ; - -unsigned char zero[32] = { 0 }; - -unsigned char c[16] = { - 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33 -,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b -} ; - -unsigned char firstkey[32]; - -main() -{ - int i; - crypto_core_hsalsa20(firstkey,zero,shared,c); - for (i = 0;i < 32;++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) firstkey[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/core1.out b/src/libnacl/tests/core1.out deleted file mode 100644 index 715a489d..00000000 --- a/src/libnacl/tests/core1.out +++ /dev/null @@ -1,4 +0,0 @@ - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 diff --git a/src/libnacl/tests/core2.c b/src/libnacl/tests/core2.c deleted file mode 100644 index 08402285..00000000 --- a/src/libnacl/tests/core2.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include "crypto_core_hsalsa20.h" - -unsigned char firstkey[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -unsigned char nonceprefix[16] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -} ; - -unsigned char c[16] = { - 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33 -,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b -} ; - -unsigned char secondkey[32]; - -main() -{ - int i; - crypto_core_hsalsa20(secondkey,nonceprefix,firstkey,c); - for (i = 0;i < 32;++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) secondkey[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/core2.out b/src/libnacl/tests/core2.out deleted file mode 100644 index f4682af0..00000000 --- a/src/libnacl/tests/core2.out +++ /dev/null @@ -1,4 +0,0 @@ - 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 -,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 -,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 -,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 diff --git a/src/libnacl/tests/core3.c b/src/libnacl/tests/core3.c deleted file mode 100644 index 4c759a5b..00000000 --- a/src/libnacl/tests/core3.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include "crypto_core_salsa20.h" -#include "crypto_hash_sha256.h" - -unsigned char secondkey[32] = { - 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 -,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 -,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 -,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 -} ; - -unsigned char noncesuffix[8] = { - 0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -unsigned char c[16] = { - 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33 -,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b -} ; - -unsigned char in[16] = { 0 } ; - -unsigned char output[64 * 256 * 256]; - -unsigned char h[32]; - -main() -{ - int i; - long long pos = 0; - for (i = 0;i < 8;++i) in[i] = noncesuffix[i]; - do { - do { - crypto_core_salsa20(output + pos,in,secondkey,c); - pos += 64; - } while (++in[8]); - } while (++in[9]); - crypto_hash_sha256(h,output,sizeof output); - for (i = 0;i < 32;++i) printf("%02x",h[i]); printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/core3.out b/src/libnacl/tests/core3.out deleted file mode 100644 index 5fa208c1..00000000 --- a/src/libnacl/tests/core3.out +++ /dev/null @@ -1 +0,0 @@ -662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 diff --git a/src/libnacl/tests/core4.c b/src/libnacl/tests/core4.c deleted file mode 100644 index 1f238c5e..00000000 --- a/src/libnacl/tests/core4.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include "crypto_core_salsa20.h" - -unsigned char k[32] = { - 1, 2, 3, 4, 5, 6, 7, 8 -, 9, 10, 11, 12, 13, 14, 15, 16 -,201,202,203,204,205,206,207,208 -,209,210,211,212,213,214,215,216 -} ; - -unsigned char in[16] = { - 101,102,103,104,105,106,107,108 -,109,110,111,112,113,114,115,116 -} ; - -unsigned char c[16] = { - 101,120,112, 97,110,100, 32, 51 -, 50, 45, 98,121,116,101, 32,107 -} ; - -unsigned char out[64]; - -main() -{ - int i; - crypto_core_salsa20(out,in,k,c); - for (i = 0;i < 64;++i) { - if (i > 0) printf(","); else printf(" "); - printf("%3d",(unsigned int) out[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/core4.out b/src/libnacl/tests/core4.out deleted file mode 100644 index d04e5b5e..00000000 --- a/src/libnacl/tests/core4.out +++ /dev/null @@ -1,8 +0,0 @@ - 69, 37, 68, 39, 41, 15,107,193 -,255,139,122, 6,170,233,217, 98 -, 89,144,182,106, 21, 51,200, 65 -,239, 49,222, 34,215,114, 40,126 -,104,197, 7,225,197,153, 31, 2 -,102, 78, 76,176, 84,245,246,184 -,177,160,133,130, 6, 72,149,119 -,192,195,132,236,234,103,246, 74 diff --git a/src/libnacl/tests/core5.c b/src/libnacl/tests/core5.c deleted file mode 100644 index 6353477d..00000000 --- a/src/libnacl/tests/core5.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "crypto_core_hsalsa20.h" - -unsigned char k[32] = { - 0xee,0x30,0x4f,0xca,0x27,0x00,0x8d,0x8c -,0x12,0x6f,0x90,0x02,0x79,0x01,0xd8,0x0f -,0x7f,0x1d,0x8b,0x8d,0xc9,0x36,0xcf,0x3b -,0x9f,0x81,0x96,0x92,0x82,0x7e,0x57,0x77 -} ; - -unsigned char in[16] = { - 0x81,0x91,0x8e,0xf2,0xa5,0xe0,0xda,0x9b -,0x3e,0x90,0x60,0x52,0x1e,0x4b,0xb3,0x52 -} ; - -unsigned char c[16] = { - 101,120,112, 97,110,100, 32, 51 -, 50, 45, 98,121,116,101, 32,107 -} ; - -unsigned char out[32]; - -main() -{ - int i; - crypto_core_hsalsa20(out,in,k,c); - for (i = 0;i < 32;++i) { - printf(",0x%02x",(unsigned int) out[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/core5.out b/src/libnacl/tests/core5.out deleted file mode 100644 index 562cf717..00000000 --- a/src/libnacl/tests/core5.out +++ /dev/null @@ -1,4 +0,0 @@ -,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40 -,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45 -,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94 -,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd diff --git a/src/libnacl/tests/core6.c b/src/libnacl/tests/core6.c deleted file mode 100644 index 67f35df9..00000000 --- a/src/libnacl/tests/core6.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include "crypto_core_salsa20.h" - -unsigned char k[32] = { - 0xee,0x30,0x4f,0xca,0x27,0x00,0x8d,0x8c -,0x12,0x6f,0x90,0x02,0x79,0x01,0xd8,0x0f -,0x7f,0x1d,0x8b,0x8d,0xc9,0x36,0xcf,0x3b -,0x9f,0x81,0x96,0x92,0x82,0x7e,0x57,0x77 -} ; - -unsigned char in[16] = { - 0x81,0x91,0x8e,0xf2,0xa5,0xe0,0xda,0x9b -,0x3e,0x90,0x60,0x52,0x1e,0x4b,0xb3,0x52 -} ; - -unsigned char c[16] = { - 101,120,112, 97,110,100, 32, 51 -, 50, 45, 98,121,116,101, 32,107 -} ; - -unsigned char out[64]; - -void print(unsigned char *x,unsigned char *y) -{ - int i; - unsigned int borrow = 0; - for (i = 0;i < 4;++i) { - unsigned int xi = x[i]; - unsigned int yi = y[i]; - printf(",0x%02x",255 & (xi - yi - borrow)); - borrow = (xi < yi + borrow); - } -} - -main() -{ - crypto_core_salsa20(out,in,k,c); - print(out,c); - print(out + 20,c + 4); printf("\n"); - print(out + 40,c + 8); - print(out + 60,c + 12); printf("\n"); - print(out + 24,in); - print(out + 28,in + 4); printf("\n"); - print(out + 32,in + 8); - print(out + 36,in + 12); printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/core6.out b/src/libnacl/tests/core6.out deleted file mode 100644 index 562cf717..00000000 --- a/src/libnacl/tests/core6.out +++ /dev/null @@ -1,4 +0,0 @@ -,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40 -,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45 -,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94 -,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd diff --git a/src/libnacl/tests/hash.c b/src/libnacl/tests/hash.c deleted file mode 100644 index 8de470aa..00000000 --- a/src/libnacl/tests/hash.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "crypto_hash.h" - -unsigned char x[8] = "testing\n"; -unsigned char h[crypto_hash_BYTES]; - -int main() -{ - int i; - crypto_hash(h,x,sizeof x); - for (i = 0;i < crypto_hash_BYTES;++i) printf("%02x",(unsigned int) h[i]); - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/hash.out b/src/libnacl/tests/hash.out deleted file mode 100644 index df582172..00000000 --- a/src/libnacl/tests/hash.out +++ /dev/null @@ -1 +0,0 @@ -24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 diff --git a/src/libnacl/tests/hash2.out b/src/libnacl/tests/hash2.out deleted file mode 100644 index df582172..00000000 --- a/src/libnacl/tests/hash2.out +++ /dev/null @@ -1 +0,0 @@ -24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 diff --git a/src/libnacl/tests/hash3.c b/src/libnacl/tests/hash3.c deleted file mode 100644 index 10b89b90..00000000 --- a/src/libnacl/tests/hash3.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "crypto_hash_sha512.h" - -unsigned char x[8] = "testing\n"; -unsigned char h[crypto_hash_sha512_BYTES]; - -int main() -{ - int i; - crypto_hash_sha512(h,x,sizeof x); - for (i = 0;i < crypto_hash_sha512_BYTES;++i) printf("%02x",(unsigned int) h[i]); - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/hash3.out b/src/libnacl/tests/hash3.out deleted file mode 100644 index df582172..00000000 --- a/src/libnacl/tests/hash3.out +++ /dev/null @@ -1 +0,0 @@ -24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 diff --git a/src/libnacl/tests/hash4.out b/src/libnacl/tests/hash4.out deleted file mode 100644 index df582172..00000000 --- a/src/libnacl/tests/hash4.out +++ /dev/null @@ -1 +0,0 @@ -24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 diff --git a/src/libnacl/tests/onetimeauth.c b/src/libnacl/tests/onetimeauth.c deleted file mode 100644 index 60a2df14..00000000 --- a/src/libnacl/tests/onetimeauth.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include "crypto_onetimeauth_poly1305.h" - -unsigned char rs[32] = { - 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 -,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 -,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 -,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 -} ; - -unsigned char c[131] = { - 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -unsigned char a[16]; - -main() -{ - int i; - crypto_onetimeauth_poly1305(a,c,131,rs); - for (i = 0;i < 16;++i) { - printf(",0x%02x",(unsigned int) a[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/onetimeauth.out b/src/libnacl/tests/onetimeauth.out deleted file mode 100644 index 6d914615..00000000 --- a/src/libnacl/tests/onetimeauth.out +++ /dev/null @@ -1,2 +0,0 @@ -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 diff --git a/src/libnacl/tests/onetimeauth2.c b/src/libnacl/tests/onetimeauth2.c deleted file mode 100644 index 64c1a9cd..00000000 --- a/src/libnacl/tests/onetimeauth2.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "crypto_onetimeauth_poly1305.h" - -unsigned char rs[32] = { - 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 -,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 -,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 -,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 -} ; - -unsigned char c[131] = { - 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -unsigned char a[16] = { - 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -} ; - -main() -{ - printf("%d\n",crypto_onetimeauth_poly1305_verify(a,c,131,rs)); - return 0; -} diff --git a/src/libnacl/tests/onetimeauth2.out b/src/libnacl/tests/onetimeauth2.out deleted file mode 100644 index 573541ac..00000000 --- a/src/libnacl/tests/onetimeauth2.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/src/libnacl/tests/onetimeauth5.out b/src/libnacl/tests/onetimeauth5.out deleted file mode 100644 index 6d914615..00000000 --- a/src/libnacl/tests/onetimeauth5.out +++ /dev/null @@ -1,2 +0,0 @@ -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 diff --git a/src/libnacl/tests/onetimeauth6.out b/src/libnacl/tests/onetimeauth6.out deleted file mode 100644 index 573541ac..00000000 --- a/src/libnacl/tests/onetimeauth6.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/src/libnacl/tests/onetimeauth7.c b/src/libnacl/tests/onetimeauth7.c deleted file mode 100644 index e4b38618..00000000 --- a/src/libnacl/tests/onetimeauth7.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include "crypto_onetimeauth_poly1305.h" -#include "randombytes.h" -#include "windows/windows-quirks.h" - -unsigned char key[32]; -unsigned char c[10000]; -unsigned char a[16]; - -main() -{ - int clen; - int i; - for (clen = 0;clen < 10000;++clen) { - randombytes(key,sizeof key); - randombytes(c,clen); - crypto_onetimeauth_poly1305(a,c,clen,key); - if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) != 0) { - printf("fail %d\n",clen); - return 100; - } - if (clen > 0) { - c[random() % clen] += 1 + (random() % 255); - if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) == 0) { - printf("forgery %d\n",clen); - return 100; - } - a[random() % sizeof a] += 1 + (random() % 255); - if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) == 0) { - printf("forgery %d\n",clen); - return 100; - } - } - } - return 0; -} diff --git a/src/libnacl/tests/onetimeauth7.out b/src/libnacl/tests/onetimeauth7.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/onetimeauth8.out b/src/libnacl/tests/onetimeauth8.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/scalarmult.c b/src/libnacl/tests/scalarmult.c deleted file mode 100644 index d9265954..00000000 --- a/src/libnacl/tests/scalarmult.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include "crypto_scalarmult_curve25519.h" - -unsigned char alicesk[32] = { - 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d -,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 -,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a -,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a -} ; - -unsigned char alicepk[32]; - -main() -{ - int i; - crypto_scalarmult_curve25519_base(alicepk,alicesk); - for (i = 0;i < 32;++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) alicepk[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult.out b/src/libnacl/tests/scalarmult.out deleted file mode 100644 index ddd130d6..00000000 --- a/src/libnacl/tests/scalarmult.out +++ /dev/null @@ -1,4 +0,0 @@ - 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 -,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a -,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 -,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a diff --git a/src/libnacl/tests/scalarmult2.c b/src/libnacl/tests/scalarmult2.c deleted file mode 100644 index 90e6360d..00000000 --- a/src/libnacl/tests/scalarmult2.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include "crypto_scalarmult_curve25519.h" - -unsigned char bobsk[32] = { - 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b -,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 -,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd -,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb -} ; - -unsigned char bobpk[32]; - -main() -{ - int i; - crypto_scalarmult_curve25519_base(bobpk,bobsk); - for (i = 0;i < 32;++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) bobpk[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult2.out b/src/libnacl/tests/scalarmult2.out deleted file mode 100644 index b5391865..00000000 --- a/src/libnacl/tests/scalarmult2.out +++ /dev/null @@ -1,4 +0,0 @@ - 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 -,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 -,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d -,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f diff --git a/src/libnacl/tests/scalarmult3.out b/src/libnacl/tests/scalarmult3.out deleted file mode 100644 index ddd130d6..00000000 --- a/src/libnacl/tests/scalarmult3.out +++ /dev/null @@ -1,4 +0,0 @@ - 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 -,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a -,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 -,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a diff --git a/src/libnacl/tests/scalarmult4.out b/src/libnacl/tests/scalarmult4.out deleted file mode 100644 index b5391865..00000000 --- a/src/libnacl/tests/scalarmult4.out +++ /dev/null @@ -1,4 +0,0 @@ - 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 -,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 -,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d -,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f diff --git a/src/libnacl/tests/scalarmult5.c b/src/libnacl/tests/scalarmult5.c deleted file mode 100644 index 14f8159d..00000000 --- a/src/libnacl/tests/scalarmult5.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "crypto_scalarmult_curve25519.h" - -unsigned char alicesk[32] = { - 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d -,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 -,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a -,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a -} ; - -unsigned char bobpk[32] = { - 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 -,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 -,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d -,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f -} ; - -unsigned char k[32]; - -main() -{ - int i; - crypto_scalarmult_curve25519(k,alicesk,bobpk); - for (i = 0;i < 32;++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) k[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult5.out b/src/libnacl/tests/scalarmult5.out deleted file mode 100644 index bec21130..00000000 --- a/src/libnacl/tests/scalarmult5.out +++ /dev/null @@ -1,4 +0,0 @@ - 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 -,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 -,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 -,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 diff --git a/src/libnacl/tests/scalarmult6.c b/src/libnacl/tests/scalarmult6.c deleted file mode 100644 index 89bf9bdd..00000000 --- a/src/libnacl/tests/scalarmult6.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "crypto_scalarmult_curve25519.h" - -unsigned char bobsk[32] = { - 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b -,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 -,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd -,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb -} ; - -unsigned char alicepk[32] = { - 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 -,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a -,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 -,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a -} ; - -unsigned char k[32]; - -main() -{ - int i; - crypto_scalarmult_curve25519(k,bobsk,alicepk); - for (i = 0;i < 32;++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) k[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult6.out b/src/libnacl/tests/scalarmult6.out deleted file mode 100644 index bec21130..00000000 --- a/src/libnacl/tests/scalarmult6.out +++ /dev/null @@ -1,4 +0,0 @@ - 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 -,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 -,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 -,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 diff --git a/src/libnacl/tests/scalarmult7.out b/src/libnacl/tests/scalarmult7.out deleted file mode 100644 index bec21130..00000000 --- a/src/libnacl/tests/scalarmult7.out +++ /dev/null @@ -1,4 +0,0 @@ - 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 -,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 -,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 -,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 diff --git a/src/libnacl/tests/secretbox.c b/src/libnacl/tests/secretbox.c deleted file mode 100644 index 773f5b62..00000000 --- a/src/libnacl/tests/secretbox.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include "crypto_secretbox_xsalsa20poly1305.h" - -unsigned char firstkey[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -// API requires first 32 bytes to be 0 -unsigned char m[163] = { - 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 -} ; - -unsigned char c[163]; - -main() -{ - int i; - crypto_secretbox_xsalsa20poly1305( - c,m,163,nonce,firstkey - ); - for (i = 16;i < 163;++i) { - printf(",0x%02x",(unsigned int) c[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/secretbox.out b/src/libnacl/tests/secretbox.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/src/libnacl/tests/secretbox.out +++ /dev/null @@ -1,19 +0,0 @@ -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 diff --git a/src/libnacl/tests/secretbox2.c b/src/libnacl/tests/secretbox2.c deleted file mode 100644 index b6a2a937..00000000 --- a/src/libnacl/tests/secretbox2.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include "crypto_secretbox_xsalsa20poly1305.h" - -unsigned char firstkey[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -// API requires first 16 bytes to be 0 -unsigned char c[163] = { - 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -unsigned char m[163]; - -main() -{ - int i; - if (crypto_secretbox_xsalsa20poly1305_open( - m,c,163,nonce,firstkey - ) == 0) { - for (i = 32;i < 163;++i) { - printf(",0x%02x",(unsigned int) m[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/secretbox2.out b/src/libnacl/tests/secretbox2.out deleted file mode 100644 index c61d4557..00000000 --- a/src/libnacl/tests/secretbox2.out +++ /dev/null @@ -1,17 +0,0 @@ -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 diff --git a/src/libnacl/tests/secretbox3.out b/src/libnacl/tests/secretbox3.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/src/libnacl/tests/secretbox3.out +++ /dev/null @@ -1,19 +0,0 @@ -,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 diff --git a/src/libnacl/tests/secretbox4.out b/src/libnacl/tests/secretbox4.out deleted file mode 100644 index c61d4557..00000000 --- a/src/libnacl/tests/secretbox4.out +++ /dev/null @@ -1,17 +0,0 @@ -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 diff --git a/src/libnacl/tests/secretbox5.out b/src/libnacl/tests/secretbox5.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/secretbox6.out b/src/libnacl/tests/secretbox6.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/secretbox7.c b/src/libnacl/tests/secretbox7.c deleted file mode 100644 index d4be9b49..00000000 --- a/src/libnacl/tests/secretbox7.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "crypto_secretbox.h" -#include "randombytes.h" - -unsigned char k[crypto_secretbox_KEYBYTES]; -unsigned char n[crypto_secretbox_NONCEBYTES]; -unsigned char m[10000]; -unsigned char c[10000]; -unsigned char m2[10000]; - -main() -{ - int mlen; - int i; - - for (mlen = 0;mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m;++mlen) { - randombytes(k,crypto_secretbox_KEYBYTES); - randombytes(n,crypto_secretbox_NONCEBYTES); - randombytes(m + crypto_secretbox_ZEROBYTES,mlen); - crypto_secretbox(c,m,mlen + crypto_secretbox_ZEROBYTES,n,k); - if (crypto_secretbox_open(m2,c,mlen + crypto_secretbox_ZEROBYTES,n,k) == 0) { - for (i = 0;i < mlen + crypto_secretbox_ZEROBYTES;++i) - if (m2[i] != m[i]) { - printf("bad decryption\n"); - break; - } - } else { - printf("ciphertext fails verification\n"); - } - } - return 0; -} diff --git a/src/libnacl/tests/secretbox7.out b/src/libnacl/tests/secretbox7.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/secretbox8.c b/src/libnacl/tests/secretbox8.c deleted file mode 100644 index 3e0e8f80..00000000 --- a/src/libnacl/tests/secretbox8.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include "crypto_secretbox.h" -#include "randombytes.h" -#include "windows/windows-quirks.h" - -unsigned char k[crypto_secretbox_KEYBYTES]; -unsigned char n[crypto_secretbox_NONCEBYTES]; -unsigned char m[10000]; -unsigned char c[10000]; -unsigned char m2[10000]; - -main() -{ - int mlen; - int i; - int caught; - - for (mlen = 0;mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m;++mlen) { - randombytes(k,crypto_secretbox_KEYBYTES); - randombytes(n,crypto_secretbox_NONCEBYTES); - randombytes(m + crypto_secretbox_ZEROBYTES,mlen); - crypto_secretbox(c,m,mlen + crypto_secretbox_ZEROBYTES,n,k); - caught = 0; - while (caught < 10) { - c[random() % (mlen + crypto_secretbox_ZEROBYTES)] = random(); - if (crypto_secretbox_open(m2,c,mlen + crypto_secretbox_ZEROBYTES,n,k) == 0) { - for (i = 0;i < mlen + crypto_secretbox_ZEROBYTES;++i) - if (m2[i] != m[i]) { - printf("forgery\n"); - return 100; - } - } else { - ++caught; - } - } - } - return 0; -} diff --git a/src/libnacl/tests/secretbox8.out b/src/libnacl/tests/secretbox8.out deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/tests/stream.c b/src/libnacl/tests/stream.c deleted file mode 100644 index ebb39398..00000000 --- a/src/libnacl/tests/stream.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include "crypto_stream_xsalsa20.h" -#include "crypto_hash_sha256.h" - -unsigned char firstkey[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -unsigned char output[4194304]; - -unsigned char h[32]; - -main() -{ - int i; - crypto_stream_xsalsa20(output,4194304,nonce,firstkey); - crypto_hash_sha256(h,output,sizeof output); - for (i = 0;i < 32;++i) printf("%02x",h[i]); printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/stream.out b/src/libnacl/tests/stream.out deleted file mode 100644 index 5fa208c1..00000000 --- a/src/libnacl/tests/stream.out +++ /dev/null @@ -1 +0,0 @@ -662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 diff --git a/src/libnacl/tests/stream2.c b/src/libnacl/tests/stream2.c deleted file mode 100644 index 12f13de4..00000000 --- a/src/libnacl/tests/stream2.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include "crypto_stream_salsa20.h" -#include "crypto_hash_sha256.h" - -unsigned char secondkey[32] = { - 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 -,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 -,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 -,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 -} ; - -unsigned char noncesuffix[8] = { - 0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -unsigned char output[4194304]; - -unsigned char h[32]; - -main() -{ - int i; - crypto_stream_salsa20(output,4194304,noncesuffix,secondkey); - crypto_hash_sha256(h,output,sizeof output); - for (i = 0;i < 32;++i) printf("%02x",h[i]); printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/stream2.out b/src/libnacl/tests/stream2.out deleted file mode 100644 index 5fa208c1..00000000 --- a/src/libnacl/tests/stream2.out +++ /dev/null @@ -1 +0,0 @@ -662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 diff --git a/src/libnacl/tests/stream3.c b/src/libnacl/tests/stream3.c deleted file mode 100644 index 7798dc18..00000000 --- a/src/libnacl/tests/stream3.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include "crypto_stream_xsalsa20.h" - -unsigned char firstkey[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -unsigned char rs[32]; - -main() -{ - int i; - crypto_stream_xsalsa20(rs,32,nonce,firstkey); - for (i = 0;i < 32;++i) { - printf(",0x%02x",(unsigned int) rs[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/stream3.out b/src/libnacl/tests/stream3.out deleted file mode 100644 index 9cd78798..00000000 --- a/src/libnacl/tests/stream3.out +++ /dev/null @@ -1,4 +0,0 @@ -,0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 -,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 -,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 -,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 diff --git a/src/libnacl/tests/stream4.c b/src/libnacl/tests/stream4.c deleted file mode 100644 index 84d8c523..00000000 --- a/src/libnacl/tests/stream4.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include "crypto_stream_xsalsa20.h" - -unsigned char firstkey[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -unsigned char nonce[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -unsigned char m[163] = { - 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 -} ; - -unsigned char c[163]; - -main() -{ - int i; - crypto_stream_xsalsa20_xor(c,m,163,nonce,firstkey); - for (i = 32;i < 163;++i) { - printf(",0x%02x",(unsigned int) c[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/stream4.out b/src/libnacl/tests/stream4.out deleted file mode 100644 index 0d3d8e94..00000000 --- a/src/libnacl/tests/stream4.out +++ /dev/null @@ -1,17 +0,0 @@ -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 diff --git a/src/libnacl/tests/stream5.out b/src/libnacl/tests/stream5.out deleted file mode 100644 index 5fa208c1..00000000 --- a/src/libnacl/tests/stream5.out +++ /dev/null @@ -1 +0,0 @@ -662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 diff --git a/src/libnacl/tests/stream6.out b/src/libnacl/tests/stream6.out deleted file mode 100644 index 5fa208c1..00000000 --- a/src/libnacl/tests/stream6.out +++ /dev/null @@ -1 +0,0 @@ -662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 diff --git a/src/libnacl/tests/stream7.out b/src/libnacl/tests/stream7.out deleted file mode 100644 index 9cd78798..00000000 --- a/src/libnacl/tests/stream7.out +++ /dev/null @@ -1,4 +0,0 @@ -,0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 -,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 -,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 -,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 diff --git a/src/libnacl/tests/stream8.out b/src/libnacl/tests/stream8.out deleted file mode 100644 index 0d3d8e94..00000000 --- a/src/libnacl/tests/stream8.out +++ /dev/null @@ -1,17 +0,0 @@ -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 diff --git a/src/libnacl/try-anything.c b/src/libnacl/try-anything.c deleted file mode 100644 index aa6a2851..00000000 --- a/src/libnacl/try-anything.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * try-anything.c version 20090215 - * D. J. Bernstein - * Public domain. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _WIN32 -# include -#endif -#include "cpucycles.h" -#include "windows/windows-quirks.h" - -typedef uint32_t uint32; - -static uint32 seed[32] = { 3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4,3,3,8,3,2,7,9,5 } ; -static uint32 in[12]; -static uint32 out[8]; -static int outleft = 0; - -#define ROTATE(x,b) (((x) << (b)) | ((x) >> (32 - (b)))) -#define MUSH(i,b) x = t[i] += (((x ^ seed[i]) + sum) ^ ROTATE(x,b)); - -static void surf(void) -{ - uint32 t[12]; uint32 x; uint32 sum = 0; - int r; int i; int loop; - - for (i = 0;i < 12;++i) t[i] = in[i] ^ seed[12 + i]; - for (i = 0;i < 8;++i) out[i] = seed[24 + i]; - x = t[11]; - for (loop = 0;loop < 2;++loop) { - for (r = 0;r < 16;++r) { - sum += 0x9e3779b9; - MUSH(0,5) MUSH(1,7) MUSH(2,9) MUSH(3,13) - MUSH(4,5) MUSH(5,7) MUSH(6,9) MUSH(7,13) - MUSH(8,5) MUSH(9,7) MUSH(10,9) MUSH(11,13) - } - for (i = 0;i < 8;++i) out[i] ^= t[i + 4]; - } -} - -void randombytes(unsigned char *x,unsigned long long xlen) -{ - while (xlen > 0) { - if (!outleft) { - if (!++in[0]) if (!++in[1]) if (!++in[2]) ++in[3]; - surf(); - outleft = 8; - } - *x = out[--outleft]; - ++x; - --xlen; - } -} - -extern void preallocate(void); -extern void allocate(void); -extern void predoit(void); -extern void doit(void); -extern char checksum[]; -extern const char *checksum_compute(void); -extern const char *primitiveimplementation; - -static void printword(const char *s) -{ - if (!*s) putchar('-'); - while (*s) { - if (*s == ' ') putchar('_'); - else if (*s == '\t') putchar('_'); - else if (*s == '\r') putchar('_'); - else if (*s == '\n') putchar('_'); - else putchar(*s); - ++s; - } - putchar(' '); -} - -static void printnum(long long x) -{ - printf("%lld ",x); -} - -static void fail(const char *why) -{ - printf("%s\n",why); - exit(111); -} - -unsigned char *alignedcalloc(unsigned long long len) -{ - unsigned char *x = (unsigned char *) calloc(1,len + 256); - long long i; - if (!x) fail("out of memory"); - /* will never deallocate so shifting is ok */ - for (i = 0;i < len + 256;++i) x[i] = random(); - x += 64; - x += 63 & (-(unsigned long) x); - for (i = 0;i < len;++i) x[i] = 0; - return x; -} - -#define TIMINGS 63 -static long long cycles[TIMINGS + 1]; - -void limits() -{ -#ifdef RLIM_INFINITY - struct rlimit r; - r.rlim_cur = 0; - r.rlim_max = 0; -#ifdef RLIMIT_NOFILE - setrlimit(RLIMIT_NOFILE,&r); -#endif -#ifdef RLIMIT_NPROC - setrlimit(RLIMIT_NPROC,&r); -#endif -#ifdef RLIMIT_CORE - setrlimit(RLIMIT_CORE,&r); -#endif -#endif -} - -int main() -{ - long long i; - long long j; - long long abovej; - long long belowj; - long long checksumcycles; - long long cyclespersecond; - const char *problem; - - cyclespersecond = cpucycles_persecond(); - preallocate(); - limits(); - - allocate(); - srandom(getpid()); - - cycles[0] = cpucycles(); - problem = checksum_compute(); if (problem) fail(problem); - cycles[1] = cpucycles(); - checksumcycles = cycles[1] - cycles[0]; - - predoit(); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - } - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - doit(); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - for (j = 0;j < TIMINGS;++j) { - belowj = 0; - for (i = 0;i < TIMINGS;++i) if (cycles[i] < cycles[j]) ++belowj; - abovej = 0; - for (i = 0;i < TIMINGS;++i) if (cycles[i] > cycles[j]) ++abovej; - if (belowj * 2 < TIMINGS && abovej * 2 < TIMINGS) break; - } - - printword(checksum); - printnum(cycles[j]); - printnum(checksumcycles); - printnum(cyclespersecond); - printword(primitiveimplementation); - printf("\n"); - return 0; -} diff --git a/src/libnacl/version b/src/libnacl/version deleted file mode 100644 index 97840598..00000000 --- a/src/libnacl/version +++ /dev/null @@ -1 +0,0 @@ -20110221 diff --git a/src/libnacl/windows/include/windows-quirks.h b/src/libnacl/windows/include/windows-quirks.h deleted file mode 100644 index 11d82bf9..00000000 --- a/src/libnacl/windows/include/windows-quirks.h +++ /dev/null @@ -1,18 +0,0 @@ - -#include - -#ifdef _WIN32 - -static void -srandom(unsigned seed) -{ - srand(seed); -} - -static long -random(void) -{ - return (long) rand(); -} - -#endif