BeRTOS
ripemd.h
00001 #ifndef SEC_HASH_RIPEMD_H
00002 #define SEC_HASH_RIPEMD_H
00003 
00004 #include <cfg/compiler.h>
00005 #include <sec/hash.h>
00006 #include <alloca.h>
00007 
00008 typedef struct {
00009     Hash hash;
00010     uint32_t h[5];      /* The current hash state */
00011     uint64_t length;    /* Total number of _bits_ (not bytes) added to the
00012                            hash.  This includes bits that have been buffered
00013                            but not not fed through the compression function yet. */
00014     union {
00015         uint32_t w[16];
00016         uint8_t b[64];
00017     } buf;
00018     uint8_t bufpos;     /* number of bytes currently in the buffer */
00019 
00020 } RIPEMD_Context;
00021 
00022 void RIPEMD_init(RIPEMD_Context *ctx);
00023 
00024 #define RIPEMD_stackinit(...) \
00025     ({ RIPEMD_Context *ctx = alloca(sizeof(RIPEMD_Context)); RIPEMD_init(ctx , ##__VA_ARGS__); &ctx->hash; })
00026 
00027 int RIPEMD_testSetup(void);
00028 int RIPEMD_testRun(void);
00029 int RIPEMD_testTearDown(void);
00030 
00031 
00032 #endif /* SEC_HASH_RIPEMD_H */