Wrap crypto_onetimeauth

This commit is contained in:
Frank Denis 2013-04-21 09:13:22 -07:00
parent 61c4f21c97
commit 08e08c966b
3 changed files with 61 additions and 2 deletions

View File

@ -40,6 +40,7 @@ libsodium_la_SOURCES = \
crypto_hashblocks/sha256/ref/api.h \ crypto_hashblocks/sha256/ref/api.h \
crypto_hashblocks/sha512/ref/blocks_sha512.c \ crypto_hashblocks/sha512/ref/blocks_sha512.c \
crypto_hashblocks/sha512/ref/api.h \ crypto_hashblocks/sha512/ref/api.h \
crypto_onetimeauth/crypto_onetimeauth.c \
crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \
crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c \
crypto_onetimeauth/poly1305/53/api.h \ crypto_onetimeauth/poly1305/53/api.h \

View File

@ -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);
}

View File

@ -1,13 +1,37 @@
#ifndef crypto_onetimeauth_H #ifndef crypto_onetimeauth_H
#define crypto_onetimeauth_H #define crypto_onetimeauth_H
#include <stdlib.h>
#include "crypto_onetimeauth_poly1305.h" #include "crypto_onetimeauth_poly1305.h"
#include "export.h" #include "export.h"
#define crypto_onetimeauth crypto_onetimeauth_poly1305 #ifdef __cplusplus
#define crypto_onetimeauth_verify crypto_onetimeauth_poly1305_verify extern "C" {
#endif
#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES #define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES
SODIUM_EXPORT
size_t crypto_onetimeauth_bytes(void);
#define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES #define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES
SODIUM_EXPORT
size_t crypto_onetimeauth_keybytes(void);
#define crypto_onetimeauth_PRIMITIVE "poly1305" #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 #endif