BeRTOS
aes.h
Go to the documentation of this file.
00001 
00040 #ifndef SEC_CIPHER_AES_H
00041 #define SEC_CIPHER_AES_H
00042 
00043 #include <sec/cipher.h>
00044 #include <sec/util.h>
00045 #include <alloca.h>
00046 
00047 typedef struct
00048 {
00049     BlockCipher c;
00050     uint32_t status;
00051     uint8_t expkey[44*4];
00052 } AES128_Context;
00053 
00054 typedef struct
00055 {
00056     BlockCipher c;
00057     uint32_t status;
00058     uint8_t expkey[52*4];
00059 } AES192_Context;
00060 
00061 typedef struct
00062 {
00063     BlockCipher c;
00064     uint32_t status;
00065     uint8_t expkey[60*4];
00066 } AES256_Context;
00067 
00068 void AES128_init(AES128_Context *c);
00069 void AES192_init(AES192_Context *c);
00070 void AES256_init(AES256_Context *c);
00071 
00072 #define AES128_stackinit(...) \
00073     ({ AES128_Context *ctx = alloca(sizeof(AES128_Context)); AES128_init(ctx, ##__VA_ARGS__); &ctx->c; })
00074 
00075 #define AES192_stackinit(...) \
00076     ({ AES192_Context *ctx = alloca(sizeof(AES192_Context)); AES192_init(ctx, ##__VA_ARGS__); &ctx->c; })
00077 
00078 #define AES256_stackinit(...) \
00079     ({ AES256_Context *ctx = alloca(sizeof(AES256_Context)); AES256_init(ctx, ##__VA_ARGS__); &ctx->c; })
00080 
00081 int AES_testSetup(void);
00082 int AES_testRun(void);
00083 int AES_testTearDown(void);
00084 
00085 #endif /* SEC_CIPHER_AES_H */