forked from luck/tmp_suning_uos_patched
f4a067f9ff
Some crypto implementations (such as the generic CCM wrapper in crypto/) use scatterlists to map fields of private data in their struct aead_req. This means these data structures cannot live in the vmalloc area, which means that they cannot live on the stack (with CONFIG_VMAP_STACK.) This currently occurs only with the generic software implementation, but the private data and usage is implementation specific, so move the whole data structures off the stack into heap by allocating every time we need to use them. In addition, take care not to put any of our own stack allocations into scatterlists. This involves reserving some extra room when allocating the aead_request structures, and referring to those allocations in the scatter- lists (while copying the data from the stack before the crypto operation) Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
29 lines
869 B
C
29 lines
869 B
C
/*
|
|
* Copyright 2003-2004, Instant802 Networks, Inc.
|
|
* Copyright 2006, Devicescape Software, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef AES_CCM_H
|
|
#define AES_CCM_H
|
|
|
|
#include <linux/crypto.h>
|
|
|
|
#define CCM_AAD_LEN 32
|
|
|
|
struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
|
|
size_t key_len,
|
|
size_t mic_len);
|
|
int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
|
|
u8 *data, size_t data_len, u8 *mic,
|
|
size_t mic_len);
|
|
int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
|
|
u8 *data, size_t data_len, u8 *mic,
|
|
size_t mic_len);
|
|
void ieee80211_aes_key_free(struct crypto_aead *tfm);
|
|
|
|
#endif /* AES_CCM_H */
|