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