+ crypto_onetimeauth streaming interface

This commit is contained in:
Frank Denis 2014-06-19 20:32:37 -07:00
parent 4df5a1b404
commit 9cba9c39e3
2 changed files with 40 additions and 0 deletions

View File

@ -32,3 +32,28 @@ crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
{ {
return crypto_onetimeauth_poly1305_verify(h, in, inlen, k); return crypto_onetimeauth_poly1305_verify(h, in, inlen, k);
} }
int
crypto_onetimeauth_init(crypto_onetimeauth_state *state,
const unsigned char *key)
{
return crypto_onetimeauth_poly1305_init
((crypto_onetimeauth_poly1305_state *) state, key);
}
int
crypto_onetimeauth_update(crypto_onetimeauth_state *state,
const unsigned char *in,
unsigned long long inlen)
{
return crypto_onetimeauth_poly1305_update
((crypto_onetimeauth_poly1305_state *) state, in, inlen);
}
int
crypto_onetimeauth_final(crypto_onetimeauth_state *state,
unsigned char *out)
{
return crypto_onetimeauth_poly1305_final
((crypto_onetimeauth_poly1305_state *) state, out);
}

View File

@ -13,6 +13,8 @@
extern "C" { extern "C" {
#endif #endif
typedef crypto_onetimeauth_poly1305_state crypto_onetimeauth_state;
#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES #define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES
SODIUM_EXPORT SODIUM_EXPORT
size_t crypto_onetimeauth_bytes(void); size_t crypto_onetimeauth_bytes(void);
@ -33,6 +35,19 @@ SODIUM_EXPORT
int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in, int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
unsigned long long inlen, const unsigned char *k); unsigned long long inlen, const unsigned char *k);
SODIUM_EXPORT
int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
const unsigned char *key);
SODIUM_EXPORT
int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
const unsigned char *in,
unsigned long long inlen);
SODIUM_EXPORT
int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
unsigned char *out);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif