From b01f2864730c076945cc78b4fd3abc8c1860ae53 Mon Sep 17 00:00:00 2001 From: ShenNoether Date: Sun, 23 Aug 2015 14:18:59 -0600 Subject: Added shen_ed25519_ref to crypto ops subfolder, the point is to directly have bitmonero's crypto code come from bernstein et al's ref 10 code --- src/crypto/shen_ed25519_ref | 1 + 1 file changed, 1 insertion(+) create mode 160000 src/crypto/shen_ed25519_ref (limited to 'src/crypto/shen_ed25519_ref/include') diff --git a/src/crypto/shen_ed25519_ref b/src/crypto/shen_ed25519_ref new file mode 160000 index 000000000..ecfb9166a --- /dev/null +++ b/src/crypto/shen_ed25519_ref @@ -0,0 +1 @@ +Subproject commit ecfb9166ab10de6c42f89e5ccb22ac9547505218 -- cgit v1.2.3 From 0d70fdca8c04b0dcb3be5ecb5cfff6a8b645ae53 Mon Sep 17 00:00:00 2001 From: ShenNoether Date: Sun, 23 Aug 2015 14:46:44 -0600 Subject: revert to 776b4fc91a821be152f0f23e6873aabb78a72029 --- src/crypto/shen_ed25519_ref | 1 - 1 file changed, 1 deletion(-) delete mode 160000 src/crypto/shen_ed25519_ref (limited to 'src/crypto/shen_ed25519_ref/include') diff --git a/src/crypto/shen_ed25519_ref b/src/crypto/shen_ed25519_ref deleted file mode 160000 index ecfb9166a..000000000 --- a/src/crypto/shen_ed25519_ref +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ecfb9166ab10de6c42f89e5ccb22ac9547505218 -- cgit v1.2.3 From 0a4bc84b2f681dfd89b501648f65a951d876e2d8 Mon Sep 17 00:00:00 2001 From: ShenNoether Date: Sun, 23 Aug 2015 14:48:50 -0600 Subject: Added ref10 shen_ed25519_ref code, which includes code that can replace crypto-ops with a version straight from Bernstein's ref 10 --- src/crypto/shen_ed25519_ref/include/Makefile.am | 62 ++++++++++++++++++++++ .../shen_ed25519_ref/include/libsodium_LICENSE | 16 ++++++ src/crypto/shen_ed25519_ref/include/sodium.h | 50 +++++++++++++++++ .../shen_ed25519_ref/include/sodium/crypto_int32.h | 8 +++ .../shen_ed25519_ref/include/sodium/crypto_int64.h | 8 +++ .../include/sodium/crypto_uint16.h | 8 +++ .../include/sodium/crypto_uint32.h | 8 +++ .../include/sodium/crypto_uint64.h | 8 +++ .../shen_ed25519_ref/include/sodium/crypto_uint8.h | 8 +++ .../include/sodium/crypto_verify_32.h | 22 ++++++++ .../shen_ed25519_ref/include/sodium/randombytes.h | 58 ++++++++++++++++++++ 11 files changed, 256 insertions(+) create mode 100644 src/crypto/shen_ed25519_ref/include/Makefile.am create mode 100644 src/crypto/shen_ed25519_ref/include/libsodium_LICENSE create mode 100644 src/crypto/shen_ed25519_ref/include/sodium.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_int32.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_int64.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_uint16.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_uint32.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_uint64.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_uint8.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/crypto_verify_32.h create mode 100644 src/crypto/shen_ed25519_ref/include/sodium/randombytes.h (limited to 'src/crypto/shen_ed25519_ref/include') diff --git a/src/crypto/shen_ed25519_ref/include/Makefile.am b/src/crypto/shen_ed25519_ref/include/Makefile.am new file mode 100644 index 000000000..894c371a3 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/Makefile.am @@ -0,0 +1,62 @@ + +SODIUM_EXPORT = \ + sodium.h \ + sodium/core.h \ + sodium/crypto_aead_chacha20poly1305.h \ + sodium/crypto_auth.h \ + sodium/crypto_auth_hmacsha256.h \ + sodium/crypto_auth_hmacsha512.h \ + sodium/crypto_auth_hmacsha512256.h \ + sodium/crypto_box.h \ + sodium/crypto_box_curve25519xsalsa20poly1305.h \ + sodium/crypto_core_hsalsa20.h \ + sodium/crypto_core_salsa20.h \ + sodium/crypto_core_salsa2012.h \ + sodium/crypto_core_salsa208.h \ + sodium/crypto_generichash.h \ + sodium/crypto_generichash_blake2b.h \ + sodium/crypto_hash.h \ + sodium/crypto_hash_sha256.h \ + sodium/crypto_hash_sha512.h \ + sodium/crypto_onetimeauth.h \ + sodium/crypto_onetimeauth_poly1305.h \ + sodium/crypto_pwhash_scryptsalsa208sha256.h \ + sodium/crypto_scalarmult.h \ + sodium/crypto_scalarmult_curve25519.h \ + sodium/crypto_secretbox.h \ + sodium/crypto_secretbox_xsalsa20poly1305.h \ + sodium/crypto_shorthash.h \ + sodium/crypto_shorthash_siphash24.h \ + sodium/crypto_sign.h \ + sodium/crypto_sign_ed25519.h \ + sodium/crypto_sign_edwards25519sha512batch.h \ + sodium/crypto_stream.h \ + sodium/crypto_stream_aes128ctr.h \ + sodium/crypto_stream_chacha20.h \ + sodium/crypto_stream_salsa20.h \ + sodium/crypto_stream_salsa2012.h \ + sodium/crypto_stream_salsa208.h \ + sodium/crypto_stream_xsalsa20.h \ + sodium/crypto_int32.h \ + sodium/crypto_int64.h \ + sodium/crypto_uint16.h \ + sodium/crypto_uint32.h \ + sodium/crypto_uint64.h \ + sodium/crypto_uint8.h \ + sodium/crypto_verify_16.h \ + sodium/crypto_verify_32.h \ + sodium/crypto_verify_64.h \ + sodium/export.h \ + sodium/randombytes.h \ + sodium/randombytes_salsa20_random.h \ + sodium/randombytes_sysrandom.h \ + sodium/runtime.h \ + sodium/utils.h + +EXTRA_SRC = $(SODIUM_EXPORT) \ + sodium/version.h.in + +nobase_include_HEADERS = $(SODIUM_EXPORT) + +nobase_nodist_include_HEADERS = \ + sodium/version.h diff --git a/src/crypto/shen_ed25519_ref/include/libsodium_LICENSE b/src/crypto/shen_ed25519_ref/include/libsodium_LICENSE new file mode 100644 index 000000000..3edb000f6 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/libsodium_LICENSE @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2013-2015 + * Frank Denis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/crypto/shen_ed25519_ref/include/sodium.h b/src/crypto/shen_ed25519_ref/include/sodium.h new file mode 100644 index 000000000..207bdedeb --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium.h @@ -0,0 +1,50 @@ + +#ifndef sodium_H +#define sodium_H + +#include "sodium/core.h" +#include "sodium/crypto_aead_chacha20poly1305.h" +#include "sodium/crypto_auth.h" +#include "sodium/crypto_auth_hmacsha256.h" +#include "sodium/crypto_auth_hmacsha512.h" +#include "sodium/crypto_auth_hmacsha512256.h" +#include "sodium/crypto_box.h" +#include "sodium/crypto_box_curve25519xsalsa20poly1305.h" +#include "sodium/crypto_core_hsalsa20.h" +#include "sodium/crypto_core_salsa20.h" +#include "sodium/crypto_core_salsa2012.h" +#include "sodium/crypto_core_salsa208.h" +#include "sodium/crypto_generichash.h" +#include "sodium/crypto_generichash_blake2b.h" +#include "sodium/crypto_hash.h" +#include "sodium/crypto_hash_sha256.h" +#include "sodium/crypto_hash_sha512.h" +#include "sodium/crypto_onetimeauth.h" +#include "sodium/crypto_onetimeauth_poly1305.h" +#include "sodium/crypto_pwhash_scryptsalsa208sha256.h" +#include "sodium/crypto_scalarmult.h" +#include "sodium/crypto_scalarmult_curve25519.h" +#include "sodium/crypto_secretbox.h" +#include "sodium/crypto_secretbox_xsalsa20poly1305.h" +#include "sodium/crypto_shorthash.h" +#include "sodium/crypto_shorthash_siphash24.h" +#include "sodium/crypto_sign.h" +#include "sodium/crypto_sign_ed25519.h" +#include "sodium/crypto_stream.h" +#include "sodium/crypto_stream_aes128ctr.h" +#include "sodium/crypto_stream_chacha20.h" +#include "sodium/crypto_stream_salsa20.h" +#include "sodium/crypto_stream_salsa2012.h" +#include "sodium/crypto_stream_salsa208.h" +#include "sodium/crypto_stream_xsalsa20.h" +#include "sodium/crypto_verify_16.h" +#include "sodium/crypto_verify_32.h" +#include "sodium/crypto_verify_64.h" +#include "sodium/randombytes.h" +#include "sodium/randombytes_salsa20_random.h" +#include "sodium/randombytes_sysrandom.h" +#include "sodium/runtime.h" +#include "sodium/utils.h" +#include "sodium/version.h" + +#endif diff --git a/src/crypto/shen_ed25519_ref/include/sodium/crypto_int32.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_int32.h new file mode 100644 index 000000000..a22019d87 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/crypto_int32.h @@ -0,0 +1,8 @@ +#ifndef crypto_int32_H +#define crypto_int32_H + +#include + +typedef int32_t crypto_int32; + +#endif diff --git a/src/crypto/shen_ed25519_ref/include/sodium/crypto_int64.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_int64.h new file mode 100644 index 000000000..f68a28361 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/crypto_int64.h @@ -0,0 +1,8 @@ +#ifndef crypto_int64_H +#define crypto_int64_H + +#include + +typedef int64_t crypto_int64; + +#endif diff --git a/src/crypto/shen_ed25519_ref/include/sodium/crypto_uint16.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_uint16.h new file mode 100644 index 000000000..6be4e347c --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/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/crypto/shen_ed25519_ref/include/sodium/crypto_uint32.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_uint32.h new file mode 100644 index 000000000..ba66cecc6 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/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/crypto/shen_ed25519_ref/include/sodium/crypto_uint64.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_uint64.h new file mode 100644 index 000000000..98b3f6d34 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/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/crypto/shen_ed25519_ref/include/sodium/crypto_uint8.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_uint8.h new file mode 100644 index 000000000..789613ba5 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/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/crypto/shen_ed25519_ref/include/sodium/crypto_verify_32.h b/src/crypto/shen_ed25519_ref/include/sodium/crypto_verify_32.h new file mode 100644 index 000000000..58e4d0e82 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/crypto_verify_32.h @@ -0,0 +1,22 @@ +#ifndef crypto_verify_32_H +#define crypto_verify_32_H + +#include +#include "export.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define crypto_verify_32_BYTES 32U +SODIUM_EXPORT +size_t crypto_verify_32_bytes(void); + +SODIUM_EXPORT +int crypto_verify_32(const unsigned char *x, const unsigned char *y); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/crypto/shen_ed25519_ref/include/sodium/randombytes.h b/src/crypto/shen_ed25519_ref/include/sodium/randombytes.h new file mode 100644 index 000000000..08aff0525 --- /dev/null +++ b/src/crypto/shen_ed25519_ref/include/sodium/randombytes.h @@ -0,0 +1,58 @@ + +#ifndef randombytes_H +#define randombytes_H + +#include + +#include +#include + +#include "export.h" + +#ifdef __cplusplus +# if __GNUC__ +# pragma GCC diagnostic ignored "-Wlong-long" +# endif +extern "C" { +#endif + +typedef struct randombytes_implementation { + const char *(*implementation_name)(void); /* required */ + uint32_t (*random)(void); /* required */ + void (*stir)(void); /* optional */ + uint32_t (*uniform)(const uint32_t upper_bound); /* optional, a default implementation will be used if NULL */ + void (*buf)(void * const buf, const size_t size); /* required */ + int (*close)(void); /* optional */ +} randombytes_implementation; + +SODIUM_EXPORT +void randombytes_buf(void * const buf, const size_t size); + +SODIUM_EXPORT +uint32_t randombytes_random(void); + +SODIUM_EXPORT +uint32_t randombytes_uniform(const uint32_t upper_bound); + +SODIUM_EXPORT +void randombytes_stir(void); + +SODIUM_EXPORT +int randombytes_close(void); + +SODIUM_EXPORT +int randombytes_set_implementation(randombytes_implementation *impl); + +SODIUM_EXPORT +const char *randombytes_implementation_name(void); + +/* -- NaCl compatibility interface -- */ + +SODIUM_EXPORT +void randombytes(unsigned char * const buf, const unsigned long long buf_len); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3