BeRTOS
omac.h
Go to the documentation of this file.
00001 
00037 #ifndef SEC_MAC_OMAC_H
00038 #define SEC_MAC_OMAC_H
00039 
00040 #include <sec/mac.h>
00041 #include <sec/cipher.h>
00042 
00043 typedef struct OmacContext
00044 {
00045     Mac mac;
00046     BlockCipher *c;
00047     uint8_t Y[16];
00048     uint8_t accum[16];
00049     uint8_t acc;
00050 } OmacContext;
00051 
00052 void omac1_init(OmacContext *ctx, BlockCipher *c);
00053 void omac2_init(OmacContext *ctx, BlockCipher *c);
00054 
00055 #define omac1_stackinit(...) \
00056     ({ OmacContext *ctx = alloca(sizeof(OmacContext)); omac1_init(ctx, ##__VA_ARGS__); &ctx->mac; })
00057 #define omac2_stackinit(...) \
00058     ({ OmacContext *ctx = alloca(sizeof(OmacContext)); omac2_init(ctx, ##__VA_ARGS__); &ctx->mac; })
00059 
00060 int omac_testSetup(void);
00061 int omac_testTearDown(void);
00062 int omac_testRun(void);
00063 
00064 #endif /* SEC_MAC_OMAC_H */