5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2001 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
27 This is the HMAC object to create keyed hash values for message
28 authentication. These routines uses already implemented hash functions.
29 HMAC's can be created using any hash function implemented in SILC. These
30 routines were created according to RFC2104. Following short description
41 Length of the MAC the HMAC is to produce (bytes).
48 The hash object to tell what hash function to use with this HMAC.
52 TRUE if the `hash' was allocated and FALSE if it is static and
58 The key and its length used to make the HMAC. This is set
59 with silc_hmac_set_key function.
62 typedef struct SilcHmacStruct *SilcHmac;
69 struct SilcHmacStruct {
78 int silc_hmac_register(SilcHmacObject *hmac);
79 int silc_hmac_unregister(SilcHmacObject *hmac);
80 int silc_hmac_alloc(char *name, SilcHash hash, SilcHmac *new_hmac);
81 void silc_hmac_free(SilcHmac hmac);
82 int silc_hmac_is_supported(const char *name);
83 char *silc_hmac_get_supported();
84 uint32 silc_hmac_len(SilcHmac hmac);
85 void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
87 void silc_hmac_make(SilcHmac hmac, unsigned char *data,
88 uint32 data_len, unsigned char *return_hash,
90 void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
92 unsigned char *key, uint32 key_len,
93 unsigned char *return_hash,
95 void silc_hmac_make_truncated(SilcHmac hmac,
99 unsigned char *return_hash);