1 #ifndef __LIBSSH2_MAC_H
2 #define __LIBSSH2_MAC_H
3 
4 /* Copyright (C) 2009-2010 by Daniel Stenberg
5  *
6  * Redistribution and use in source and binary forms,
7  * with or without modification, are permitted provided
8  * that the following conditions are met:
9  *
10  *   Redistributions of source code must retain the above
11  *   copyright notice, this list of conditions and the
12  *   following disclaimer.
13  *
14  *   Redistributions in binary form must reproduce the above
15  *   copyright notice, this list of conditions and the following
16  *   disclaimer in the documentation and/or other materials
17  *   provided with the distribution.
18  *
19  *   Neither the name of the copyright holder nor the names
20  *   of any other contributors may be used to endorse or
21  *   promote products derived from this software without
22  *   specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
25  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
26  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
36  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
37  * OF SUCH DAMAGE.
38  *
39  */
40 
41 #include "libssh2_priv.h"
42 
43 struct _LIBSSH2_MAC_METHOD
44 {
45     const char *name;
46 
47     /* The length of a given MAC packet */
48     int mac_len;
49 
50     /* integrity key length */
51     int key_len;
52 
53     /* Message Authentication Code Hashing algo */
54     int (*init) (LIBSSH2_SESSION * session, unsigned char *key, int *free_key,
55                  void **abstract);
56     int (*hash) (LIBSSH2_SESSION * session, unsigned char *buf,
57                  uint32_t seqno, const unsigned char *packet,
58                  uint32_t packet_len, const unsigned char *addtl,
59                  uint32_t addtl_len, void **abstract);
60     int (*dtor) (LIBSSH2_SESSION * session, void **abstract);
61 };
62 
63 typedef struct _LIBSSH2_MAC_METHOD LIBSSH2_MAC_METHOD;
64 
65 const LIBSSH2_MAC_METHOD **_libssh2_mac_methods(void);
66 
67 #endif /* __LIBSSH2_MAC_H */
68