*
* \brief HMAC (RFC 2104) implementation
* \author Giovanni Bajo <rasky@develer.com>
- *
+ *
*/
#ifndef SEC_MAC_HMAC_H
#include <sec/mac.h>
#include <sec/hash.h>
-typedef struct HMAC_Context
+#include <alloca.h>
+
+typedef struct HmacContext
{
Mac m;
- Hash *h;
+ Hash *h;
uint8_t key[64];
-} HMAC_Context;
+} HmacContext;
+
+void hmac_init(HmacContext* hmac, Hash *h);
-void HMAC_init(HMAC_Context* hmac, Hash *h);
+#define hmac_stackinit(...) \
+ ({ HmacContext *ctx = alloca(sizeof(HmacContext)); hmac_init(ctx, ##__VA_ARGS__); &ctx->m; })
-int HMAC_testSetup(void);
-int HMAC_testRun(void);
-int HMAC_testTearDown(void);
+int hmac_testSetup(void);
+int hmac_testRun(void);
+int hmac_testTearDown(void);
#endif /* SEC_MAC_HMAC_H */