1 | /* ghmac.h - secure data hashing |
2 | * |
3 | * Copyright (C) 2011 Stef Walter <stefw@collabora.co.uk> |
4 | * |
5 | * SPDX-License-Identifier: LGPL-2.1-or-later |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2.1 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public License |
18 | * along with this library; if not, see <http://www.gnu.org/licenses/>. |
19 | */ |
20 | |
21 | #ifndef __G_HMAC_H__ |
22 | #define __G_HMAC_H__ |
23 | |
24 | #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) |
25 | #error "Only <glib.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <glib/gtypes.h> |
29 | #include "gchecksum.h" |
30 | |
31 | G_BEGIN_DECLS |
32 | |
33 | typedef struct _GHmac GHmac; |
34 | |
35 | GLIB_AVAILABLE_IN_2_30 |
36 | GHmac * g_hmac_new (GChecksumType digest_type, |
37 | const guchar *key, |
38 | gsize key_len); |
39 | GLIB_AVAILABLE_IN_2_30 |
40 | GHmac * g_hmac_copy (const GHmac *hmac); |
41 | GLIB_AVAILABLE_IN_2_30 |
42 | GHmac * g_hmac_ref (GHmac *hmac); |
43 | GLIB_AVAILABLE_IN_2_30 |
44 | void g_hmac_unref (GHmac *hmac); |
45 | GLIB_AVAILABLE_IN_2_30 |
46 | void g_hmac_update (GHmac *hmac, |
47 | const guchar *data, |
48 | gssize length); |
49 | GLIB_AVAILABLE_IN_2_30 |
50 | const gchar * g_hmac_get_string (GHmac *hmac); |
51 | GLIB_AVAILABLE_IN_2_30 |
52 | void g_hmac_get_digest (GHmac *hmac, |
53 | guint8 *buffer, |
54 | gsize *digest_len); |
55 | |
56 | GLIB_AVAILABLE_IN_2_30 |
57 | gchar *g_compute_hmac_for_data (GChecksumType digest_type, |
58 | const guchar *key, |
59 | gsize key_len, |
60 | const guchar *data, |
61 | gsize length); |
62 | GLIB_AVAILABLE_IN_2_30 |
63 | gchar *g_compute_hmac_for_string (GChecksumType digest_type, |
64 | const guchar *key, |
65 | gsize key_len, |
66 | const gchar *str, |
67 | gssize length); |
68 | GLIB_AVAILABLE_IN_2_50 |
69 | gchar *g_compute_hmac_for_bytes (GChecksumType digest_type, |
70 | GBytes *key, |
71 | GBytes *data); |
72 | |
73 | |
74 | G_END_DECLS |
75 | |
76 | #endif /* __G_CHECKSUM_H__ */ |
77 | |