1/*
2 * aeskeywrap.h
3 * Perform RFC3394 AES-based key wrap and unwrap functions.
4 *
5 * Copyright 2003, Broadcom Corporation
6 * All Rights Reserved.
7 *
8 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; the
9 * contents of this file may not be disclosed to third parties, copied or
10 * duplicated in any form, in whole or in part, without the prior written
11 * permission of Broadcom Corporation.
12 *
13 * $Id: aeskeywrap.h,v 1.1.1.1 2008/10/15 03:31:22 james26_jang Exp $
14 */
15
16#ifndef _AESWRAP_H_
17#define _AESWRAP_H_
18
19#include <typedefs.h>
20/* For size_t */
21#include <stddef.h>
22#include <bcmcrypto/aes.h>
23
24#define AKW_BLOCK_LEN	8
25/* Max size of wrapped data, not including overhead
26   The key wrap algorithm doesn't impose any upper bound the wrap length,
27   but we need something big enought to handle all users.  802.11i and
28   probably most other users will be limited by MTU size, so using a 2K
29   buffer limit seems relatively safe. */
30#define AKW_MAX_WRAP_LEN	2048
31
32/* aes_wrap: perform AES-based keywrap function defined in RFC3394
33	return 0 on success, 1 on error
34	input is il bytes
35	output is (il+8) bytes */
36int aes_wrap(size_t kl, uint8 *key, size_t il, uint8 *input, uint8 *output);
37
38/* aes_unwrap: perform AES-based key unwrap function defined in RFC3394,
39	return 0 on success, 1 on error
40	input is il bytes
41	output is (il-8) bytes */
42int aes_unwrap(size_t kl, uint8 *key, size_t il, uint8 *input, uint8 *output);
43
44#endif /* _AESWRAP_H_ */
45
46