diff options
author | Toke Høiland-Jørgensen <toke@toke.dk> | 2021-04-10 17:33:28 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2021-06-06 16:26:58 +0200 |
commit | 725d9af94a6eaf3cbce1b107e36c8cf342828ea6 (patch) | |
tree | 5d7533ca9ba06ad1c836e70f9efbeeeaf6130d9b /lib/mac.h | |
parent | e5724f71d2c054bc51d66092beb6af4da21e0c62 (diff) |
Lib: Add Blake2s and Blake2b hash functions
The Babel MAC authentication RFC recommends implementing Blake2s as one of
the supported algorithms. In order to achieve do this, add the blake2b and
blake2s hash functions for MAC authentication. The hashing function
implementations are the reference implementations from blake2.net.
The Blake2 algorithms allow specifying an arbitrary output size, and the
Babel MAC spec says to implement Blake2s with 128-bit output. To satisfy
this, we add two different variants of each of the algorithms, one using
the default size (256 bits for Blake2s, 512 bits for Blake2b), and one
using half the default output size.
Update to BIRD coding style done by committer.
Diffstat (limited to 'lib/mac.h')
-rw-r--r-- | lib/mac.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -12,6 +12,7 @@ #include "nest/bird.h" #include "lib/sha512.h" +#include "lib/blake2.h" #define ALG_UNDEFINED 0 @@ -21,6 +22,10 @@ #define ALG_SHA256 0x04 #define ALG_SHA384 0x05 #define ALG_SHA512 0x06 +#define ALG_BLAKE2S_128 0x07 +#define ALG_BLAKE2S_256 0x08 +#define ALG_BLAKE2B_256 0x09 +#define ALG_BLAKE2B_512 0x0A #define ALG_HMAC 0x10 #define ALG_HMAC_MD5 0x11 #define ALG_HMAC_SHA1 0x12 @@ -71,6 +76,8 @@ union mac_context_union { struct mac_context mac; struct nrmh_context nrmh; struct hmac_context hmac; + struct blake2s_context blake2s; + struct blake2b_context blake2b; }; |