blob: ef17c999009e16d74138512b797620ee8b5e0679 [file] [log] [blame]
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -07001/*
2 * Host AP crypt: host-based CCMP encryption implementation for Host AP driver
3 *
4 * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. See README and COPYING for
9 * more details.
10 */
11
Larry Finger94a79942011-08-23 19:00:42 -050012#include <linux/version.h>
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070013#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/slab.h>
16#include <linux/random.h>
17#include <linux/skbuff.h>
18#include <linux/netdevice.h>
19#include <linux/if_ether.h>
20#include <linux/if_arp.h>
21#include <asm/string.h>
22#include <linux/wireless.h>
Larry Finger94a79942011-08-23 19:00:42 -050023#include "rtllib.h"
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070024
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070025#include <linux/crypto.h>
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070026
Mike McCormackcb762152011-07-11 08:56:20 +090027#include <linux/scatterlist.h>
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070028
29#define AES_BLOCK_LEN 16
30#define CCMP_HDR_LEN 8
31#define CCMP_MIC_LEN 8
32#define CCMP_TK_LEN 16
33#define CCMP_PN_LEN 6
34
Larry Finger94a79942011-08-23 19:00:42 -050035struct rtllib_ccmp_data {
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070036 u8 key[CCMP_TK_LEN];
37 int key_set;
38
39 u8 tx_pn[CCMP_PN_LEN];
40 u8 rx_pn[CCMP_PN_LEN];
41
42 u32 dot11RSNAStatsCCMPFormatErrors;
43 u32 dot11RSNAStatsCCMPReplays;
44 u32 dot11RSNAStatsCCMPDecryptErrors;
45
46 int key_idx;
47
48 struct crypto_tfm *tfm;
49
50 /* scratch buffers for virt_to_page() (crypto API) */
51 u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
52 tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN];
53 u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
54};
55
Larry Finger94a79942011-08-23 19:00:42 -050056void rtllib_ccmp_aes_encrypt(struct crypto_tfm *tfm,
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070057 const u8 pt[16], u8 ct[16])
58{
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070059 crypto_cipher_encrypt_one((void*)tfm, ct, pt);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070060}
61
Larry Finger94a79942011-08-23 19:00:42 -050062static void * rtllib_ccmp_init(int key_idx)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070063{
Larry Finger94a79942011-08-23 19:00:42 -050064 struct rtllib_ccmp_data *priv;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070065
Larry Finger94a79942011-08-23 19:00:42 -050066 priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070067 if (priv == NULL)
68 goto fail;
Larry Finger94a79942011-08-23 19:00:42 -050069 memset(priv, 0, sizeof(*priv));
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070070 priv->key_idx = key_idx;
71
Mike McCormackcb762152011-07-11 08:56:20 +090072 priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070073 if (IS_ERR(priv->tfm)) {
Larry Finger94a79942011-08-23 19:00:42 -050074 printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070075 "crypto API aes\n");
76 priv->tfm = NULL;
77 goto fail;
78 }
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070079 return priv;
80
81fail:
82 if (priv) {
83 if (priv->tfm)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070084 crypto_free_cipher((void*)priv->tfm);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070085 kfree(priv);
86 }
87
88 return NULL;
89}
90
91
Larry Finger94a79942011-08-23 19:00:42 -050092static void rtllib_ccmp_deinit(void *priv)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070093{
Larry Finger94a79942011-08-23 19:00:42 -050094 struct rtllib_ccmp_data *_priv = priv;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070095 if (_priv && _priv->tfm)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070096 crypto_free_cipher((void*)_priv->tfm);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -070097 kfree(priv);
98}
99
100
101static inline void xor_block(u8 *b, u8 *a, size_t len)
102{
103 int i;
104 for (i = 0; i < len; i++)
105 b[i] ^= a[i];
106}
107
108
109
110static void ccmp_init_blocks(struct crypto_tfm *tfm,
Larry Finger94a79942011-08-23 19:00:42 -0500111 struct rtllib_hdr_4addr *hdr,
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700112 u8 *pn, size_t dlen, u8 *b0, u8 *auth,
113 u8 *s0)
114{
115 u8 *pos, qc = 0;
116 size_t aad_len;
117 u16 fc;
118 int a4_included, qc_included;
119 u8 aad[2 * AES_BLOCK_LEN];
120
121 fc = le16_to_cpu(hdr->frame_ctl);
Larry Finger94a79942011-08-23 19:00:42 -0500122 a4_included = ((fc & (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)) ==
123 (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS));
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700124 /*
Larry Finger94a79942011-08-23 19:00:42 -0500125 qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700126 (WLAN_FC_GET_STYPE(fc) & 0x08));
127 */
Larry Finger94a79942011-08-23 19:00:42 -0500128 qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700129 (WLAN_FC_GET_STYPE(fc) & 0x80));
130 aad_len = 22;
131 if (a4_included)
132 aad_len += 6;
133 if (qc_included) {
134 pos = (u8 *) &hdr->addr4;
135 if (a4_included)
136 pos += 6;
137 qc = *pos & 0x0f;
138 aad_len += 2;
139 }
140 /* CCM Initial Block:
141 * Flag (Include authentication header, M=3 (8-octet MIC),
142 * L=1 (2-octet Dlen))
143 * Nonce: 0x00 | A2 | PN
144 * Dlen */
145 b0[0] = 0x59;
146 b0[1] = qc;
147 memcpy(b0 + 2, hdr->addr2, ETH_ALEN);
148 memcpy(b0 + 8, pn, CCMP_PN_LEN);
149 b0[14] = (dlen >> 8) & 0xff;
150 b0[15] = dlen & 0xff;
151
152 /* AAD:
153 * FC with bits 4..6 and 11..13 masked to zero; 14 is always one
154 * A1 | A2 | A3
155 * SC with bits 4..15 (seq#) masked to zero
156 * A4 (if present)
157 * QC (if present)
158 */
159 pos = (u8 *) hdr;
160 aad[0] = 0; /* aad_len >> 8 */
161 aad[1] = aad_len & 0xff;
162 aad[2] = pos[0] & 0x8f;
163 aad[3] = pos[1] & 0xc7;
164 memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN);
165 pos = (u8 *) &hdr->seq_ctl;
166 aad[22] = pos[0] & 0x0f;
167 aad[23] = 0; /* all bits masked */
168 memset(aad + 24, 0, 8);
169 if (a4_included)
170 memcpy(aad + 24, hdr->addr4, ETH_ALEN);
171 if (qc_included) {
172 aad[a4_included ? 30 : 24] = qc;
173 /* rest of QC masked */
174 }
175
176 /* Start with the first block and AAD */
Larry Finger94a79942011-08-23 19:00:42 -0500177 rtllib_ccmp_aes_encrypt(tfm, b0, auth);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700178 xor_block(auth, aad, AES_BLOCK_LEN);
Larry Finger94a79942011-08-23 19:00:42 -0500179 rtllib_ccmp_aes_encrypt(tfm, auth, auth);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700180 xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
Larry Finger94a79942011-08-23 19:00:42 -0500181 rtllib_ccmp_aes_encrypt(tfm, auth, auth);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700182 b0[0] &= 0x07;
183 b0[14] = b0[15] = 0;
Larry Finger94a79942011-08-23 19:00:42 -0500184 rtllib_ccmp_aes_encrypt(tfm, b0, s0);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700185}
186
187
188
Larry Finger94a79942011-08-23 19:00:42 -0500189static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700190{
Larry Finger94a79942011-08-23 19:00:42 -0500191 struct rtllib_ccmp_data *key = priv;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700192 int data_len, i;
193 u8 *pos;
Larry Finger94a79942011-08-23 19:00:42 -0500194 struct rtllib_hdr_4addr *hdr;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700195 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700196 if (skb_headroom(skb) < CCMP_HDR_LEN ||
197 skb_tailroom(skb) < CCMP_MIC_LEN ||
198 skb->len < hdr_len)
199 return -1;
200
201 data_len = skb->len - hdr_len;
202 pos = skb_push(skb, CCMP_HDR_LEN);
203 memmove(pos, pos + CCMP_HDR_LEN, hdr_len);
204 pos += hdr_len;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700205
206 i = CCMP_PN_LEN - 1;
207 while (i >= 0) {
208 key->tx_pn[i]++;
209 if (key->tx_pn[i] != 0)
210 break;
211 i--;
212 }
213
214 *pos++ = key->tx_pn[5];
215 *pos++ = key->tx_pn[4];
216 *pos++ = 0;
217 *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */;
218 *pos++ = key->tx_pn[3];
219 *pos++ = key->tx_pn[2];
220 *pos++ = key->tx_pn[1];
221 *pos++ = key->tx_pn[0];
222
223
Larry Finger94a79942011-08-23 19:00:42 -0500224 hdr = (struct rtllib_hdr_4addr *) skb->data;
225 if (!tcb_desc->bHwSec) {
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700226 int blocks, last, len;
227 u8 *mic;
228 u8 *b0 = key->tx_b0;
229 u8 *b = key->tx_b;
230 u8 *e = key->tx_e;
231 u8 *s0 = key->tx_s0;
232
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700233 mic = skb_put(skb, CCMP_MIC_LEN);
234
235 ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
236
237 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
238 last = data_len % AES_BLOCK_LEN;
239
240 for (i = 1; i <= blocks; i++) {
241 len = (i == blocks && last) ? last : AES_BLOCK_LEN;
242 /* Authentication */
243 xor_block(b, pos, len);
Larry Finger94a79942011-08-23 19:00:42 -0500244 rtllib_ccmp_aes_encrypt(key->tfm, b, b);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700245 /* Encryption, with counter */
246 b0[14] = (i >> 8) & 0xff;
247 b0[15] = i & 0xff;
Larry Finger94a79942011-08-23 19:00:42 -0500248 rtllib_ccmp_aes_encrypt(key->tfm, b0, e);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700249 xor_block(pos, e, len);
250 pos += len;
251 }
252
253 for (i = 0; i < CCMP_MIC_LEN; i++)
254 mic[i] = b[i] ^ s0[i];
255 }
256 return 0;
257}
258
259
Larry Finger94a79942011-08-23 19:00:42 -0500260static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700261{
Larry Finger94a79942011-08-23 19:00:42 -0500262 struct rtllib_ccmp_data *key = priv;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700263 u8 keyidx, *pos;
Larry Finger94a79942011-08-23 19:00:42 -0500264 struct rtllib_hdr_4addr *hdr;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700265 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
266 u8 pn[6];
267
268 if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) {
269 key->dot11RSNAStatsCCMPFormatErrors++;
270 return -1;
271 }
272
Larry Finger94a79942011-08-23 19:00:42 -0500273 hdr = (struct rtllib_hdr_4addr *) skb->data;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700274 pos = skb->data + hdr_len;
275 keyidx = pos[3];
276 if (!(keyidx & (1 << 5))) {
277 if (net_ratelimit()) {
278 printk(KERN_DEBUG "CCMP: received packet without ExtIV"
Larry Finger94a79942011-08-23 19:00:42 -0500279 " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2));
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700280 }
281 key->dot11RSNAStatsCCMPFormatErrors++;
282 return -2;
283 }
284 keyidx >>= 6;
285 if (key->key_idx != keyidx) {
286 printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame "
287 "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv);
288 return -6;
289 }
290 if (!key->key_set) {
291 if (net_ratelimit()) {
Larry Finger94a79942011-08-23 19:00:42 -0500292 printk(KERN_DEBUG "CCMP: received packet from " MAC_FMT
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700293 " with keyid=%d that does not have a configured"
Larry Finger94a79942011-08-23 19:00:42 -0500294 " key\n", MAC_ARG(hdr->addr2), keyidx);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700295 }
296 return -3;
297 }
298
299 pn[0] = pos[7];
300 pn[1] = pos[6];
301 pn[2] = pos[5];
302 pn[3] = pos[4];
303 pn[4] = pos[1];
304 pn[5] = pos[0];
305 pos += 8;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700306 if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700307 key->dot11RSNAStatsCCMPReplays++;
308 return -4;
309 }
Larry Finger94a79942011-08-23 19:00:42 -0500310 if (!tcb_desc->bHwSec) {
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700311 size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN;
312 u8 *mic = skb->data + skb->len - CCMP_MIC_LEN;
313 u8 *b0 = key->rx_b0;
314 u8 *b = key->rx_b;
315 u8 *a = key->rx_a;
316 int i, blocks, last, len;
317
318
319 ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
320 xor_block(mic, b, CCMP_MIC_LEN);
321
322 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
323 last = data_len % AES_BLOCK_LEN;
324
325 for (i = 1; i <= blocks; i++) {
326 len = (i == blocks && last) ? last : AES_BLOCK_LEN;
327 /* Decrypt, with counter */
328 b0[14] = (i >> 8) & 0xff;
329 b0[15] = i & 0xff;
Larry Finger94a79942011-08-23 19:00:42 -0500330 rtllib_ccmp_aes_encrypt(key->tfm, b0, b);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700331 xor_block(pos, b, len);
332 /* Authentication */
333 xor_block(a, pos, len);
Larry Finger94a79942011-08-23 19:00:42 -0500334 rtllib_ccmp_aes_encrypt(key->tfm, a, a);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700335 pos += len;
336 }
337
338 if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
339 if (net_ratelimit()) {
340 printk(KERN_DEBUG "CCMP: decrypt failed: STA="
Larry Finger94a79942011-08-23 19:00:42 -0500341 MAC_FMT "\n", MAC_ARG(hdr->addr2));
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700342 }
343 key->dot11RSNAStatsCCMPDecryptErrors++;
344 return -5;
345 }
346
347 memcpy(key->rx_pn, pn, CCMP_PN_LEN);
348 }
349 /* Remove hdr and MIC */
350 memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len);
351 skb_pull(skb, CCMP_HDR_LEN);
352 skb_trim(skb, skb->len - CCMP_MIC_LEN);
353
354 return keyidx;
355}
356
357
Larry Finger94a79942011-08-23 19:00:42 -0500358static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700359{
Larry Finger94a79942011-08-23 19:00:42 -0500360 struct rtllib_ccmp_data *data = priv;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700361 int keyidx;
362 struct crypto_tfm *tfm = data->tfm;
363
364 keyidx = data->key_idx;
365 memset(data, 0, sizeof(*data));
366 data->key_idx = keyidx;
367 data->tfm = tfm;
368 if (len == CCMP_TK_LEN) {
369 memcpy(data->key, key, CCMP_TK_LEN);
370 data->key_set = 1;
371 if (seq) {
372 data->rx_pn[0] = seq[5];
373 data->rx_pn[1] = seq[4];
374 data->rx_pn[2] = seq[3];
375 data->rx_pn[3] = seq[2];
376 data->rx_pn[4] = seq[1];
377 data->rx_pn[5] = seq[0];
378 }
379 crypto_cipher_setkey((void*)data->tfm, data->key, CCMP_TK_LEN);
380 } else if (len == 0)
381 data->key_set = 0;
382 else
383 return -1;
384
385 return 0;
386}
387
388
Larry Finger94a79942011-08-23 19:00:42 -0500389static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700390{
Larry Finger94a79942011-08-23 19:00:42 -0500391 struct rtllib_ccmp_data *data = priv;
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700392
393 if (len < CCMP_TK_LEN)
394 return -1;
395
396 if (!data->key_set)
397 return 0;
398 memcpy(key, data->key, CCMP_TK_LEN);
399
400 if (seq) {
401 seq[0] = data->tx_pn[5];
402 seq[1] = data->tx_pn[4];
403 seq[2] = data->tx_pn[3];
404 seq[3] = data->tx_pn[2];
405 seq[4] = data->tx_pn[1];
406 seq[5] = data->tx_pn[0];
407 }
408
409 return CCMP_TK_LEN;
410}
411
412
Larry Finger94a79942011-08-23 19:00:42 -0500413static char * rtllib_ccmp_print_stats(char *p, void *priv)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700414{
Larry Finger94a79942011-08-23 19:00:42 -0500415 struct rtllib_ccmp_data *ccmp = priv;
416 p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
417 "tx_pn=%02x%02x%02x%02x%02x%02x "
418 "rx_pn=%02x%02x%02x%02x%02x%02x "
419 "format_errors=%d replays=%d decrypt_errors=%d\n",
420 ccmp->key_idx, ccmp->key_set,
421 MAC_ARG(ccmp->tx_pn), MAC_ARG(ccmp->rx_pn),
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700422 ccmp->dot11RSNAStatsCCMPFormatErrors,
423 ccmp->dot11RSNAStatsCCMPReplays,
424 ccmp->dot11RSNAStatsCCMPDecryptErrors);
425
426 return p;
427}
428
Larry Finger94a79942011-08-23 19:00:42 -0500429void rtllib_ccmp_null(void)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700430{
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700431 return;
432}
433
Larry Finger94a79942011-08-23 19:00:42 -0500434static struct rtllib_crypto_ops rtllib_crypt_ccmp = {
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700435 .name = "CCMP",
Larry Finger94a79942011-08-23 19:00:42 -0500436 .init = rtllib_ccmp_init,
437 .deinit = rtllib_ccmp_deinit,
438 .encrypt_mpdu = rtllib_ccmp_encrypt,
439 .decrypt_mpdu = rtllib_ccmp_decrypt,
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700440 .encrypt_msdu = NULL,
441 .decrypt_msdu = NULL,
Larry Finger94a79942011-08-23 19:00:42 -0500442 .set_key = rtllib_ccmp_set_key,
443 .get_key = rtllib_ccmp_get_key,
444 .print_stats = rtllib_ccmp_print_stats,
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700445 .extra_prefix_len = CCMP_HDR_LEN,
446 .extra_postfix_len = CCMP_MIC_LEN,
447 .owner = THIS_MODULE,
448};
449
450
Larry Finger94a79942011-08-23 19:00:42 -0500451int __init rtllib_crypto_ccmp_init(void)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700452{
Larry Finger94a79942011-08-23 19:00:42 -0500453 return rtllib_register_crypto_ops(&rtllib_crypt_ccmp);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700454}
455
456
Larry Finger94a79942011-08-23 19:00:42 -0500457void __exit rtllib_crypto_ccmp_exit(void)
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700458{
Larry Finger94a79942011-08-23 19:00:42 -0500459 rtllib_unregister_crypto_ops(&rtllib_crypt_ccmp);
Greg Kroah-Hartmanecdfa442009-08-04 15:57:55 -0700460}