From d689a92c17b53f3a02512e23e92592e198a49953 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 21 Apr 2013 17:36:53 +0200 Subject: [PATCH] Wrap crypto_shorthash macros --- .../crypto_shorthash/crypto_shorthash.c | 18 ++++++++++++++++++ .../include/sodium/crypto_shorthash.h | 15 +++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/libsodium/crypto_shorthash/crypto_shorthash.c b/src/libsodium/crypto_shorthash/crypto_shorthash.c index 37274f08..b68b58a4 100644 --- a/src/libsodium/crypto_shorthash/crypto_shorthash.c +++ b/src/libsodium/crypto_shorthash/crypto_shorthash.c @@ -1,6 +1,24 @@ #include "crypto_shorthash.h" +size_t +crypto_shorthash_bytes(void) +{ + return crypto_shorthash_BYTES; +} + +size_t +crypto_shorthash_keybytes(void) +{ + return crypto_shorthash_KEYBYTES; +} + +const char * +crypto_shorthash_primitive(void) +{ + return crypto_shorthash_PRIMITIVE; +} + int crypto_shorthash(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k) diff --git a/src/libsodium/include/sodium/crypto_shorthash.h b/src/libsodium/include/sodium/crypto_shorthash.h index 0669c888..9e8d900b 100644 --- a/src/libsodium/include/sodium/crypto_shorthash.h +++ b/src/libsodium/include/sodium/crypto_shorthash.h @@ -1,16 +1,23 @@ #ifndef crypto_shorthash_H #define crypto_shorthash_H -#include "crypto_shorthash_siphash24.h" +#include -#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES -#define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES -#define crypto_shorthash_PRIMITIVE "siphash24" +#include "crypto_shorthash_siphash24.h" #ifdef __cplusplus extern "C" { #endif +#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES +size_t crypto_shorthash_bytes(void); + +#define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES +size_t crypto_shorthash_keybytes(void); + +#define crypto_shorthash_PRIMITIVE "siphash24" +const char *crypto_shorthash_primitive(void); + int crypto_shorthash(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k);