From 8eea4a3f74e271e88dff53dd3129bfa8b64e7b54 Mon Sep 17 00:00:00 2001 From: Stephen Touset Date: Thu, 16 May 2013 13:03:51 -0700 Subject: [PATCH 1/3] Add functions exposing constants for all operation/primitive pairs Wrappers for other languages can't access constants defined by C preprocessor macros, so they must be exposed as functions. This was already done for the "default" implementation of each operation, but this commit adds functions for (almost) all of the underlying primitives. A few are currently excluded due to problems with the automated script used to generated this commit. They are: * crypto_onetimeauth_poly1305 * crypto_generichash_blake2b * crypto_verify16 * crypto_verify32 --- src/libsodium/Makefile.am | 21 +++++++++- .../crypto_auth/hmacsha256/auth_hmacsha256.c | 16 ++++++++ .../hmacsha512256/auth_hmacsha512256.c | 16 ++++++++ .../box_curve25519xsalsa20poly1305.c | 41 +++++++++++++++++++ .../crypto_core/hsalsa20/core_hsalsa20.c | 26 ++++++++++++ .../crypto_core/salsa20/core_salsa20.c | 26 ++++++++++++ .../crypto_core/salsa2012/core_salsa2012.c | 26 ++++++++++++ .../crypto_core/salsa208/core_salsa208.c | 26 ++++++++++++ .../crypto_hash/sha256/hash_sha256.c | 11 +++++ .../crypto_hash/sha512/hash_sha512.c | 11 +++++ .../sha256/hashblocks_sha256.c | 16 ++++++++ .../sha512/hashblocks_sha512.c | 16 ++++++++ .../curve25519/scalarmult_curve25519.c | 1 + .../secretbox_xsalsa20poly1305.c | 26 ++++++++++++ .../siphash24/shorthash_siphash24.c | 11 +++++ .../crypto_sign/ed25519/sign_ed25519.c | 21 ++++++++++ .../sign_edwards25519sha512batch.c | 21 ++++++++++ .../aes128ctr/stream_aes128ctr.c | 21 ++++++++++ .../aes256estream/stream_aes256estream.c | 21 ++++++++++ .../crypto_stream/salsa20/stream_salsa20.c | 1 + .../salsa2012/stream_salsa2012.c | 16 ++++++++ .../crypto_stream/salsa208/stream_salsa208.c | 16 ++++++++ .../crypto_stream/xsalsa20/stream_xsalsa20.c | 16 ++++++++ .../include/sodium/crypto_auth_hmacsha256.h | 10 +++++ .../sodium/crypto_auth_hmacsha512256.h | 10 +++++ .../crypto_box_curve25519xsalsa20poly1305.h | 25 +++++++++++ .../include/sodium/crypto_core_hsalsa20.h | 16 ++++++++ .../include/sodium/crypto_core_salsa20.h | 16 ++++++++ .../include/sodium/crypto_core_salsa2012.h | 16 ++++++++ .../include/sodium/crypto_core_salsa208.h | 16 ++++++++ .../include/sodium/crypto_hash_sha256.h | 7 ++++ .../include/sodium/crypto_hash_sha512.h | 7 ++++ .../include/sodium/crypto_hashblocks_sha256.h | 10 +++++ .../include/sodium/crypto_hashblocks_sha512.h | 10 +++++ .../crypto_secretbox_xsalsa20poly1305.h | 16 ++++++++ .../sodium/crypto_shorthash_siphash24.h | 7 ++++ .../include/sodium/crypto_sign_ed25519.h | 13 ++++++ .../crypto_sign_edwards25519sha512batch.h | 13 ++++++ .../include/sodium/crypto_stream_aes128ctr.h | 13 ++++++ .../sodium/crypto_stream_aes256estream.h | 13 ++++++ .../include/sodium/crypto_stream_salsa2012.h | 10 +++++ .../include/sodium/crypto_stream_salsa208.h | 10 +++++ .../include/sodium/crypto_stream_xsalsa20.h | 10 +++++ 43 files changed, 670 insertions(+), 1 deletion(-) create mode 100644 src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c create mode 100644 src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c create mode 100644 src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c create mode 100644 src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c create mode 100644 src/libsodium/crypto_core/salsa20/core_salsa20.c create mode 100644 src/libsodium/crypto_core/salsa2012/core_salsa2012.c create mode 100644 src/libsodium/crypto_core/salsa208/core_salsa208.c create mode 100644 src/libsodium/crypto_hash/sha256/hash_sha256.c create mode 100644 src/libsodium/crypto_hash/sha512/hash_sha512.c create mode 100644 src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256.c create mode 100644 src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512.c create mode 100644 src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c create mode 100644 src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c create mode 100644 src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c create mode 100644 src/libsodium/crypto_sign/ed25519/sign_ed25519.c create mode 100644 src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c create mode 100644 src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c create mode 100644 src/libsodium/crypto_stream/aes256estream/stream_aes256estream.c create mode 100644 src/libsodium/crypto_stream/salsa20/stream_salsa20.c create mode 100644 src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c create mode 100644 src/libsodium/crypto_stream/salsa208/stream_salsa208.c create mode 100644 src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index da5900ef..26555a3a 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -1,28 +1,34 @@ - lib_LTLIBRARIES = \ libsodium.la libsodium_la_SOURCES = \ crypto_auth/crypto_auth.c \ + crypto_auth/hmacsha256/auth_hmacsha256.c \ crypto_auth/hmacsha256/ref/api.h \ crypto_auth/hmacsha256/ref/hmac_hmacsha256.c \ crypto_auth/hmacsha256/ref/verify_hmacsha256.c \ + crypto_auth/hmacsha512256/auth_hmacsha512256.c \ crypto_auth/hmacsha512256/ref/api.h \ crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c \ crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c \ crypto_box/crypto_box.c \ + crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c \ crypto_box/curve25519xsalsa20poly1305/ref/api.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/keypair_curve25519xsalsa20poly1305.c \ crypto_core/hsalsa20/ref2/core_hsalsa20.c \ + crypto_core/hsalsa20/core_hsalsa20.c \ crypto_core/hsalsa20/ref2/api.h \ crypto_core/salsa20/ref/core_salsa20.c \ + crypto_core/salsa20/core_salsa20.c \ crypto_core/salsa20/ref/api.h \ crypto_core/salsa2012/ref/core_salsa2012.c \ + crypto_core/salsa2012/core_salsa2012.c \ crypto_core/salsa2012/ref/api.h \ crypto_core/salsa208/ref/core_salsa208.c \ + crypto_core/salsa208/core_salsa208.c \ crypto_core/salsa208/ref/api.h \ crypto_generichash/crypto_generichash.c \ crypto_generichash/blake2/ref/api.h \ @@ -31,13 +37,17 @@ libsodium_la_SOURCES = \ crypto_generichash/blake2/ref/blake2b-ref.c \ crypto_generichash/blake2/ref/generichash_blake2b.c \ crypto_hash/crypto_hash.c \ + crypto_hash/sha256/hash_sha256.c \ crypto_hash/sha256/ref/api.h \ crypto_hash/sha256/ref/hash_sha256.c \ + crypto_hash/sha512/hash_sha512.c \ crypto_hash/sha512/ref/api.h \ crypto_hash/sha512/ref/hash_sha512.c \ crypto_hashblocks/sha256/ref/blocks_sha256.c \ + crypto_hashblocks/sha256/hashblocks_sha256.c \ crypto_hashblocks/sha256/ref/api.h \ crypto_hashblocks/sha512/ref/blocks_sha512.c \ + crypto_hashblocks/sha512/hashblocks_sha512.c \ crypto_hashblocks/sha512/ref/api.h \ crypto_onetimeauth/crypto_onetimeauth.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ @@ -50,14 +60,17 @@ libsodium_la_SOURCES = \ crypto_onetimeauth/poly1305/ref/verify_poly1305_ref.c \ crypto_scalarmult/crypto_scalarmult.c \ crypto_secretbox/crypto_secretbox.c \ + crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c \ crypto_secretbox/xsalsa20poly1305/ref/api.h \ crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c \ crypto_shorthash/crypto_shorthash.c \ + crypto_shorthash/siphash24/shorthash_siphash24.c \ crypto_shorthash/siphash24/ref/api.h \ crypto_shorthash/siphash24/ref/shorthash_siphash24.c \ crypto_sign/crypto_sign.c \ crypto_sign/ed25519/ref10/base.h \ crypto_sign/ed25519/ref10/base2.h \ + crypto_sign/ed25519/sign_ed25519.c \ crypto_sign/ed25519/ref10/api.h \ crypto_sign/ed25519/ref10/d.h \ crypto_sign/ed25519/ref10/d2.h \ @@ -111,6 +124,7 @@ libsodium_la_SOURCES = \ crypto_sign/ed25519/ref10/sc_reduce.c \ crypto_sign/ed25519/ref10/sign.c \ crypto_sign/ed25519/ref10/sqrtm1.h \ + crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c \ crypto_sign/edwards25519sha512batch/ref/api.h \ crypto_sign/edwards25519sha512batch/ref/fe25519.h \ crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c \ @@ -121,6 +135,7 @@ libsodium_la_SOURCES = \ crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c \ crypto_stream/crypto_stream.c \ crypto_stream/aes128ctr/portable/afternm_aes128ctr.c \ + crypto_stream/aes128ctr/stream_aes128ctr.c \ crypto_stream/aes128ctr/portable/api.h \ crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c \ crypto_stream/aes128ctr/portable/common.h \ @@ -135,14 +150,18 @@ libsodium_la_SOURCES = \ crypto_stream/aes256estream/hongjun/aes-table.h \ crypto_stream/aes256estream/hongjun/aes256-ctr.c \ crypto_stream/aes256estream/hongjun/aes256.h \ + crypto_stream/aes256estream/stream_aes256estream.c \ crypto_stream/aes256estream/hongjun/api.h \ crypto_stream/aes256estream/hongjun/ecrypt-sync.h \ + crypto_stream/salsa2012/stream_salsa2012.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.c \ crypto_stream/salsa208/ref/api.h \ crypto_stream/salsa208/ref/stream_salsa208.c \ crypto_stream/salsa208/ref/xor_salsa208.c \ + crypto_stream/xsalsa20/stream_xsalsa20.c \ crypto_stream/xsalsa20/ref/api.h \ crypto_stream/xsalsa20/ref/stream_xsalsa20.c \ crypto_stream/xsalsa20/ref/xor_xsalsa20.c \ diff --git a/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c b/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c new file mode 100644 index 00000000..0ac96dcd --- /dev/null +++ b/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c @@ -0,0 +1,16 @@ +#include "crypto_auth_hmacsha256.h" + +size_t +crypto_auth_hmacsha256_bytes(void) { + return crypto_auth_hmacsha256_BYTES; +} + +size_t +crypto_auth_hmacsha256_keybytes(void) { + return crypto_auth_hmacsha256_KEYBYTES; +} + +const char * +crypto_auth_hmacsha256_primitive(void) { + return "hmacsha256"; +} diff --git a/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c b/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c new file mode 100644 index 00000000..48c92b3d --- /dev/null +++ b/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c @@ -0,0 +1,16 @@ +#include "crypto_auth_hmacsha512256.h" + +size_t +crypto_auth_hmacsha512256_bytes(void) { + return crypto_auth_hmacsha512256_BYTES; +} + +size_t +crypto_auth_hmacsha512256_keybytes(void) { + return crypto_auth_hmacsha512256_KEYBYTES; +} + +const char * +crypto_auth_hmacsha512256_primitive(void) { + return "hmacsha512256"; +} diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c new file mode 100644 index 00000000..563954f4 --- /dev/null +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c @@ -0,0 +1,41 @@ +#include "crypto_box_curve25519xsalsa20poly1305.h" + +size_t +crypto_box_curve25519xsalsa20poly1305_publickeybytes(void) { + return crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES; +} + +size_t +crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void) { + return crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES; +} + +size_t +crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void) { + return crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES; +} + +size_t +crypto_box_curve25519xsalsa20poly1305_noncebytes(void) { + return crypto_box_curve25519xsalsa20poly1305_NONCEBYTES; +} + +size_t +crypto_box_curve25519xsalsa20poly1305_zerobytes(void) { + return crypto_box_curve25519xsalsa20poly1305_ZEROBYTES; +} + +size_t +crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void) { + return crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES; +} + +size_t +crypto_box_curve25519xsalsa20poly1305_macbytes(void) { + return (crypto_box_ZEROBYTES; +} + +const char * +crypto_box_curve25519xsalsa20poly1305_primitive(void) { + return "curve25519xsalsa20poly1305"; +} diff --git a/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c b/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c new file mode 100644 index 00000000..31836abd --- /dev/null +++ b/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c @@ -0,0 +1,26 @@ +#include "crypto_core_hsalsa20.h" + +size_t +crypto_core_hsalsa20_outputbytes(void) { + return crypto_core_hsalsa20_OUTPUTBYTES; +} + +size_t +crypto_core_hsalsa20_inputbytes(void) { + return crypto_core_hsalsa20_INPUTBYTES; +} + +size_t +crypto_core_hsalsa20_keybytes(void) { + return crypto_core_hsalsa20_KEYBYTES; +} + +size_t +crypto_core_hsalsa20_constbytes(void) { + return crypto_core_hsalsa20_CONSTBYTES; +} + +const char * +crypto_core_hsalsa20_primitive(void) { + return "hsalsa20"; +} diff --git a/src/libsodium/crypto_core/salsa20/core_salsa20.c b/src/libsodium/crypto_core/salsa20/core_salsa20.c new file mode 100644 index 00000000..6ea9ee0c --- /dev/null +++ b/src/libsodium/crypto_core/salsa20/core_salsa20.c @@ -0,0 +1,26 @@ +#include "crypto_core_salsa20.h" + +size_t +crypto_core_salsa20_outputbytes(void) { + return crypto_core_salsa20_OUTPUTBYTES; +} + +size_t +crypto_core_salsa20_inputbytes(void) { + return crypto_core_salsa20_INPUTBYTES; +} + +size_t +crypto_core_salsa20_keybytes(void) { + return crypto_core_salsa20_KEYBYTES; +} + +size_t +crypto_core_salsa20_constbytes(void) { + return crypto_core_salsa20_CONSTBYTES; +} + +const char * +crypto_core_salsa20_primitive(void) { + return "salsa20"; +} diff --git a/src/libsodium/crypto_core/salsa2012/core_salsa2012.c b/src/libsodium/crypto_core/salsa2012/core_salsa2012.c new file mode 100644 index 00000000..15b0533c --- /dev/null +++ b/src/libsodium/crypto_core/salsa2012/core_salsa2012.c @@ -0,0 +1,26 @@ +#include "crypto_core_salsa2012.h" + +size_t +crypto_core_salsa2012_outputbytes(void) { + return crypto_core_salsa2012_OUTPUTBYTES; +} + +size_t +crypto_core_salsa2012_inputbytes(void) { + return crypto_core_salsa2012_INPUTBYTES; +} + +size_t +crypto_core_salsa2012_keybytes(void) { + return crypto_core_salsa2012_KEYBYTES; +} + +size_t +crypto_core_salsa2012_constbytes(void) { + return crypto_core_salsa2012_CONSTBYTES; +} + +const char * +crypto_core_salsa2012_primitive(void) { + return "salsa2012"; +} diff --git a/src/libsodium/crypto_core/salsa208/core_salsa208.c b/src/libsodium/crypto_core/salsa208/core_salsa208.c new file mode 100644 index 00000000..13af9a9c --- /dev/null +++ b/src/libsodium/crypto_core/salsa208/core_salsa208.c @@ -0,0 +1,26 @@ +#include "crypto_core_salsa208.h" + +size_t +crypto_core_salsa208_outputbytes(void) { + return crypto_core_salsa208_OUTPUTBYTES; +} + +size_t +crypto_core_salsa208_inputbytes(void) { + return crypto_core_salsa208_INPUTBYTES; +} + +size_t +crypto_core_salsa208_keybytes(void) { + return crypto_core_salsa208_KEYBYTES; +} + +size_t +crypto_core_salsa208_constbytes(void) { + return crypto_core_salsa208_CONSTBYTES; +} + +const char * +crypto_core_salsa208_primitive(void) { + return "salsa208"; +} diff --git a/src/libsodium/crypto_hash/sha256/hash_sha256.c b/src/libsodium/crypto_hash/sha256/hash_sha256.c new file mode 100644 index 00000000..084eaf31 --- /dev/null +++ b/src/libsodium/crypto_hash/sha256/hash_sha256.c @@ -0,0 +1,11 @@ +#include "crypto_hash_sha256.h" + +size_t +crypto_hash_sha256_bytes(void) { + return crypto_hash_sha256_BYTES; +} + +const char * +crypto_hash_sha256_primitive(void) { + return "sha256"; +} diff --git a/src/libsodium/crypto_hash/sha512/hash_sha512.c b/src/libsodium/crypto_hash/sha512/hash_sha512.c new file mode 100644 index 00000000..6a16a032 --- /dev/null +++ b/src/libsodium/crypto_hash/sha512/hash_sha512.c @@ -0,0 +1,11 @@ +#include "crypto_hash_sha512.h" + +size_t +crypto_hash_sha512_bytes(void) { + return crypto_hash_sha512_BYTES; +} + +const char * +crypto_hash_sha512_primitive(void) { + return "sha512"; +} diff --git a/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256.c b/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256.c new file mode 100644 index 00000000..2b609907 --- /dev/null +++ b/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256.c @@ -0,0 +1,16 @@ +#include "crypto_hashblocks_sha256.h" + +size_t +crypto_hashblocks_sha256_statebytes(void) { + return crypto_hashblocks_sha256_STATEBYTES; +} + +size_t +crypto_hashblocks_sha256_blockbytes(void) { + return crypto_hashblocks_sha256_BLOCKBYTES; +} + +const char * +crypto_hashblocks_sha256_primitive(void) { + return "sha256"; +} diff --git a/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512.c b/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512.c new file mode 100644 index 00000000..63cf6ed5 --- /dev/null +++ b/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512.c @@ -0,0 +1,16 @@ +#include "crypto_hashblocks_sha512.h" + +size_t +crypto_hashblocks_sha512_statebytes(void) { + return crypto_hashblocks_sha512_STATEBYTES; +} + +size_t +crypto_hashblocks_sha512_blockbytes(void) { + return crypto_hashblocks_sha512_BLOCKBYTES; +} + +const char * +crypto_hashblocks_sha512_primitive(void) { + return "sha512"; +} diff --git a/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c b/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c new file mode 100644 index 00000000..10dc5808 --- /dev/null +++ b/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c @@ -0,0 +1 @@ +#include "crypto_scalarmult_curve25519.h" diff --git a/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c b/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c new file mode 100644 index 00000000..498437f3 --- /dev/null +++ b/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c @@ -0,0 +1,26 @@ +#include "crypto_secretbox_xsalsa20poly1305.h" + +size_t +crypto_secretbox_xsalsa20poly1305_keybytes(void) { + return crypto_secretbox_xsalsa20poly1305_KEYBYTES; +} + +size_t +crypto_secretbox_xsalsa20poly1305_noncebytes(void) { + return crypto_secretbox_xsalsa20poly1305_NONCEBYTES; +} + +size_t +crypto_secretbox_xsalsa20poly1305_zerobytes(void) { + return crypto_secretbox_xsalsa20poly1305_ZEROBYTES; +} + +size_t +crypto_secretbox_xsalsa20poly1305_boxzerobytes(void) { + return crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES; +} + +const char * +crypto_secretbox_xsalsa20poly1305_primitive(void) { + return "xsalsa20poly1305"; +} diff --git a/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c b/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c new file mode 100644 index 00000000..dd60202c --- /dev/null +++ b/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c @@ -0,0 +1,11 @@ +#include "crypto_shorthash_siphash24.h" + +size_t +crypto_shorthash_siphash24_bytes(void) { + return crypto_shorthash_siphash24_BYTES; +} + +const char * +crypto_shorthash_siphash24_primitive(void) { + return "siphash24"; +} diff --git a/src/libsodium/crypto_sign/ed25519/sign_ed25519.c b/src/libsodium/crypto_sign/ed25519/sign_ed25519.c new file mode 100644 index 00000000..a02031c9 --- /dev/null +++ b/src/libsodium/crypto_sign/ed25519/sign_ed25519.c @@ -0,0 +1,21 @@ +#include "crypto_sign_ed25519.h" + +size_t +crypto_sign_ed25519_bytes(void) { + return crypto_sign_ed25519_BYTES; +} + +size_t +crypto_sign_ed25519_publickeybytes(void) { + return crypto_sign_ed25519_PUBLICKEYBYTES; +} + +size_t +crypto_sign_ed25519_secretkeybytes(void) { + return crypto_sign_ed25519_SECRETKEYBYTES; +} + +const char * +crypto_sign_ed25519_primitive(void) { + return "ed25519"; +} diff --git a/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c b/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c new file mode 100644 index 00000000..142f4ffc --- /dev/null +++ b/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c @@ -0,0 +1,21 @@ +#include "crypto_sign_edwards25519sha512batch.h" + +size_t +crypto_sign_edwards25519sha512batch_bytes(void) { + return crypto_sign_edwards25519sha512batch_BYTES; +} + +size_t +crypto_sign_edwards25519sha512batch_publickeybytes(void) { + return crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES; +} + +size_t +crypto_sign_edwards25519sha512batch_secretkeybytes(void) { + return crypto_sign_edwards25519sha512batch_SECRETKEYBYTES; +} + +const char * +crypto_sign_edwards25519sha512batch_primitive(void) { + return "edwards25519sha512batch"; +} diff --git a/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c b/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c new file mode 100644 index 00000000..350494ef --- /dev/null +++ b/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c @@ -0,0 +1,21 @@ +#include "crypto_stream_aes128ctr.h" + +size_t +crypto_stream_aes128ctr_keybytes(void) { + return crypto_stream_aes128ctr_KEYBYTES; +} + +size_t +crypto_stream_aes128ctr_noncebytes(void) { + return crypto_stream_aes128ctr_NONCEBYTES; +} + +size_t +crypto_stream_aes128ctr_beforenmbytes(void) { + return crypto_stream_aes128ctr_BEFORENMBYTES; +} + +const char * +crypto_stream_aes128ctr_primitive(void) { + return "aes128ctr"; +} diff --git a/src/libsodium/crypto_stream/aes256estream/stream_aes256estream.c b/src/libsodium/crypto_stream/aes256estream/stream_aes256estream.c new file mode 100644 index 00000000..a20fdb01 --- /dev/null +++ b/src/libsodium/crypto_stream/aes256estream/stream_aes256estream.c @@ -0,0 +1,21 @@ +#include "crypto_stream_aes256estream.h" + +size_t +crypto_stream_aes256estream_keybytes(void) { + return crypto_stream_aes256estream_KEYBYTES; +} + +size_t +crypto_stream_aes256estream_noncebytes(void) { + return crypto_stream_aes256estream_NONCEBYTES; +} + +size_t +crypto_stream_aes256estream_beforenmbytes(void) { + return crypto_stream_aes256estream_BEFORENMBYTES; +} + +const char * +crypto_stream_aes256estream_primitive(void) { + return "aes256estream"; +} diff --git a/src/libsodium/crypto_stream/salsa20/stream_salsa20.c b/src/libsodium/crypto_stream/salsa20/stream_salsa20.c new file mode 100644 index 00000000..037fb59d --- /dev/null +++ b/src/libsodium/crypto_stream/salsa20/stream_salsa20.c @@ -0,0 +1 @@ +#include "crypto_stream_salsa20.h" diff --git a/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c new file mode 100644 index 00000000..f43d009c --- /dev/null +++ b/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c @@ -0,0 +1,16 @@ +#include "crypto_stream_salsa2012.h" + +size_t +crypto_stream_salsa2012_keybytes(void) { + return crypto_stream_salsa2012_KEYBYTES; +} + +size_t +crypto_stream_salsa2012_noncebytes(void) { + return crypto_stream_salsa2012_NONCEBYTES; +} + +const char * +crypto_stream_salsa2012_primitive(void) { + return "salsa2012"; +} diff --git a/src/libsodium/crypto_stream/salsa208/stream_salsa208.c b/src/libsodium/crypto_stream/salsa208/stream_salsa208.c new file mode 100644 index 00000000..7b160b35 --- /dev/null +++ b/src/libsodium/crypto_stream/salsa208/stream_salsa208.c @@ -0,0 +1,16 @@ +#include "crypto_stream_salsa208.h" + +size_t +crypto_stream_salsa208_keybytes(void) { + return crypto_stream_salsa208_KEYBYTES; +} + +size_t +crypto_stream_salsa208_noncebytes(void) { + return crypto_stream_salsa208_NONCEBYTES; +} + +const char * +crypto_stream_salsa208_primitive(void) { + return "salsa208"; +} diff --git a/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c b/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c new file mode 100644 index 00000000..def5f499 --- /dev/null +++ b/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c @@ -0,0 +1,16 @@ +#include "crypto_stream_xsalsa20.h" + +size_t +crypto_stream_xsalsa20_keybytes(void) { + return crypto_stream_xsalsa20_KEYBYTES; +} + +size_t +crypto_stream_xsalsa20_noncebytes(void) { + return crypto_stream_xsalsa20_NONCEBYTES; +} + +const char * +crypto_stream_xsalsa20_primitive(void) { + return "xsalsa20"; +} diff --git a/src/libsodium/include/sodium/crypto_auth_hmacsha256.h b/src/libsodium/include/sodium/crypto_auth_hmacsha256.h index 5a7a7a87..a0b01004 100644 --- a/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +++ b/src/libsodium/include/sodium/crypto_auth_hmacsha256.h @@ -1,6 +1,7 @@ #ifndef crypto_auth_hmacsha256_H #define crypto_auth_hmacsha256_H +#include #include "export.h" #define crypto_auth_hmacsha256_BYTES 32U @@ -10,6 +11,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_auth_hmacsha256_bytes(void); + +SODIUM_EXPORT +size_t crypto_auth_hmacsha256_keybytes(void); + +SODIUM_EXPORT +const char * crypto_auth_hmacsha256_primitive(void); + SODIUM_EXPORT int crypto_auth_hmacsha256(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h index 250f8aaa..d46653c6 100644 --- a/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +++ b/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h @@ -1,6 +1,7 @@ #ifndef crypto_auth_hmacsha512256_H #define crypto_auth_hmacsha512256_H +#include #include "export.h" #define crypto_auth_hmacsha512256_BYTES 32U @@ -10,6 +11,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_auth_hmacsha512256_bytes(void); + +SODIUM_EXPORT +size_t crypto_auth_hmacsha512256_keybytes(void); + +SODIUM_EXPORT +const char * crypto_auth_hmacsha512256_primitive(void); + SODIUM_EXPORT int crypto_auth_hmacsha512256(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h index 754f573a..d7b48c0c 100644 --- a/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +++ b/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h @@ -1,6 +1,7 @@ #ifndef crypto_box_curve25519xsalsa20poly1305_H #define crypto_box_curve25519xsalsa20poly1305_H +#include #include "export.h" #define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U @@ -15,6 +16,30 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void); + +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void); + +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void); + +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void); + +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void); + +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void); + +SODIUM_EXPORT +size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void); + +SODIUM_EXPORT +const char * crypto_box_curve25519xsalsa20poly1305_primitive(void); + SODIUM_EXPORT int crypto_box_curve25519xsalsa20poly1305(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_core_hsalsa20.h b/src/libsodium/include/sodium/crypto_core_hsalsa20.h index d7760ec7..52d4f08e 100644 --- a/src/libsodium/include/sodium/crypto_core_hsalsa20.h +++ b/src/libsodium/include/sodium/crypto_core_hsalsa20.h @@ -1,6 +1,7 @@ #ifndef crypto_core_hsalsa20_H #define crypto_core_hsalsa20_H +#include #include "export.h" #define crypto_core_hsalsa20_OUTPUTBYTES 32U @@ -12,6 +13,21 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_core_hsalsa20_outputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_hsalsa20_inputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_hsalsa20_keybytes(void); + +SODIUM_EXPORT +size_t crypto_core_hsalsa20_constbytes(void); + +SODIUM_EXPORT +const char * crypto_core_hsalsa20_primitive(void); + SODIUM_EXPORT int crypto_core_hsalsa20(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_core_salsa20.h b/src/libsodium/include/sodium/crypto_core_salsa20.h index 40d96f2e..f2592bca 100644 --- a/src/libsodium/include/sodium/crypto_core_salsa20.h +++ b/src/libsodium/include/sodium/crypto_core_salsa20.h @@ -1,6 +1,7 @@ #ifndef crypto_core_salsa20_H #define crypto_core_salsa20_H +#include #include "export.h" #define crypto_core_salsa20_OUTPUTBYTES 64U @@ -12,6 +13,21 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_core_salsa20_outputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa20_inputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa20_keybytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa20_constbytes(void); + +SODIUM_EXPORT +const char * crypto_core_salsa20_primitive(void); + SODIUM_EXPORT int crypto_core_salsa20(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_core_salsa2012.h b/src/libsodium/include/sodium/crypto_core_salsa2012.h index ac2b0d54..b5decc73 100644 --- a/src/libsodium/include/sodium/crypto_core_salsa2012.h +++ b/src/libsodium/include/sodium/crypto_core_salsa2012.h @@ -1,6 +1,7 @@ #ifndef crypto_core_salsa2012_H #define crypto_core_salsa2012_H +#include #include "export.h" #define crypto_core_salsa2012_OUTPUTBYTES 64U @@ -12,6 +13,21 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_core_salsa2012_outputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa2012_inputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa2012_keybytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa2012_constbytes(void); + +SODIUM_EXPORT +const char * crypto_core_salsa2012_primitive(void); + SODIUM_EXPORT int crypto_core_salsa2012(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_core_salsa208.h b/src/libsodium/include/sodium/crypto_core_salsa208.h index 89849d29..4cc2fa51 100644 --- a/src/libsodium/include/sodium/crypto_core_salsa208.h +++ b/src/libsodium/include/sodium/crypto_core_salsa208.h @@ -1,6 +1,7 @@ #ifndef crypto_core_salsa208_H #define crypto_core_salsa208_H +#include #include "export.h" #define crypto_core_salsa208_OUTPUTBYTES 64U @@ -12,6 +13,21 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_core_salsa208_outputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa208_inputbytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa208_keybytes(void); + +SODIUM_EXPORT +size_t crypto_core_salsa208_constbytes(void); + +SODIUM_EXPORT +const char * crypto_core_salsa208_primitive(void); + SODIUM_EXPORT int crypto_core_salsa208(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_hash_sha256.h b/src/libsodium/include/sodium/crypto_hash_sha256.h index 1de49b23..ef93f9a4 100644 --- a/src/libsodium/include/sodium/crypto_hash_sha256.h +++ b/src/libsodium/include/sodium/crypto_hash_sha256.h @@ -1,6 +1,7 @@ #ifndef crypto_hash_sha256_H #define crypto_hash_sha256_H +#include #include "export.h" #define crypto_hash_sha256_BYTES 32U @@ -10,6 +11,12 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_hash_sha256_bytes(void); + +SODIUM_EXPORT +const char * crypto_hash_sha256_primitive(void); + SODIUM_EXPORT int crypto_hash_sha256(unsigned char *,const unsigned char *,unsigned long long); diff --git a/src/libsodium/include/sodium/crypto_hash_sha512.h b/src/libsodium/include/sodium/crypto_hash_sha512.h index dcc5b5e7..42cb0a72 100644 --- a/src/libsodium/include/sodium/crypto_hash_sha512.h +++ b/src/libsodium/include/sodium/crypto_hash_sha512.h @@ -1,6 +1,7 @@ #ifndef crypto_hash_sha512_H #define crypto_hash_sha512_H +#include #include "export.h" #define crypto_hash_sha512_BYTES 64U @@ -10,6 +11,12 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_hash_sha512_bytes(void); + +SODIUM_EXPORT +const char * crypto_hash_sha512_primitive(void); + SODIUM_EXPORT int crypto_hash_sha512(unsigned char *,const unsigned char *,unsigned long long); diff --git a/src/libsodium/include/sodium/crypto_hashblocks_sha256.h b/src/libsodium/include/sodium/crypto_hashblocks_sha256.h index ea523489..734a577f 100644 --- a/src/libsodium/include/sodium/crypto_hashblocks_sha256.h +++ b/src/libsodium/include/sodium/crypto_hashblocks_sha256.h @@ -1,6 +1,7 @@ #ifndef crypto_hashblocks_sha256_H #define crypto_hashblocks_sha256_H +#include #include "export.h" #define crypto_hashblocks_sha256_STATEBYTES 32U @@ -10,6 +11,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_hashblocks_sha256_statebytes(void); + +SODIUM_EXPORT +size_t crypto_hashblocks_sha256_blockbytes(void); + +SODIUM_EXPORT +const char * crypto_hashblocks_sha256_primitive(void); + SODIUM_EXPORT int crypto_hashblocks_sha256(unsigned char *,const unsigned char *,unsigned long long); diff --git a/src/libsodium/include/sodium/crypto_hashblocks_sha512.h b/src/libsodium/include/sodium/crypto_hashblocks_sha512.h index 67cd32d6..50ce5fc6 100644 --- a/src/libsodium/include/sodium/crypto_hashblocks_sha512.h +++ b/src/libsodium/include/sodium/crypto_hashblocks_sha512.h @@ -1,6 +1,7 @@ #ifndef crypto_hashblocks_sha512_H #define crypto_hashblocks_sha512_H +#include #include "export.h" #define crypto_hashblocks_sha512_STATEBYTES 64U @@ -10,6 +11,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_hashblocks_sha512_statebytes(void); + +SODIUM_EXPORT +size_t crypto_hashblocks_sha512_blockbytes(void); + +SODIUM_EXPORT +const char * crypto_hashblocks_sha512_primitive(void); + SODIUM_EXPORT int crypto_hashblocks_sha512(unsigned char *,const unsigned char *,unsigned long long); diff --git a/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h index b503cbb9..22f0d667 100644 --- a/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +++ b/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h @@ -1,6 +1,7 @@ #ifndef crypto_secretbox_xsalsa20poly1305_H #define crypto_secretbox_xsalsa20poly1305_H +#include #include "export.h" #define crypto_secretbox_xsalsa20poly1305_KEYBYTES 32U @@ -12,6 +13,21 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_keybytes(void); + +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void); + +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); + +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); + +SODIUM_EXPORT +const char * crypto_secretbox_xsalsa20poly1305_primitive(void); + SODIUM_EXPORT int crypto_secretbox_xsalsa20poly1305(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_shorthash_siphash24.h b/src/libsodium/include/sodium/crypto_shorthash_siphash24.h index e2e32f62..2885d974 100644 --- a/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +++ b/src/libsodium/include/sodium/crypto_shorthash_siphash24.h @@ -1,6 +1,7 @@ #ifndef crypto_shorthash_siphash24_H #define crypto_shorthash_siphash24_H +#include #include "export.h" #define crypto_shorthash_siphash24_BYTES 8U @@ -10,6 +11,12 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_shorthash_siphash24_bytes(void); + +SODIUM_EXPORT +const char * crypto_shorthash_siphash24_primitive(void); + SODIUM_EXPORT int crypto_shorthash_siphash24(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_sign_ed25519.h b/src/libsodium/include/sodium/crypto_sign_ed25519.h index e98d0a10..c572c6a7 100644 --- a/src/libsodium/include/sodium/crypto_sign_ed25519.h +++ b/src/libsodium/include/sodium/crypto_sign_ed25519.h @@ -1,6 +1,7 @@ #ifndef crypto_sign_ed25519_H #define crypto_sign_ed25519_H +#include #include "export.h" #define crypto_sign_ed25519_SECRETKEYBYTES 64U @@ -11,6 +12,18 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_sign_ed25519_bytes(void); + +SODIUM_EXPORT +size_t crypto_sign_ed25519_publickeybytes(void); + +SODIUM_EXPORT +size_t crypto_sign_ed25519_secretkeybytes(void); + +SODIUM_EXPORT +const char * crypto_sign_ed25519_primitive(void); + SODIUM_EXPORT int crypto_sign_ed25519(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h b/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h index b6a2f3c5..eb8f7061 100644 --- a/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +++ b/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h @@ -1,6 +1,7 @@ #ifndef crypto_sign_edwards25519sha512batch_H #define crypto_sign_edwards25519sha512batch_H +#include #include "export.h" #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES 64U @@ -11,6 +12,18 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_sign_edwards25519sha512batch_bytes(void); + +SODIUM_EXPORT +size_t crypto_sign_edwards25519sha512batch_publickeybytes(void); + +SODIUM_EXPORT +size_t crypto_sign_edwards25519sha512batch_secretkeybytes(void); + +SODIUM_EXPORT +const char * crypto_sign_edwards25519sha512batch_primitive(void); + SODIUM_EXPORT int crypto_sign_edwards25519sha512batch(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_stream_aes128ctr.h b/src/libsodium/include/sodium/crypto_stream_aes128ctr.h index 15d6366a..df9ee34a 100644 --- a/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +++ b/src/libsodium/include/sodium/crypto_stream_aes128ctr.h @@ -9,6 +9,7 @@ * the crypto_box functions. */ +#include #include "export.h" #define crypto_stream_aes128ctr_KEYBYTES 16U @@ -19,6 +20,18 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_stream_aes128ctr_keybytes(void); + +SODIUM_EXPORT +size_t crypto_stream_aes128ctr_noncebytes(void); + +SODIUM_EXPORT +size_t crypto_stream_aes128ctr_beforenmbytes(void); + +SODIUM_EXPORT +const char * crypto_stream_aes128ctr_primitive(void); + SODIUM_EXPORT int crypto_stream_aes128ctr(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_stream_aes256estream.h b/src/libsodium/include/sodium/crypto_stream_aes256estream.h index 07c2277e..7240b22f 100644 --- a/src/libsodium/include/sodium/crypto_stream_aes256estream.h +++ b/src/libsodium/include/sodium/crypto_stream_aes256estream.h @@ -10,6 +10,7 @@ * the crypto_box functions. */ +#include #include "export.h" #define crypto_stream_aes256estream_KEYBYTES 32U @@ -20,6 +21,18 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_stream_aes256estream_keybytes(void); + +SODIUM_EXPORT +size_t crypto_stream_aes256estream_noncebytes(void); + +SODIUM_EXPORT +size_t crypto_stream_aes256estream_beforenmbytes(void); + +SODIUM_EXPORT +const char * crypto_stream_aes256estream_primitive(void); + SODIUM_EXPORT int crypto_stream_aes256estream(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_stream_salsa2012.h b/src/libsodium/include/sodium/crypto_stream_salsa2012.h index 18c3a73b..742a7a1a 100644 --- a/src/libsodium/include/sodium/crypto_stream_salsa2012.h +++ b/src/libsodium/include/sodium/crypto_stream_salsa2012.h @@ -9,6 +9,7 @@ * the crypto_box functions. */ +#include #include "export.h" #define crypto_stream_salsa2012_KEYBYTES 32U @@ -18,6 +19,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_stream_salsa2012_keybytes(void); + +SODIUM_EXPORT +size_t crypto_stream_salsa2012_noncebytes(void); + +SODIUM_EXPORT +const char * crypto_stream_salsa2012_primitive(void); + SODIUM_EXPORT int crypto_stream_salsa2012(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_stream_salsa208.h b/src/libsodium/include/sodium/crypto_stream_salsa208.h index 273395f0..cd6742ce 100644 --- a/src/libsodium/include/sodium/crypto_stream_salsa208.h +++ b/src/libsodium/include/sodium/crypto_stream_salsa208.h @@ -9,6 +9,7 @@ * the crypto_box functions. */ +#include #include "export.h" #define crypto_stream_salsa208_KEYBYTES 32U @@ -18,6 +19,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_stream_salsa208_keybytes(void); + +SODIUM_EXPORT +size_t crypto_stream_salsa208_noncebytes(void); + +SODIUM_EXPORT +const char * crypto_stream_salsa208_primitive(void); + SODIUM_EXPORT int crypto_stream_salsa208(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); diff --git a/src/libsodium/include/sodium/crypto_stream_xsalsa20.h b/src/libsodium/include/sodium/crypto_stream_xsalsa20.h index 5f58c7ec..c5ad363d 100644 --- a/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +++ b/src/libsodium/include/sodium/crypto_stream_xsalsa20.h @@ -9,6 +9,7 @@ * the crypto_box functions. */ +#include #include "export.h" #define crypto_stream_xsalsa20_KEYBYTES 32U @@ -18,6 +19,15 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_stream_xsalsa20_keybytes(void); + +SODIUM_EXPORT +size_t crypto_stream_xsalsa20_noncebytes(void); + +SODIUM_EXPORT +const char * crypto_stream_xsalsa20_primitive(void); + SODIUM_EXPORT int crypto_stream_xsalsa20(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); From 2a0f3d040fbd4f6f522f3d6e08586876b24458d0 Mon Sep 17 00:00:00 2001 From: Stephen Touset Date: Thu, 16 May 2013 15:18:39 -0700 Subject: [PATCH 2/3] Fix definition of crypto_box_curve25519xsalsa20poly1305_macbytes This function definition was created by an automated script that incorrectly handled a corner case. --- src/libsodium/Makefile.am | 40 +++++++++---------- ...uth_hmacsha256.c => auth_hmacsha256_api.c} | 0 ...acsha512256.c => auth_hmacsha512256_api.c} | 0 ...c => box_curve25519xsalsa20poly1305_api.c} | 2 +- .../{core_hsalsa20.c => core_hsalsa20_api.c} | 0 .../{core_salsa20.c => core_salsa20_api.c} | 0 ...{core_salsa2012.c => core_salsa2012_api.c} | 0 .../{core_salsa208.c => core_salsa208_api.c} | 0 .../{hash_sha256.c => hash_sha256_api.c} | 0 .../{hash_sha512.c => hash_sha512_api.c} | 0 ...locks_sha256.c => hashblocks_sha256_api.c} | 0 ...locks_sha512.c => hashblocks_sha512_api.c} | 0 ...rve25519.c => scalarmult_curve25519_api.c} | 0 ...305.c => secretbox_xsalsa20poly1305_api.c} | 0 ..._siphash24.c => shorthash_siphash24_api.c} | 0 .../{sign_ed25519.c => sign_ed25519_api.c} | 0 ...h.c => sign_edwards25519sha512batch_api.c} | 0 ...eam_aes128ctr.c => stream_aes128ctr_api.c} | 0 ...56estream.c => stream_aes256estream_api.c} | 0 ...{stream_salsa20.c => stream_salsa20_api.c} | 0 ...eam_salsa2012.c => stream_salsa2012_api.c} | 0 ...tream_salsa208.c => stream_salsa208_api.c} | 0 ...tream_xsalsa20.c => stream_xsalsa20_api.c} | 0 23 files changed, 21 insertions(+), 21 deletions(-) rename src/libsodium/crypto_auth/hmacsha256/{auth_hmacsha256.c => auth_hmacsha256_api.c} (100%) rename src/libsodium/crypto_auth/hmacsha512256/{auth_hmacsha512256.c => auth_hmacsha512256_api.c} (100%) rename src/libsodium/crypto_box/curve25519xsalsa20poly1305/{box_curve25519xsalsa20poly1305.c => box_curve25519xsalsa20poly1305_api.c} (94%) rename src/libsodium/crypto_core/hsalsa20/{core_hsalsa20.c => core_hsalsa20_api.c} (100%) rename src/libsodium/crypto_core/salsa20/{core_salsa20.c => core_salsa20_api.c} (100%) rename src/libsodium/crypto_core/salsa2012/{core_salsa2012.c => core_salsa2012_api.c} (100%) rename src/libsodium/crypto_core/salsa208/{core_salsa208.c => core_salsa208_api.c} (100%) rename src/libsodium/crypto_hash/sha256/{hash_sha256.c => hash_sha256_api.c} (100%) rename src/libsodium/crypto_hash/sha512/{hash_sha512.c => hash_sha512_api.c} (100%) rename src/libsodium/crypto_hashblocks/sha256/{hashblocks_sha256.c => hashblocks_sha256_api.c} (100%) rename src/libsodium/crypto_hashblocks/sha512/{hashblocks_sha512.c => hashblocks_sha512_api.c} (100%) rename src/libsodium/crypto_scalarmult/curve25519/{scalarmult_curve25519.c => scalarmult_curve25519_api.c} (100%) rename src/libsodium/crypto_secretbox/xsalsa20poly1305/{secretbox_xsalsa20poly1305.c => secretbox_xsalsa20poly1305_api.c} (100%) rename src/libsodium/crypto_shorthash/siphash24/{shorthash_siphash24.c => shorthash_siphash24_api.c} (100%) rename src/libsodium/crypto_sign/ed25519/{sign_ed25519.c => sign_ed25519_api.c} (100%) rename src/libsodium/crypto_sign/edwards25519sha512batch/{sign_edwards25519sha512batch.c => sign_edwards25519sha512batch_api.c} (100%) rename src/libsodium/crypto_stream/aes128ctr/{stream_aes128ctr.c => stream_aes128ctr_api.c} (100%) rename src/libsodium/crypto_stream/aes256estream/{stream_aes256estream.c => stream_aes256estream_api.c} (100%) rename src/libsodium/crypto_stream/salsa20/{stream_salsa20.c => stream_salsa20_api.c} (100%) rename src/libsodium/crypto_stream/salsa2012/{stream_salsa2012.c => stream_salsa2012_api.c} (100%) rename src/libsodium/crypto_stream/salsa208/{stream_salsa208.c => stream_salsa208_api.c} (100%) rename src/libsodium/crypto_stream/xsalsa20/{stream_xsalsa20.c => stream_xsalsa20_api.c} (100%) diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 26555a3a..90caf780 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -3,32 +3,32 @@ lib_LTLIBRARIES = \ libsodium_la_SOURCES = \ crypto_auth/crypto_auth.c \ - crypto_auth/hmacsha256/auth_hmacsha256.c \ + crypto_auth/hmacsha256/auth_hmacsha256_api.c \ crypto_auth/hmacsha256/ref/api.h \ crypto_auth/hmacsha256/ref/hmac_hmacsha256.c \ crypto_auth/hmacsha256/ref/verify_hmacsha256.c \ - crypto_auth/hmacsha512256/auth_hmacsha512256.c \ + crypto_auth/hmacsha512256/auth_hmacsha512256_api.c \ crypto_auth/hmacsha512256/ref/api.h \ crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c \ crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c \ crypto_box/crypto_box.c \ - crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c \ + crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c \ crypto_box/curve25519xsalsa20poly1305/ref/api.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/keypair_curve25519xsalsa20poly1305.c \ crypto_core/hsalsa20/ref2/core_hsalsa20.c \ - crypto_core/hsalsa20/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.c \ + crypto_core/salsa20/core_salsa20_api.c \ crypto_core/salsa20/ref/api.h \ crypto_core/salsa2012/ref/core_salsa2012.c \ - crypto_core/salsa2012/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.c \ + crypto_core/salsa208/core_salsa208_api.c \ crypto_core/salsa208/ref/api.h \ crypto_generichash/crypto_generichash.c \ crypto_generichash/blake2/ref/api.h \ @@ -37,17 +37,17 @@ libsodium_la_SOURCES = \ crypto_generichash/blake2/ref/blake2b-ref.c \ crypto_generichash/blake2/ref/generichash_blake2b.c \ crypto_hash/crypto_hash.c \ - crypto_hash/sha256/hash_sha256.c \ + crypto_hash/sha256/hash_sha256_api.c \ crypto_hash/sha256/ref/api.h \ crypto_hash/sha256/ref/hash_sha256.c \ - crypto_hash/sha512/hash_sha512.c \ + crypto_hash/sha512/hash_sha512_api.c \ crypto_hash/sha512/ref/api.h \ crypto_hash/sha512/ref/hash_sha512.c \ crypto_hashblocks/sha256/ref/blocks_sha256.c \ - crypto_hashblocks/sha256/hashblocks_sha256.c \ + crypto_hashblocks/sha256/hashblocks_sha256_api.c \ crypto_hashblocks/sha256/ref/api.h \ crypto_hashblocks/sha512/ref/blocks_sha512.c \ - crypto_hashblocks/sha512/hashblocks_sha512.c \ + crypto_hashblocks/sha512/hashblocks_sha512_api.c \ crypto_hashblocks/sha512/ref/api.h \ crypto_onetimeauth/crypto_onetimeauth.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ @@ -60,17 +60,17 @@ libsodium_la_SOURCES = \ crypto_onetimeauth/poly1305/ref/verify_poly1305_ref.c \ crypto_scalarmult/crypto_scalarmult.c \ crypto_secretbox/crypto_secretbox.c \ - crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c \ + crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c \ crypto_secretbox/xsalsa20poly1305/ref/api.h \ crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c \ crypto_shorthash/crypto_shorthash.c \ - crypto_shorthash/siphash24/shorthash_siphash24.c \ + crypto_shorthash/siphash24/shorthash_siphash24_api.c \ crypto_shorthash/siphash24/ref/api.h \ crypto_shorthash/siphash24/ref/shorthash_siphash24.c \ crypto_sign/crypto_sign.c \ crypto_sign/ed25519/ref10/base.h \ crypto_sign/ed25519/ref10/base2.h \ - crypto_sign/ed25519/sign_ed25519.c \ + crypto_sign/ed25519/sign_ed25519_api.c \ crypto_sign/ed25519/ref10/api.h \ crypto_sign/ed25519/ref10/d.h \ crypto_sign/ed25519/ref10/d2.h \ @@ -124,7 +124,7 @@ libsodium_la_SOURCES = \ crypto_sign/ed25519/ref10/sc_reduce.c \ crypto_sign/ed25519/ref10/sign.c \ crypto_sign/ed25519/ref10/sqrtm1.h \ - crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c \ crypto_sign/edwards25519sha512batch/ref/api.h \ crypto_sign/edwards25519sha512batch/ref/fe25519.h \ crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c \ @@ -135,7 +135,7 @@ libsodium_la_SOURCES = \ crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c \ crypto_stream/crypto_stream.c \ crypto_stream/aes128ctr/portable/afternm_aes128ctr.c \ - crypto_stream/aes128ctr/stream_aes128ctr.c \ + crypto_stream/aes128ctr/stream_aes128ctr_api.c \ crypto_stream/aes128ctr/portable/api.h \ crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c \ crypto_stream/aes128ctr/portable/common.h \ @@ -150,18 +150,18 @@ libsodium_la_SOURCES = \ crypto_stream/aes256estream/hongjun/aes-table.h \ crypto_stream/aes256estream/hongjun/aes256-ctr.c \ crypto_stream/aes256estream/hongjun/aes256.h \ - crypto_stream/aes256estream/stream_aes256estream.c \ + crypto_stream/aes256estream/stream_aes256estream_api.c \ crypto_stream/aes256estream/hongjun/api.h \ crypto_stream/aes256estream/hongjun/ecrypt-sync.h \ - crypto_stream/salsa2012/stream_salsa2012.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.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 \ - crypto_stream/xsalsa20/stream_xsalsa20.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 \ diff --git a/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c b/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c similarity index 100% rename from src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c rename to src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c diff --git a/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c b/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c similarity index 100% rename from src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c rename to src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c similarity index 94% rename from src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c rename to src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c index 563954f4..6f04bf86 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c @@ -32,7 +32,7 @@ crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void) { size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void) { - return (crypto_box_ZEROBYTES; + return crypto_box_curve25519xsalsa20poly1305_MACBYTES; } const char * diff --git a/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c b/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c similarity index 100% rename from src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c rename to src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c diff --git a/src/libsodium/crypto_core/salsa20/core_salsa20.c b/src/libsodium/crypto_core/salsa20/core_salsa20_api.c similarity index 100% rename from src/libsodium/crypto_core/salsa20/core_salsa20.c rename to src/libsodium/crypto_core/salsa20/core_salsa20_api.c diff --git a/src/libsodium/crypto_core/salsa2012/core_salsa2012.c b/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c similarity index 100% rename from src/libsodium/crypto_core/salsa2012/core_salsa2012.c rename to src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c diff --git a/src/libsodium/crypto_core/salsa208/core_salsa208.c b/src/libsodium/crypto_core/salsa208/core_salsa208_api.c similarity index 100% rename from src/libsodium/crypto_core/salsa208/core_salsa208.c rename to src/libsodium/crypto_core/salsa208/core_salsa208_api.c diff --git a/src/libsodium/crypto_hash/sha256/hash_sha256.c b/src/libsodium/crypto_hash/sha256/hash_sha256_api.c similarity index 100% rename from src/libsodium/crypto_hash/sha256/hash_sha256.c rename to src/libsodium/crypto_hash/sha256/hash_sha256_api.c diff --git a/src/libsodium/crypto_hash/sha512/hash_sha512.c b/src/libsodium/crypto_hash/sha512/hash_sha512_api.c similarity index 100% rename from src/libsodium/crypto_hash/sha512/hash_sha512.c rename to src/libsodium/crypto_hash/sha512/hash_sha512_api.c diff --git a/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256.c b/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c similarity index 100% rename from src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256.c rename to src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c diff --git a/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512.c b/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c similarity index 100% rename from src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512.c rename to src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c diff --git a/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c b/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c similarity index 100% rename from src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c rename to src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c diff --git a/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c b/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c similarity index 100% rename from src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c rename to src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c diff --git a/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c b/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c similarity index 100% rename from src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c rename to src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c diff --git a/src/libsodium/crypto_sign/ed25519/sign_ed25519.c b/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c similarity index 100% rename from src/libsodium/crypto_sign/ed25519/sign_ed25519.c rename to src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c diff --git a/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c b/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c similarity index 100% rename from src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch.c rename to src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c diff --git a/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c b/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c similarity index 100% rename from src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c rename to src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c diff --git a/src/libsodium/crypto_stream/aes256estream/stream_aes256estream.c b/src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c similarity index 100% rename from src/libsodium/crypto_stream/aes256estream/stream_aes256estream.c rename to src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c diff --git a/src/libsodium/crypto_stream/salsa20/stream_salsa20.c b/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c similarity index 100% rename from src/libsodium/crypto_stream/salsa20/stream_salsa20.c rename to src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c diff --git a/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c similarity index 100% rename from src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c rename to src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c diff --git a/src/libsodium/crypto_stream/salsa208/stream_salsa208.c b/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c similarity index 100% rename from src/libsodium/crypto_stream/salsa208/stream_salsa208.c rename to src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c diff --git a/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c b/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c similarity index 100% rename from src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c rename to src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c From 98c02a21d61c45ae62b71d3da7759ab0ccd579bc Mon Sep 17 00:00:00 2001 From: Stephen Touset Date: Thu, 16 May 2013 15:48:08 -0700 Subject: [PATCH 3/3] Add remaining functions for looking up constants The automated script that generated functions for looking up #define'd constants didn't handle edge cases in these files, so these have been added by hand. They're thus either more likely or less likely to contain mistakes (depending on one's particular point of view). --- src/libsodium/Makefile.am | 4 +++ .../blake2/generichash_blake2_api.c | 31 +++++++++++++++++++ .../poly1305/onetimeauth_poly1305_api.c | 16 ++++++++++ .../crypto_verify/16/verify_16_api.c | 6 ++++ .../crypto_verify/32/verify_32_api.c | 6 ++++ .../sodium/crypto_generichash_blake2b.h | 19 ++++++++++++ .../sodium/crypto_onetimeauth_poly1305.h | 10 ++++++ .../include/sodium/crypto_verify_16.h | 4 +++ .../include/sodium/crypto_verify_32.h | 4 +++ 9 files changed, 100 insertions(+) create mode 100644 src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c create mode 100644 src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c create mode 100644 src/libsodium/crypto_verify/16/verify_16_api.c create mode 100644 src/libsodium/crypto_verify/32/verify_32_api.c diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 90caf780..c5f51aba 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -31,6 +31,7 @@ libsodium_la_SOURCES = \ crypto_core/salsa208/core_salsa208_api.c \ crypto_core/salsa208/ref/api.h \ crypto_generichash/crypto_generichash.c \ + crypto_generichash/blake2/generichash_blake2_api.c \ crypto_generichash/blake2/ref/api.h \ crypto_generichash/blake2/ref/blake2-impl.h \ crypto_generichash/blake2/ref/blake2.h \ @@ -51,6 +52,7 @@ libsodium_la_SOURCES = \ crypto_hashblocks/sha512/ref/api.h \ crypto_onetimeauth/crypto_onetimeauth.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ + crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c \ crypto_onetimeauth/poly1305/53/api.h \ crypto_onetimeauth/poly1305/53/auth_poly1305_53.c \ @@ -165,8 +167,10 @@ libsodium_la_SOURCES = \ 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 \ crypto_verify/16/ref/api.h \ crypto_verify/16/ref/verify_16.c \ + crypto_verify/32/verify_32_api.c \ crypto_verify/32/ref/api.h \ crypto_verify/32/ref/verify_32.c \ randombytes/randombytes.c \ diff --git a/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c b/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c new file mode 100644 index 00000000..c62693f6 --- /dev/null +++ b/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c @@ -0,0 +1,31 @@ +#include "crypto_generichash_blake2b.h" + +size_t +crypto_generichash_blake2b_bytes_min(void) { + return crypto_generichash_blake2b_BYTES_MIN; +} + +size_t +crypto_generichash_blake2b_bytes_max(void) { + return crypto_generichash_blake2b_BYTES_MAX; +} + +size_t +crypto_generichash_blake2b_keybytes_min(void) { + return crypto_generichash_blake2b_KEYBYTES_MIN; +} + +size_t +crypto_generichash_blake2b_keybytes_max(void) { + return crypto_generichash_blake2b_KEYBYTES_MAX; +} + +size_t +crypto_generichash_blake2b_blockbytes(void) { + return crypto_generichash_blake2b_BLOCKBYTES; +} + +const char * +crypto_generichash_blake2b_blockbytes_primitive(void) { + return "blake2b"; +} diff --git a/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c b/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c new file mode 100644 index 00000000..bd36a1f6 --- /dev/null +++ b/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c @@ -0,0 +1,16 @@ +#include "crypto_onetimeauth_poly1305.h" + +size_t +crypto_onetimeauth_poly1305_bytes(void) { + return crypto_onetimeauth_poly1305_BYTES; +} + +size_t +crypto_onetimeauth_poly1305_keybytes(void) { + return crypto_onetimeauth_poly1305_KEYBYTES; +} + +const char * +crypto_onetimeauth_poly1305_primitive(void) { + return "poly1305"; +} diff --git a/src/libsodium/crypto_verify/16/verify_16_api.c b/src/libsodium/crypto_verify/16/verify_16_api.c new file mode 100644 index 00000000..757f9b63 --- /dev/null +++ b/src/libsodium/crypto_verify/16/verify_16_api.c @@ -0,0 +1,6 @@ +#include "crypto_verify_16.h" + +size_t +crypto_verify_16_bytes(void) { + return crypto_verify_16_BYTES; +} diff --git a/src/libsodium/crypto_verify/32/verify_32_api.c b/src/libsodium/crypto_verify/32/verify_32_api.c new file mode 100644 index 00000000..6241c4d3 --- /dev/null +++ b/src/libsodium/crypto_verify/32/verify_32_api.c @@ -0,0 +1,6 @@ +#include "crypto_verify_32.h" + +size_t +crypto_verify_32_bytes(void) { + return crypto_verify_32_BYTES; +} diff --git a/src/libsodium/include/sodium/crypto_generichash_blake2b.h b/src/libsodium/include/sodium/crypto_generichash_blake2b.h index 0a560c2f..c48a7d13 100644 --- a/src/libsodium/include/sodium/crypto_generichash_blake2b.h +++ b/src/libsodium/include/sodium/crypto_generichash_blake2b.h @@ -3,6 +3,7 @@ #include #include +#include #include "export.h" @@ -33,6 +34,24 @@ CRYPTO_ALIGN(64) typedef struct crypto_generichash_blake2b_state { } crypto_generichash_blake2b_state; #pragma pack(pop) +SODIUM_EXPORT +size_t crypto_generichash_blake2b_bytes_min(void); + +SODIUM_EXPORT +size_t crypto_generichash_blake2b_bytes_max(void); + +SODIUM_EXPORT +size_t crypto_generichash_blake2b_keybytes_min(void); + +SODIUM_EXPORT +size_t crypto_generichash_blake2b_keybytes_max(void); + +SODIUM_EXPORT +size_t crypto_generichash_blake2b_blockbytes(void); + +SODIUM_EXPORT +const char * crypto_generichash_blake2b_blockbytes_primitive(void); + SODIUM_EXPORT int crypto_generichash_blake2b(unsigned char *out, size_t outlen, const unsigned char *in, diff --git a/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h b/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h index 70289b4d..19d55f18 100644 --- a/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +++ b/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h @@ -1,6 +1,7 @@ #ifndef crypto_onetimeauth_poly1305_H #define crypto_onetimeauth_poly1305_H +#include #include "export.h" #define crypto_onetimeauth_poly1305_BYTES 16U @@ -26,6 +27,15 @@ typedef struct crypto_onetimeauth_poly1305_implementation { const unsigned char *k); } crypto_onetimeauth_poly1305_implementation; +SODIUM_EXPORT +size_t crypto_onetimeauth_poly1305_bytes(void); + +SODIUM_EXPORT +size_t crypto_onetimeauth_poly1305_keybytes(void); + +SODIUM_EXPORT +const char * crypto_onetimeauth_poly1305_primitive(void); + SODIUM_EXPORT const char *crypto_onetimeauth_poly1305_ref_implementation_name(void); diff --git a/src/libsodium/include/sodium/crypto_verify_16.h b/src/libsodium/include/sodium/crypto_verify_16.h index 1c2c7b23..972a02f3 100644 --- a/src/libsodium/include/sodium/crypto_verify_16.h +++ b/src/libsodium/include/sodium/crypto_verify_16.h @@ -1,6 +1,7 @@ #ifndef crypto_verify_16_H #define crypto_verify_16_H +#include #include "export.h" #define crypto_verify_16_BYTES 16U @@ -9,6 +10,9 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_verify_16_bytes(void); + SODIUM_EXPORT int crypto_verify_16(const unsigned char *x, const unsigned char *y); diff --git a/src/libsodium/include/sodium/crypto_verify_32.h b/src/libsodium/include/sodium/crypto_verify_32.h index a76d1889..f3ada230 100644 --- a/src/libsodium/include/sodium/crypto_verify_32.h +++ b/src/libsodium/include/sodium/crypto_verify_32.h @@ -1,6 +1,7 @@ #ifndef crypto_verify_32_H #define crypto_verify_32_H +#include #include "export.h" #define crypto_verify_32_BYTES 32U @@ -9,6 +10,9 @@ extern "C" { #endif +SODIUM_EXPORT +size_t crypto_verify_32_bytes(void); + SODIUM_EXPORT int crypto_verify_32(const unsigned char *x, const unsigned char *y);