summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mac.h4
-rw-r--r--lib/string.h10
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/mac.h b/lib/mac.h
index 9dba8f89..5fc216fd 100644
--- a/lib/mac.h
+++ b/lib/mac.h
@@ -21,6 +21,7 @@
#define ALG_SHA256 0x04
#define ALG_SHA384 0x05
#define ALG_SHA512 0x06
+#define ALG_HMAC 0x10
#define ALG_HMAC_MD5 0x11
#define ALG_HMAC_SHA1 0x12
#define ALG_HMAC_SHA224 0x13
@@ -34,6 +35,9 @@
#define HASH_STORAGE sizeof(struct sha512_context)
#define MAC_STORAGE sizeof(struct hmac_context)
+/* This value is used by several IETF protocols for padding */
+#define HMAC_MAGIC htonl(0x878FE1F3)
+
/* Generic context used by hash functions */
struct hash_context
{
diff --git a/lib/string.h b/lib/string.h
index bf0b7cb0..75cb88dd 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -39,6 +39,16 @@ xstrdup(const char *c)
return z;
}
+static inline void
+memset32(void *D, u32 val, uint n)
+{
+ u32 *dst = D;
+ uint i;
+
+ for (i = 0; i < n; i++)
+ dst[i] = val;
+}
+
#define ROUTER_ID_64_LENGTH 23
#endif