diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 366f9b86..b5a70de5 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -40,6 +40,7 @@ libsodium_la_SOURCES = \ crypto_hashblocks/sha256/ref/api.h \ crypto_hashblocks/sha512/ref/blocks_sha512.c \ crypto_hashblocks/sha512/ref/api.h \ + crypto_onetimeauth/crypto_onetimeauth.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c \ crypto_onetimeauth/poly1305/53/api.h \ diff --git a/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c b/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c new file mode 100644 index 00000000..19c6e71b --- /dev/null +++ b/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c @@ -0,0 +1,34 @@ + +#include "crypto_onetimeauth.h" + +size_t +crypto_onetimeauth_bytes(void) +{ + return crypto_onetimeauth_BYTES; +} + +size_t +crypto_onetimeauth_keybytes(void) +{ + return crypto_onetimeauth_KEYBYTES; +} + +const char * +crypto_onetimeauth_primitive(void) +{ + return crypto_onetimeauth_PRIMITIVE; +} + +int +crypto_onetimeauth(unsigned char *out, const unsigned char *in, + unsigned long long inlen, const unsigned char *k) +{ + return crypto_onetimeauth_poly1305(out, in, inlen, k); +} + +int +crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in, + unsigned long long inlen, const unsigned char *k) +{ + return crypto_onetimeauth_poly1305_verify(h, in, inlen, k); +} diff --git a/src/libsodium/include/sodium/crypto_onetimeauth.h b/src/libsodium/include/sodium/crypto_onetimeauth.h index 65c0fd3b..b8d40bec 100644 --- a/src/libsodium/include/sodium/crypto_onetimeauth.h +++ b/src/libsodium/include/sodium/crypto_onetimeauth.h @@ -1,13 +1,37 @@ #ifndef crypto_onetimeauth_H #define crypto_onetimeauth_H +#include + #include "crypto_onetimeauth_poly1305.h" #include "export.h" -#define crypto_onetimeauth crypto_onetimeauth_poly1305 -#define crypto_onetimeauth_verify crypto_onetimeauth_poly1305_verify +#ifdef __cplusplus +extern "C" { +#endif + #define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES +SODIUM_EXPORT +size_t crypto_onetimeauth_bytes(void); + #define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES +SODIUM_EXPORT +size_t crypto_onetimeauth_keybytes(void); + #define crypto_onetimeauth_PRIMITIVE "poly1305" +SODIUM_EXPORT +const char *crypto_onetimeauth_primitive(void); + +SODIUM_EXPORT +int crypto_onetimeauth(unsigned char *out, const unsigned char *in, + unsigned long long inlen, const unsigned char *k); + +SODIUM_EXPORT +int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in, + unsigned long long inlen, const unsigned char *k); + +#ifdef __cplusplus +} +#endif #endif