/* * aeskeywrap.h * Perform RFC3394 AES-based key wrap and unwrap functions. * * Copyright 2007, Broadcom Corporation * All Rights Reserved. * * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. * * $Id$ */ #ifndef _AESWRAP_H_ #define _AESWRAP_H_ #include #ifdef BCMDRIVER #include #else #include /* For size_t */ #endif #include #define AKW_BLOCK_LEN 8 /* Max size of wrapped data, not including overhead * The key wrap algorithm doesn't impose any upper bound the wrap length, * but we need something big enought to handle all users. 802.11i and * probably most other users will be limited by MTU size, so using a 2K * buffer limit seems relatively safe. */ #define AKW_MAX_WRAP_LEN 2048 /* aes_wrap: perform AES-based keywrap function defined in RFC3394 * return 0 on success, 1 on error * input is il bytes * output is (il+8) bytes */ int aes_wrap(size_t kl, uint8 *key, size_t il, uint8 *input, uint8 *output); /* aes_unwrap: perform AES-based key unwrap function defined in RFC3394, * return 0 on success, 1 on error * input is il bytes * output is (il-8) bytes */ int aes_unwrap(size_t kl, uint8 *key, size_t il, uint8 *input, uint8 *output); #endif /* _AESWRAP_H_ */