From af28f8f2cd28bdbc4c8951114fe4c9aac077400d Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 21 Oct 2013 22:03:37 -0700 Subject: [PATCH] Export stream_salsa20 constants --- ChangeLog | 2 +- src/libsodium/Makefile.am | 1 + .../crypto_stream/salsa20/stream_salsa20_api.c | 15 +++++++++++++++ .../include/sodium/crypto_stream_salsa20.h.in | 15 ++++++++++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a688334fa2..c862b9144d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ - big-endian architectures are now supported as well - The donna_c64 implementation of curve25519_donna_c64 now handles non-canonical points like the ref implementation - - Missing scalarmult_curve25519 constants are now exported + - Missing scalarmult_curve25519 and stream_salsa20 constants are now exported - A crypto_onetimeauth_poly1305_ref() wrapper has been added * Version 0.4.3 diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index f34306c7c2..b108f6e64a 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -159,6 +159,7 @@ libsodium_la_SOURCES = \ crypto_stream/aes256estream/stream_aes256estream_api.c \ crypto_stream/aes256estream/hongjun/api.h \ crypto_stream/aes256estream/hongjun/ecrypt-sync.h \ + crypto_stream/salsa20/stream_salsa20_api.c \ crypto_stream/salsa2012/stream_salsa2012_api.c \ crypto_stream/salsa2012/ref/api.h \ crypto_stream/salsa2012/ref/stream_salsa2012.c \ diff --git a/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c b/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c index 037fb59dac..fce456e412 100644 --- a/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +++ b/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c @@ -1 +1,16 @@ #include "crypto_stream_salsa20.h" + +size_t +crypto_stream_salsa20_keybytes(void) { + return crypto_stream_salsa20_KEYBYTES; +} + +size_t +crypto_stream_salsa20_noncebytes(void) { + return crypto_stream_salsa20_NONCEBYTES; +} + +const char * +crypto_stream_salsa20_primitive(void) { + return "salsa20"; +} diff --git a/src/libsodium/include/sodium/crypto_stream_salsa20.h.in b/src/libsodium/include/sodium/crypto_stream_salsa20.h.in index 9f8e9df2e5..b55e0ef3db 100644 --- a/src/libsodium/include/sodium/crypto_stream_salsa20.h.in +++ b/src/libsodium/include/sodium/crypto_stream_salsa20.h.in @@ -15,15 +15,24 @@ # endif #endif +#include #include "export.h" -#define crypto_stream_salsa20_KEYBYTES 32U -#define crypto_stream_salsa20_NONCEBYTES 8U - #ifdef __cplusplus extern "C" { #endif +#define crypto_stream_salsa20_KEYBYTES 32U +SODIUM_EXPORT +size_t crypto_stream_salsa20_keybytes(void); + +#define crypto_stream_salsa20_NONCEBYTES 8U +SODIUM_EXPORT +size_t crypto_stream_salsa20_noncebytes(void); + +SODIUM_EXPORT +const char * crypto_stream_salsa20_primitive(void); + SODIUM_EXPORT int crypto_stream_salsa20(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *);