diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-10-17 15:05:33 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2016-10-17 16:14:04 +0200 |
commit | f4a067f9ffca603b45f7e82ddd2ba50e5904cea3 (patch) | |
tree | 7b50496f4eaa8952548eeece1ee28c9045f746d9 /net/mac80211/aes_ccm.h | |
parent | 1d4de2e222b41006007d7dbfce2abfe448217e49 (diff) | |
download | linux-f4a067f9ffca603b45f7e82ddd2ba50e5904cea3.tar.gz linux-f4a067f9ffca603b45f7e82ddd2ba50e5904cea3.tar.bz2 linux-f4a067f9ffca603b45f7e82ddd2ba50e5904cea3.zip |
mac80211: move struct aead_req off the stack
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>
Diffstat (limited to 'net/mac80211/aes_ccm.h')
-rw-r--r-- | net/mac80211/aes_ccm.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/mac80211/aes_ccm.h b/net/mac80211/aes_ccm.h index 6a73d1e4d186..fcd3254c5cf0 100644 --- a/net/mac80211/aes_ccm.h +++ b/net/mac80211/aes_ccm.h @@ -12,12 +12,14 @@ #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); -void 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_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); |