cregit-Linux how code gets into the kernel

Release 4.11 net/mac80211/aes_cmac.c

Directory: net/mac80211
/*
 * AES-128-CMAC with TLen 16 for IEEE 802.11w BIP
 * Copyright 2008, Jouni Malinen <j@w1.fi>
 *
 * 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.
 */

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/crypto.h>
#include <linux/export.h>
#include <linux/err.h>
#include <crypto/aes.h>

#include <net/mac80211.h>
#include "key.h"
#include "aes_cmac.h"


#define CMAC_TLEN 8 
/* CMAC TLen = 64 bits (8 octets) */

#define CMAC_TLEN_256 16 
/* CMAC TLen = 128 bits (16 octets) */

#define AAD_LEN 20


static const u8 zero[CMAC_TLEN_256];


void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, const u8 *data, size_t data_len, u8 *mic) { SHASH_DESC_ON_STACK(desc, tfm); u8 out[AES_BLOCK_SIZE]; desc->tfm = tfm; crypto_shash_init(desc); crypto_shash_update(desc, aad, AAD_LEN); crypto_shash_update(desc, data, data_len - CMAC_TLEN); crypto_shash_finup(desc, zero, CMAC_TLEN, out); memcpy(mic, out, CMAC_TLEN); }

Contributors

PersonTokensPropCommitsCommitProp
Jouni Malinen5156.04%266.67%
Ard Biesheuvel4043.96%133.33%
Total91100.00%3100.00%


void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad, const u8 *data, size_t data_len, u8 *mic) { SHASH_DESC_ON_STACK(desc, tfm); desc->tfm = tfm; crypto_shash_init(desc); crypto_shash_update(desc, aad, AAD_LEN); crypto_shash_update(desc, data, data_len - CMAC_TLEN_256); crypto_shash_finup(desc, zero, CMAC_TLEN_256, mic); }

Contributors

PersonTokensPropCommitsCommitProp
Jouni Malinen5167.11%266.67%
Ard Biesheuvel2532.89%133.33%
Total76100.00%3100.00%


struct crypto_shash *ieee80211_aes_cmac_key_setup(const u8 key[], size_t key_len) { struct crypto_shash *tfm; tfm = crypto_alloc_shash("cmac(aes)", 0, 0); if (!IS_ERR(tfm)) crypto_shash_setkey(tfm, key, key_len); return tfm; }

Contributors

PersonTokensPropCommitsCommitProp
Jouni Malinen4486.27%250.00%
Ard Biesheuvel611.76%125.00%
Ben Hutchings11.96%125.00%
Total51100.00%4100.00%


void ieee80211_aes_cmac_key_free(struct crypto_shash *tfm) { crypto_free_shash(tfm); }

Contributors

PersonTokensPropCommitsCommitProp
Jouni Malinen1386.67%150.00%
Ard Biesheuvel213.33%150.00%
Total15100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Jouni Malinen19869.96%233.33%
Ard Biesheuvel7827.56%116.67%
Emmanuel Grumbach31.06%116.67%
Johannes Berg31.06%116.67%
Ben Hutchings10.35%116.67%
Total283100.00%6100.00%
Directory: net/mac80211
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.