1323124Sdes/* $OpenBSD: mac.h,v 1.10 2016/07/08 03:44:42 djm Exp $ */ 276259Sgreen/* 376259Sgreen * Copyright (c) 2001 Markus Friedl. All rights reserved. 476259Sgreen * 576259Sgreen * Redistribution and use in source and binary forms, with or without 676259Sgreen * modification, are permitted provided that the following conditions 776259Sgreen * are met: 876259Sgreen * 1. Redistributions of source code must retain the above copyright 976259Sgreen * notice, this list of conditions and the following disclaimer. 1076259Sgreen * 2. Redistributions in binary form must reproduce the above copyright 1176259Sgreen * notice, this list of conditions and the following disclaimer in the 1276259Sgreen * documentation and/or other materials provided with the distribution. 1376259Sgreen * 1476259Sgreen * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1576259Sgreen * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1676259Sgreen * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1776259Sgreen * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1876259Sgreen * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1976259Sgreen * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2076259Sgreen * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2176259Sgreen * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2276259Sgreen * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2376259Sgreen * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2476259Sgreen */ 2576259Sgreen 26295367Sdes#ifndef SSHMAC_H 27295367Sdes#define SSHMAC_H 28295367Sdes 29295367Sdes#include <sys/types.h> 30295367Sdes 31295367Sdesstruct sshmac { 32295367Sdes char *name; 33295367Sdes int enabled; 34295367Sdes u_int mac_len; 35295367Sdes u_char *key; 36295367Sdes u_int key_len; 37295367Sdes int type; 38295367Sdes int etm; /* Encrypt-then-MAC */ 39295367Sdes struct ssh_hmac_ctx *hmac_ctx; 40295367Sdes struct umac_ctx *umac_ctx; 41295367Sdes}; 42295367Sdes 4392555Sdesint mac_valid(const char *); 44262566Sdeschar *mac_alg_list(char); 45295367Sdesint mac_setup(struct sshmac *, char *); 46295367Sdesint mac_init(struct sshmac *); 47295367Sdesint mac_compute(struct sshmac *, u_int32_t, const u_char *, int, 48295367Sdes u_char *, size_t); 49323124Sdesint mac_check(struct sshmac *, u_int32_t, const u_char *, size_t, 50323124Sdes const u_char *, size_t); 51295367Sdesvoid mac_clear(struct sshmac *); 52295367Sdes 53295367Sdes#endif /* SSHMAC_H */ 54