diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-10-25 17:04:17 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-11-02 16:23:53 +0100 |
commit | de2a27e255b6ec834d11c005909b28a150c7c0db (patch) | |
tree | 9b6f61fa7f9d3cb05abf5e72b9fdb8d5ba9bdef7 /lib/md5.h | |
parent | 7eec3988758cb4c19a0ab3bf90cab2a4914165be (diff) |
Add generic message authentication interface
Add generic interface for generating and verifying MACs (message
authentication codes). Replace multiple HMAC implementation with
a generic one.
Diffstat (limited to 'lib/md5.h')
-rw-r--r-- | lib/md5.h | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -19,29 +19,18 @@ #define MD5_BLOCK_SIZE 64 +struct hash_context; + struct md5_context { u32 buf[4]; u32 bits[2]; byte in[64]; }; -void md5_init(struct md5_context *ctx); -void md5_update(struct md5_context *ctx, const byte *buf, uint len); -byte *md5_final(struct md5_context *ctx); - - -/* - * HMAC-MD5 - */ - -struct md5_hmac_context { - struct md5_context ictx; - struct md5_context octx; -}; -void md5_hmac_init(struct md5_hmac_context *ctx, const byte *key, size_t keylen); -void md5_hmac_update(struct md5_hmac_context *ctx, const byte *buf, size_t buflen); -byte *md5_hmac_final(struct md5_hmac_context *ctx); +void md5_init(struct hash_context *ctx); +void md5_update(struct hash_context *ctx, const byte *buf, uint len); +byte *md5_final(struct hash_context *ctx); #endif /* _BIRD_MD5_H_ */ |