From f44c1e477fa58459dd0c6f0a63aca18e9a20a213 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 21 Apr 2013 08:42:55 -0700 Subject: [PATCH] And finally, wrap crypto_stream macros --- src/libsodium/crypto_stream/crypto_stream.c | 18 ++++++++++++++++++ src/libsodium/include/sodium/crypto_stream.h | 15 +++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/libsodium/crypto_stream/crypto_stream.c b/src/libsodium/crypto_stream/crypto_stream.c index 8a5f5720..50a9c1c0 100644 --- a/src/libsodium/crypto_stream/crypto_stream.c +++ b/src/libsodium/crypto_stream/crypto_stream.c @@ -1,6 +1,24 @@ #include "crypto_stream.h" +size_t +crypto_stream_keybytes(void) +{ + return crypto_stream_KEYBYTES; +} + +size_t +crypto_stream_noncebytes(void) +{ + return crypto_stream_NONCEBYTES; +} + +const char * +crypto_stream_primitive(void) +{ + return crypto_stream_PRIMITIVE; +} + int crypto_stream(unsigned char *c, unsigned long long clen, const unsigned char *n, const unsigned char *k) diff --git a/src/libsodium/include/sodium/crypto_stream.h b/src/libsodium/include/sodium/crypto_stream.h index 8890122f..6c6d9ac9 100644 --- a/src/libsodium/include/sodium/crypto_stream.h +++ b/src/libsodium/include/sodium/crypto_stream.h @@ -1,16 +1,23 @@ #ifndef crypto_stream_H #define crypto_stream_H -#include "crypto_stream_xsalsa20.h" +#include -#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES -#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES -#define crypto_stream_PRIMITIVE "xsalsa20" +#include "crypto_stream_xsalsa20.h" #ifdef __cplusplus extern "C" { #endif +#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES +size_t crypto_stream_keybytes(void); + +#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES +size_t crypto_stream_noncebytes(void); + +#define crypto_stream_PRIMITIVE "xsalsa20" +const char *crypto_stream_primitive(void); + int crypto_stream(unsigned char *c, unsigned long long clen, const unsigned char *n, const unsigned char *k);