1/* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License as 4 * published by the Free Software Foundation; either version 2 of 5 * the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 15 * MA 02111-1307 USA 16 */ 17/* 18 * aeskeywrap.h 19 * Perform RFC3394 AES-based key wrap and unwrap functions. 20 * 21 * Copyright 2003, ASUSTeK Inc. 22 * All Rights Reserved. 23 * 24 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ASUSTeK Inc.; the 25 * contents of this file may not be disclosed to third parties, copied or 26 * duplicated in any form, in whole or in part, without the prior written 27 * permission of ASUSTeK Inc.. 28 * 29 */ 30 31#ifndef _AESWRAP_H_ 32#define _AESWRAP_H_ 33 34#include <typedefs.h> 35/* For size_t */ 36#include <stddef.h> 37#include <bcmcrypto/aes.h> 38 39#define AKW_BLOCK_LEN 8 40/* Max size of wrapped data, not including overhead 41 The key wrap algorithm doesn't impose any upper bound the wrap length, 42 but we need something big enought to handle all users. 802.11i and 43 probably most other users will be limited by MTU size, so using a 2K 44 buffer limit seems relatively safe. */ 45#define AKW_MAX_WRAP_LEN 2048 46 47/* aes_wrap: perform AES-based keywrap function defined in RFC3394 48 return 0 on success, 1 on error 49 input is il bytes 50 output is (il+8) bytes */ 51int aes_wrap(size_t kl, uint8 *key, size_t il, uint8 *input, uint8 *output); 52 53/* aes_unwrap: perform AES-based key unwrap function defined in RFC3394, 54 return 0 on success, 1 on error 55 input is il bytes 56 output is (il-8) bytes */ 57int aes_unwrap(size_t kl, uint8 *key, size_t il, uint8 *input, uint8 *output); 58 59#endif /* _AESWRAP_H_ */ 60 61