Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 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 Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 31 | #ifndef __MICHAEL_H__ |
| 32 | #define __MICHAEL_H__ |
| 33 | |
Andres More | 4fcf949 | 2013-02-25 20:32:55 -0500 | [diff] [blame] | 34 | #include <linux/types.h> |
| 35 | |
Andres More | 52a7e64 | 2013-02-25 20:32:53 -0500 | [diff] [blame] | 36 | void MIC_vInit(u32 dwK0, u32 dwK1); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 37 | |
Andres More | 8611a29 | 2010-05-01 14:25:00 -0300 | [diff] [blame] | 38 | void MIC_vUnInit(void); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 39 | |
| 40 | // Append bytes to the message to be MICed |
Andres More | b902fbf | 2013-02-25 20:32:51 -0500 | [diff] [blame] | 41 | void MIC_vAppend(u8 * src, unsigned int nBytes); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 42 | |
| 43 | // Get the MIC result. Destination should accept 8 bytes of result. |
| 44 | // This also resets the message to empty. |
Andres More | 52a7e64 | 2013-02-25 20:32:53 -0500 | [diff] [blame] | 45 | void MIC_vGetMIC(u32 * pdwL, u32 * pdwR); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 46 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 47 | // Rotation functions on 32 bit values |
Andres More | d9d1ccb | 2010-05-26 20:00:36 -0300 | [diff] [blame] | 48 | #define ROL32(A, n) \ |
| 49 | (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1))) |
| 50 | #define ROR32(A, n) ROL32((A), 32-(n)) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 51 | |
Andres More | e7b07d1 | 2010-05-01 19:12:26 -0300 | [diff] [blame] | 52 | #endif /* __MICHAEL_H__ */ |