SEC: implement stackinit() functions to simplify initialization and composition of...
[bertos.git] / bertos / sec / hash / md5.h
index c08a912b6ee3e5acacc1a4115c1ebae9e11dd62a..a6d886df3a3ec07fd0277b1f6830d5b10c3d861f 100644 (file)
  *
  * -->
  *
- * \brief SHA-1 Hashing algorithm.
+ * \brief MD5 Hashing algorithm.
  * \author Giovanni Bajo <rasky@develer.com>
  *
- * $WIZ$ module_name = "sha1"
+ * $WIZ$ module_name = "md5"
  */
 
 #ifndef SEC_HASH_MD5_H
@@ -41,6 +41,7 @@
 
 #include <sec/hash.h>
 #include <cfg/compiler.h>
+#include <alloca.h>
 
 typedef struct
 {
@@ -53,6 +54,9 @@ typedef struct
 
 void MD5_init(MD5_Context *ctx);
 
+#define MD5_stackinit(...) \
+       ({ MD5_Context *ctx = alloca(sizeof(MD5_Context)); MD5_init(ctx , ##__VA_ARGS__); &ctx->h; })
+
 int MD5_testSetup(void);
 int MD5_testRun(void);
 int MD5_testTearDown(void);