Home | History | Annotate | Line # | Download | only in dist
      1 /*	$NetBSD: mac.h,v 1.9 2026/04/08 18:58:40 christos Exp $	*/
      2 /* $OpenBSD: mac.h,v 1.11 2026/03/03 09:57:25 dtucker Exp $ */
      3 
      4 /*
      5  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 
     28 #ifndef SSHMAC_H
     29 #define SSHMAC_H
     30 
     31 #include <sys/types.h>
     32 
     33 struct sshmac {
     34 	char	*name;
     35 	int	enabled;
     36 	u_int	mac_len;
     37 	u_char	*key;
     38 	u_int	key_len;
     39 	int	type;
     40 	int	etm;		/* Encrypt-then-MAC */
     41 	struct ssh_hmac_ctx	*hmac_ctx;
     42 	struct umac_ctx		*umac_ctx;
     43 };
     44 
     45 int	 mac_valid(const char *);
     46 char	*mac_alg_list(char);
     47 int	 mac_setup(struct sshmac *, char *);
     48 int	 mac_init(struct sshmac *);
     49 int	 mac_compute(struct sshmac *, uint32_t, const u_char *, int,
     50     u_char *, size_t);
     51 int	 mac_check(struct sshmac *, uint32_t, const u_char *, size_t,
     52     const u_char *, size_t);
     53 void	 mac_clear(struct sshmac *);
     54 
     55 #endif /* SSHMAC_H */
     56