Fix memory leak.
[gnutls.git] / lib / gnutls_hash_int.h
blob71e4c7e1261d5cc706343b415035d1d58408b415
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008 Free Software Foundation
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * USA
25 #ifndef GNUTLS_HASH_INT_H
26 # define GNUTLS_HASH_INT_H
28 #include <gnutls_int.h>
29 #include <gnutls/crypto.h>
30 #include <crypto.h>
32 /* for message digests */
34 typedef struct {
35 gnutls_crypto_mac_st* cc;
36 void* ctx;
37 } digest_reg_hd;
39 typedef struct
41 int registered; /* true or false(0) */
42 union {
43 gc_hash_handle gc; /* when not registered */
44 digest_reg_hd rh; /* when registered */
45 } hd;
46 gnutls_mac_algorithm_t algorithm;
47 const void *key;
48 int keysize;
49 } digest_hd_st;
51 int _gnutls_hmac_init (digest_hd_st*, gnutls_mac_algorithm_t algorithm,
52 const void *key, int keylen);
53 #define _gnutls_hmac_get_algo_len _gnutls_hash_get_algo_len
54 #define _gnutls_hmac _gnutls_hash
55 void _gnutls_hmac_deinit (digest_hd_st* handle, void *digest);
57 int _gnutls_mac_init_ssl3 (digest_hd_st*, gnutls_mac_algorithm_t algorithm, void *key,
58 int keylen);
59 void _gnutls_mac_deinit_ssl3 (digest_hd_st* handle, void *digest);
61 int _gnutls_hash_init (digest_hd_st*, gnutls_mac_algorithm_t algorithm);
62 int _gnutls_hash_get_algo_len (gnutls_mac_algorithm_t algorithm);
63 int _gnutls_hash (const digest_hd_st* handle, const void *text,
64 size_t textlen);
65 void _gnutls_hash_deinit (digest_hd_st* handle, void *digest);
67 int _gnutls_ssl3_generate_random (void *secret, int secret_len,
68 void *rnd, int random_len, int bytes,
69 opaque * ret);
70 int _gnutls_ssl3_hash_md5 (void *first, int first_len, void *second,
71 int second_len, int ret_len, opaque * ret);
73 void _gnutls_mac_deinit_ssl3_handshake (digest_hd_st* handle, void *digest,
74 opaque * key, uint32_t key_size);
76 int _gnutls_hash_copy (digest_hd_st* dst_handle, digest_hd_st * src_handle);
78 #endif /* GNUTLS_HASH_INT_H */