From b7fdeb5ed3ae2795c81a696a7abbc9e4d71ca2dc Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 21 Nov 2015 09:07:52 +0100 Subject: [PATCH] Stop hiding function names with macros in salsa20 --- src/libsodium/Makefile.am | 9 --------- src/libsodium/crypto_core/hsalsa20/ref2/api.h | 10 ---------- .../crypto_core/hsalsa20/ref2/core_hsalsa20.c | 4 ++-- src/libsodium/crypto_core/salsa20/ref/api.h | 10 ---------- src/libsodium/crypto_core/salsa20/ref/core_salsa20.c | 4 ++-- src/libsodium/crypto_core/salsa2012/ref/api.h | 10 ---------- .../crypto_core/salsa2012/ref/core_salsa2012.c | 4 ++-- src/libsodium/crypto_core/salsa208/ref/api.h | 10 ---------- .../crypto_core/salsa208/ref/core_salsa208.c | 4 ++-- src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h | 1 - src/libsodium/crypto_stream/salsa20/ref/api.h | 5 ----- .../crypto_stream/salsa20/ref/stream_salsa20_ref.c | 3 +-- .../crypto_stream/salsa20/ref/xor_salsa20_ref.c | 1 - src/libsodium/crypto_stream/salsa2012/ref/api.h | 10 ---------- .../crypto_stream/salsa2012/ref/stream_salsa2012.c | 3 +-- .../crypto_stream/salsa2012/ref/xor_salsa2012.c | 3 +-- src/libsodium/crypto_stream/salsa208/ref/api.h | 9 --------- .../crypto_stream/salsa208/ref/stream_salsa208.c | 3 +-- .../crypto_stream/salsa208/ref/xor_salsa208.c | 3 +-- src/libsodium/crypto_stream/xsalsa20/ref/api.h | 11 ----------- .../crypto_stream/xsalsa20/ref/stream_xsalsa20.c | 4 ++-- .../crypto_stream/xsalsa20/ref/xor_xsalsa20.c | 8 ++++---- 22 files changed, 19 insertions(+), 110 deletions(-) delete mode 100644 src/libsodium/crypto_core/hsalsa20/ref2/api.h delete mode 100644 src/libsodium/crypto_core/salsa20/ref/api.h delete mode 100644 src/libsodium/crypto_core/salsa2012/ref/api.h delete mode 100644 src/libsodium/crypto_core/salsa208/ref/api.h delete mode 100644 src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h delete mode 100644 src/libsodium/crypto_stream/salsa20/ref/api.h delete mode 100644 src/libsodium/crypto_stream/salsa2012/ref/api.h delete mode 100644 src/libsodium/crypto_stream/salsa208/ref/api.h delete mode 100644 src/libsodium/crypto_stream/xsalsa20/ref/api.h diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 670f29d2..daef094e 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -27,10 +27,8 @@ libsodium_la_SOURCES = \ crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c \ crypto_core/hsalsa20/ref2/core_hsalsa20.c \ crypto_core/hsalsa20/core_hsalsa20_api.c \ - crypto_core/hsalsa20/ref2/api.h \ crypto_core/salsa20/ref/core_salsa20.c \ crypto_core/salsa20/core_salsa20_api.c \ - crypto_core/salsa20/ref/api.h \ crypto_generichash/crypto_generichash.c \ crypto_generichash/blake2/generichash_blake2_api.c \ crypto_generichash/blake2/ref/api.h \ @@ -139,7 +137,6 @@ libsodium_la_SOURCES = \ crypto_stream/chacha20/ref/stream_chacha20_ref.c \ crypto_stream/salsa20/stream_salsa20_api.c \ crypto_stream/xsalsa20/stream_xsalsa20_api.c \ - crypto_stream/xsalsa20/ref/api.h \ crypto_stream/xsalsa20/ref/stream_xsalsa20.c \ crypto_stream/xsalsa20/ref/xor_xsalsa20.c \ crypto_verify/16/verify_16_api.c \ @@ -223,11 +220,9 @@ endif if HAVE_AMD64_ASM libsodium_la_SOURCES += \ - crypto_stream/salsa20/amd64_xmm6/api.h \ crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S else libsodium_la_SOURCES += \ - crypto_stream/salsa20/ref/api.h \ crypto_stream/salsa20/ref/stream_salsa20_ref.c \ crypto_stream/salsa20/ref/xor_salsa20_ref.c endif @@ -236,10 +231,8 @@ if !MINIMAL libsodium_la_SOURCES += \ crypto_core/salsa2012/ref/core_salsa2012.c \ crypto_core/salsa2012/core_salsa2012_api.c \ - crypto_core/salsa2012/ref/api.h \ crypto_core/salsa208/ref/core_salsa208.c \ crypto_core/salsa208/core_salsa208_api.c \ - crypto_core/salsa208/ref/api.h \ crypto_sign/ed25519/ref10/obsolete.c \ crypto_stream/aes128ctr/portable/afternm_aes128ctr.c \ crypto_stream/aes128ctr/stream_aes128ctr_api.c \ @@ -255,11 +248,9 @@ libsodium_la_SOURCES += \ crypto_stream/aes128ctr/portable/types.h \ crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c \ crypto_stream/salsa2012/stream_salsa2012_api.c \ - crypto_stream/salsa2012/ref/api.h \ crypto_stream/salsa2012/ref/stream_salsa2012.c \ crypto_stream/salsa2012/ref/xor_salsa2012.c \ crypto_stream/salsa208/stream_salsa208_api.c \ - crypto_stream/salsa208/ref/api.h \ crypto_stream/salsa208/ref/stream_salsa208.c \ crypto_stream/salsa208/ref/xor_salsa208.c endif diff --git a/src/libsodium/crypto_core/hsalsa20/ref2/api.h b/src/libsodium/crypto_core/hsalsa20/ref2/api.h deleted file mode 100644 index 582cba65..00000000 --- a/src/libsodium/crypto_core/hsalsa20/ref2/api.h +++ /dev/null @@ -1,10 +0,0 @@ - -#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_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION -#define crypto_core_VERSION crypto_core_hsalsa20_VERSION diff --git a/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c b/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c index c9bd359e..ae71f0bd 100644 --- a/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +++ b/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c @@ -4,7 +4,7 @@ D. J. Bernstein Public domain. */ -#include "api.h" +#include "crypto_core_hsalsa20.h" #define ROUNDS 20 @@ -33,7 +33,7 @@ static void store_littleendian(unsigned char *x,uint32 u) x[3] = u; } -int crypto_core( +int crypto_core_hsalsa20( unsigned char *out, const unsigned char *in, const unsigned char *k, diff --git a/src/libsodium/crypto_core/salsa20/ref/api.h b/src/libsodium/crypto_core/salsa20/ref/api.h deleted file mode 100644 index d34ddeb4..00000000 --- a/src/libsodium/crypto_core/salsa20/ref/api.h +++ /dev/null @@ -1,10 +0,0 @@ - -#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_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION -#define crypto_core_VERSION crypto_core_salsa20_VERSION diff --git a/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c b/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c index b2f6f5c7..80967911 100644 --- a/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +++ b/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c @@ -4,7 +4,7 @@ D. J. Bernstein Public domain. */ -#include "api.h" +#include "crypto_core_salsa20.h" #define ROUNDS 20 @@ -33,7 +33,7 @@ static void store_littleendian(unsigned char *x,uint32 u) x[3] = u; } -int crypto_core( +int crypto_core_salsa20( unsigned char *out, const unsigned char *in, const unsigned char *k, diff --git a/src/libsodium/crypto_core/salsa2012/ref/api.h b/src/libsodium/crypto_core/salsa2012/ref/api.h deleted file mode 100644 index 76919a0c..00000000 --- a/src/libsodium/crypto_core/salsa2012/ref/api.h +++ /dev/null @@ -1,10 +0,0 @@ - -#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_IMPLEMENTATION crypto_core_salsa2012_IMPLEMENTATION -#define crypto_core_VERSION crypto_core_salsa2012_VERSION diff --git a/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c b/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c index 07a72e71..2c3d5408 100644 --- a/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +++ b/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c @@ -4,7 +4,7 @@ D. J. Bernstein Public domain. */ -#include "api.h" +#include "crypto_core_salsa2012.h" #define ROUNDS 12 @@ -33,7 +33,7 @@ static void store_littleendian(unsigned char *x,uint32 u) x[3] = u; } -int crypto_core( +int crypto_core_salsa2012( unsigned char *out, const unsigned char *in, const unsigned char *k, diff --git a/src/libsodium/crypto_core/salsa208/ref/api.h b/src/libsodium/crypto_core/salsa208/ref/api.h deleted file mode 100644 index 07d090b3..00000000 --- a/src/libsodium/crypto_core/salsa208/ref/api.h +++ /dev/null @@ -1,10 +0,0 @@ - -#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_IMPLEMENTATION crypto_core_salsa208_IMPLEMENTATION -#define crypto_core_VERSION crypto_core_salsa208_VERSION diff --git a/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c b/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c index be26f82a..5078bfb7 100644 --- a/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +++ b/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c @@ -4,7 +4,7 @@ D. J. Bernstein Public domain. */ -#include "api.h" +#include "crypto_core_salsa208.h" #define ROUNDS 8 @@ -33,7 +33,7 @@ static void store_littleendian(unsigned char *x,uint32 u) x[3] = u; } -int crypto_core( +int crypto_core_salsa208( unsigned char *out, const unsigned char *in, const unsigned char *k, diff --git a/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h b/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h deleted file mode 100644 index 037fb59d..00000000 --- a/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h +++ /dev/null @@ -1 +0,0 @@ -#include "crypto_stream_salsa20.h" diff --git a/src/libsodium/crypto_stream/salsa20/ref/api.h b/src/libsodium/crypto_stream/salsa20/ref/api.h deleted file mode 100644 index 3616ea71..00000000 --- a/src/libsodium/crypto_stream/salsa20/ref/api.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include "crypto_stream_salsa20.h" - -#define crypto_stream crypto_stream_salsa20 -#define crypto_stream_xor crypto_stream_salsa20_xor diff --git a/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c b/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c index b90827c0..b9844ae2 100644 --- a/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +++ b/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c @@ -4,7 +4,6 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_salsa20.h" #include "utils.h" @@ -16,7 +15,7 @@ static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream( +int crypto_stream_salsa20( unsigned char *c,unsigned long long clen, const unsigned char *n, const unsigned char *k diff --git a/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c b/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c index 27cf1470..3133e66d 100644 --- a/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +++ b/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c @@ -6,7 +6,6 @@ Public domain. #include -#include "api.h" #include "crypto_core_salsa20.h" #include "utils.h" diff --git a/src/libsodium/crypto_stream/salsa2012/ref/api.h b/src/libsodium/crypto_stream/salsa2012/ref/api.h deleted file mode 100644 index 0efe8b8a..00000000 --- a/src/libsodium/crypto_stream/salsa2012/ref/api.h +++ /dev/null @@ -1,10 +0,0 @@ - -#include "crypto_stream_salsa2012.h" - -#define crypto_stream crypto_stream_salsa2012 -#define crypto_stream_xor crypto_stream_salsa2012_xor -#define crypto_stream_KEYBYTES crypto_stream_salsa2012_KEYBYTES -#define crypto_stream_NONCEBYTES crypto_stream_salsa2012_NONCEBYTES -#define crypto_stream_IMPLEMENTATION crypto_stream_salsa2012_IMPLEMENTATION -#define crypto_stream_VERSION crypto_stream_salsa2012_VERSION - diff --git a/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c index ef121235..38492012 100644 --- a/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +++ b/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c @@ -4,7 +4,6 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_salsa2012.h" #include "utils.h" @@ -14,7 +13,7 @@ static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream( +int crypto_stream_salsa2012( unsigned char *c,unsigned long long clen, const unsigned char *n, const unsigned char *k diff --git a/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c index 132a720a..951dc70f 100644 --- a/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +++ b/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c @@ -4,7 +4,6 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_salsa2012.h" #include "utils.h" @@ -14,7 +13,7 @@ static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream_xor( +int crypto_stream_salsa2012_xor( unsigned char *c, const unsigned char *m,unsigned long long mlen, const unsigned char *n, diff --git a/src/libsodium/crypto_stream/salsa208/ref/api.h b/src/libsodium/crypto_stream/salsa208/ref/api.h deleted file mode 100644 index 14b4a775..00000000 --- a/src/libsodium/crypto_stream/salsa208/ref/api.h +++ /dev/null @@ -1,9 +0,0 @@ - -#include "crypto_stream_salsa208.h" - -#define crypto_stream crypto_stream_salsa208 -#define crypto_stream_xor crypto_stream_salsa208_xor -#define crypto_stream_KEYBYTES crypto_stream_salsa208_KEYBYTES -#define crypto_stream_NONCEBYTES crypto_stream_salsa208_NONCEBYTES -#define crypto_stream_IMPLEMENTATION crypto_stream_salsa208_IMPLEMENTATION -#define crypto_stream_VERSION crypto_stream_salsa208_VERSION diff --git a/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c b/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c index 6a15ff15..fe036a1c 100644 --- a/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +++ b/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c @@ -4,7 +4,6 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_salsa208.h" #include "utils.h" @@ -14,7 +13,7 @@ static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream( +int crypto_stream_salsa208( unsigned char *c,unsigned long long clen, const unsigned char *n, const unsigned char *k diff --git a/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c b/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c index de0eae9f..bdc9052c 100644 --- a/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +++ b/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c @@ -4,7 +4,6 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_salsa208.h" #include "utils.h" @@ -14,7 +13,7 @@ static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream_xor( +int crypto_stream_salsa208_xor( unsigned char *c, const unsigned char *m,unsigned long long mlen, const unsigned char *n, diff --git a/src/libsodium/crypto_stream/xsalsa20/ref/api.h b/src/libsodium/crypto_stream/xsalsa20/ref/api.h deleted file mode 100644 index 1812709e..00000000 --- a/src/libsodium/crypto_stream/xsalsa20/ref/api.h +++ /dev/null @@ -1,11 +0,0 @@ - -#include "crypto_stream_xsalsa20.h" - -#define crypto_stream crypto_stream_xsalsa20 -#define crypto_stream_xor_ic crypto_stream_xsalsa20_xor_ic -#define crypto_stream_xor crypto_stream_xsalsa20_xor -#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES -#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES -#define crypto_stream_IMPLEMENTATION crypto_stream_xsalsa20_IMPLEMENTATION -#define crypto_stream_VERSION crypto_stream_xsalsa20_VERSION - diff --git a/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c b/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c index 64e42cb7..c6614cbb 100644 --- a/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +++ b/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c @@ -4,16 +4,16 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_hsalsa20.h" #include "crypto_stream_salsa20.h" +#include "crypto_stream_xsalsa20.h" #include "utils.h" static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream( +int crypto_stream_xsalsa20( unsigned char *c,unsigned long long clen, const unsigned char *n, const unsigned char *k diff --git a/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c b/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c index 4dd2fadd..b38c6510 100644 --- a/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +++ b/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c @@ -4,16 +4,16 @@ D. J. Bernstein Public domain. */ -#include "api.h" #include "crypto_core_hsalsa20.h" #include "crypto_stream_salsa20.h" +#include "crypto_stream_xsalsa20.h" #include "utils.h" static const unsigned char sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; -int crypto_stream_xor_ic( +int crypto_stream_xsalsa20_xor_ic( unsigned char *c, const unsigned char *m,unsigned long long mlen, const unsigned char *n,uint64_t ic, @@ -28,12 +28,12 @@ int crypto_stream_xor_ic( return ret; } -int crypto_stream_xor( +int crypto_stream_xsalsa20_xor( unsigned char *c, const unsigned char *m,unsigned long long mlen, const unsigned char *n, const unsigned char *k ) { - return crypto_stream_xor_ic(c, m, mlen, n, 0ULL, k); + return crypto_stream_xsalsa20_xor_ic(c, m, mlen, n, 0ULL, k); }