blob: 86cb140e3087fb0323e31e790cb03d9b6ec5c533 [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 *
20 * File: Michael.h
21 *
22 * Purpose: Reference implementation for Michael
23 * written by Niels Ferguson
24 *
25 * Author: Kyle Hsu
26 *
27 * Date: Jan 2, 2003
28 *
29 */
30
Forest Bond5449c682009-04-25 10:30:44 -040031#ifndef __MICHAEL_H__
32#define __MICHAEL_H__
33
Malcolm Priestleyd0daef32014-03-06 22:44:23 +000034#include <linux/types.h>
35
Malcolm Priestleyd0daef32014-03-06 22:44:23 +000036void MIC_vInit(u32 dwK0, u32 dwK1);
Forest Bond5449c682009-04-25 10:30:44 -040037
Charles Clément6b35b7b2010-05-07 12:30:19 -070038void MIC_vUnInit(void);
Forest Bond5449c682009-04-25 10:30:44 -040039
Archana kumaric8e46f42013-10-19 15:47:04 +053040/* Append bytes to the message to be MICed */
Charles Clément2989e962010-06-05 15:13:47 -070041void MIC_vAppend(unsigned char *src, unsigned int nBytes);
Forest Bond5449c682009-04-25 10:30:44 -040042
Archana kumaric8e46f42013-10-19 15:47:04 +053043/* Get the MIC result. Destination should accept 8 bytes of result. */
44/* This also resets the message to empty. */
Malcolm Priestleyd0daef32014-03-06 22:44:23 +000045void MIC_vGetMIC(u32 *pdwL, u32 *pdwR);
Forest Bond5449c682009-04-25 10:30:44 -040046
Archana kumaric8e46f42013-10-19 15:47:04 +053047/* Rotation functions on 32 bit values */
Joe Perchesa51ff902013-03-18 10:44:57 -070048#define ROL32(A, n) \
49 (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1)))
50#define ROR32(A, n) ROL32((A), 32-(n))
Forest Bond5449c682009-04-25 10:30:44 -040051
Archana kumaric8e46f42013-10-19 15:47:04 +053052#endif /*__MICHAEL_H__ */