DCERPC: factor out proto_tree_add_dcerpc_drep()
[wireshark-wip.git] / wsutil / sha1.h
blob5a558c9f780b86eefb2ef00c48ee4ab472b69b3c
1 /*
2 * FIPS-180-1 compliant SHA-1 implementation
4 * $Id$
6 * Copyright (C) 2001-2003 Christophe Devine
7 * Copyright (C) 2012 Chris Elston, Katalix Systems Ltd <celston@katalix.com>
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.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * Changed to use guint instead of uint 2004 by Anders Broman
24 * Original code found at http://www.cr0.net:8040/code/crypto/sha1/
25 * References: http://www.ietf.org/rfc/rfc3174.txt?number=3174
27 * 2012-08-21 - C Elston - Split sha1_hmac function to allow incremental usage.
30 #ifndef _SHA1_H
31 #define _SHA1_H
33 #include "ws_symbol_export.h"
35 typedef struct
37 guint32 total[2];
38 guint32 state[5];
39 guint8 buffer[64];
41 sha1_context;
43 WS_DLL_PUBLIC
44 void sha1_starts( sha1_context *ctx );
45 WS_DLL_PUBLIC
46 void sha1_update( sha1_context *ctx, const guint8 *input, guint32 length );
47 WS_DLL_PUBLIC
48 void sha1_finish( sha1_context *ctx, guint8 digest[20] );
50 typedef struct {
51 sha1_context ctx;
52 guint8 k_opad[64];
54 sha1_hmac_context;
56 WS_DLL_PUBLIC
57 void sha1_hmac_starts( sha1_hmac_context *hctx, const guint8 *key, guint32 keylen );
58 WS_DLL_PUBLIC
59 void sha1_hmac_update( sha1_hmac_context *hctx, const guint8 *buf, guint32 buflen );
60 WS_DLL_PUBLIC
61 void sha1_hmac_finish( sha1_hmac_context *hctx, guint8 digest[20] );
62 WS_DLL_PUBLIC
63 void sha1_hmac( const guint8 *key, guint32 keylen, const guint8 *buf, guint32 buflen,
64 guint8 digest[20] );
66 #endif /* sha1.h */