~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to ubuntu/rtl8192se/rtllib/rtllib_crypt_ccmp.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
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
 
 
12
 
#include <linux/version.h>
13
 
#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>
23
 
#ifdef _RTL8192_EXT_PATCH_      
24
 
#include <linux/etherdevice.h>
25
 
#endif
26
 
#include "rtllib.h"
27
 
 
28
 
#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
29
 
#include "rtl_crypto.h"
30
 
#else
31
 
#include <linux/crypto.h>
32
 
#endif
33
 
 
34
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 
35
 
    #include <asm/scatterlist.h>
36
 
#else
37
 
    #include <linux/scatterlist.h>
38
 
#endif
39
 
 
40
 
#ifndef BUILT_IN_RTLLIB
41
 
MODULE_AUTHOR("Jouni Malinen");
42
 
MODULE_DESCRIPTION("Host AP crypt: CCMP");
43
 
MODULE_LICENSE("GPL");
44
 
#endif
45
 
 
46
 
 
47
 
#define AES_BLOCK_LEN 16
48
 
#define CCMP_HDR_LEN 8
49
 
#define CCMP_MIC_LEN 8
50
 
#define CCMP_TK_LEN 16
51
 
#define CCMP_PN_LEN 6
52
 
 
53
 
struct rtllib_ccmp_data {
54
 
        u8 key[CCMP_TK_LEN];
55
 
        int key_set;
56
 
 
57
 
        u8 tx_pn[CCMP_PN_LEN];
58
 
        u8 rx_pn[CCMP_PN_LEN];
59
 
 
60
 
        u32 dot11RSNAStatsCCMPFormatErrors;
61
 
        u32 dot11RSNAStatsCCMPReplays;
62
 
        u32 dot11RSNAStatsCCMPDecryptErrors;
63
 
 
64
 
        int key_idx;
65
 
 
66
 
        struct crypto_tfm *tfm;
67
 
 
68
 
        /* scratch buffers for virt_to_page() (crypto API) */
69
 
        u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
70
 
                tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN];
71
 
        u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
72
 
};
73
 
 
74
 
void rtllib_ccmp_aes_encrypt(struct crypto_tfm *tfm,
75
 
                             const u8 pt[16], u8 ct[16])
76
 
{
77
 
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
78
 
        struct scatterlist src, dst;
79
 
 
80
 
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
81
 
        src.page = virt_to_page(pt);
82
 
        src.offset = offset_in_page(pt);
83
 
        src.length = AES_BLOCK_LEN;
84
 
 
85
 
        dst.page = virt_to_page(ct);
86
 
        dst.offset = offset_in_page(ct);
87
 
        dst.length = AES_BLOCK_LEN;
88
 
 
89
 
#else
90
 
        sg_init_one(&src, pt, AES_BLOCK_LEN);
91
 
        sg_init_one(&dst, ct, AES_BLOCK_LEN);
92
 
#endif
93
 
 
94
 
        crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
95
 
#else
96
 
        crypto_cipher_encrypt_one((void*)tfm, ct, pt);
97
 
#endif
98
 
}
99
 
 
100
 
static void * rtllib_ccmp_init(int key_idx)
101
 
{
102
 
        struct rtllib_ccmp_data *priv;
103
 
 
104
 
        priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
105
 
        if (priv == NULL)
106
 
                goto fail;
107
 
        memset(priv, 0, sizeof(*priv));
108
 
        priv->key_idx = key_idx;
109
 
 
110
 
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
111
 
        priv->tfm = crypto_alloc_tfm("aes", 0);
112
 
        if (priv->tfm == NULL) {
113
 
                printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
114
 
                       "crypto API aes\n");
115
 
                goto fail;
116
 
        }
117
 
       #else
118
 
       priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
119
 
        if (IS_ERR(priv->tfm)) {
120
 
                printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
121
 
                       "crypto API aes\n");
122
 
                priv->tfm = NULL;
123
 
                goto fail;
124
 
        }
125
 
        #endif
126
 
        return priv;
127
 
 
128
 
fail:
129
 
        if (priv) {
130
 
                if (priv->tfm)
131
 
                        #if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
132
 
                        crypto_free_tfm(priv->tfm);
133
 
                    #else
134
 
                        crypto_free_cipher((void*)priv->tfm);
135
 
                      #endif
136
 
                kfree(priv);
137
 
        }
138
 
 
139
 
        return NULL;
140
 
}
141
 
 
142
 
 
143
 
static void rtllib_ccmp_deinit(void *priv)
144
 
{
145
 
        struct rtllib_ccmp_data *_priv = priv;
146
 
        if (_priv && _priv->tfm)
147
 
#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
148
 
                crypto_free_tfm(_priv->tfm);
149
 
#else
150
 
                crypto_free_cipher((void*)_priv->tfm);
151
 
#endif
152
 
        kfree(priv);
153
 
}
154
 
 
155
 
 
156
 
static inline void xor_block(u8 *b, u8 *a, size_t len)
157
 
{
158
 
        int i;
159
 
        for (i = 0; i < len; i++)
160
 
                b[i] ^= a[i];
161
 
}
162
 
 
163
 
 
164
 
 
165
 
static void ccmp_init_blocks(struct crypto_tfm *tfm,
166
 
                             struct rtllib_hdr_4addr *hdr,
167
 
                             u8 *pn, size_t dlen, u8 *b0, u8 *auth,
168
 
                             u8 *s0)
169
 
{
170
 
        u8 *pos, qc = 0;
171
 
        size_t aad_len;
172
 
        u16 fc;
173
 
        int a4_included, qc_included;
174
 
        u8 aad[2 * AES_BLOCK_LEN];
175
 
 
176
 
        fc = le16_to_cpu(hdr->frame_ctl);
177
 
        a4_included = ((fc & (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)) ==
178
 
                       (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS));
179
 
        /*
180
 
        qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
181
 
                       (WLAN_FC_GET_STYPE(fc) & 0x08));
182
 
        */                     
183
 
        qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
184
 
                       (WLAN_FC_GET_STYPE(fc) & 0x80));
185
 
        aad_len = 22;
186
 
        if (a4_included)
187
 
                aad_len += 6;
188
 
        if (qc_included) {
189
 
                pos = (u8 *) &hdr->addr4;
190
 
                if (a4_included)
191
 
                        pos += 6;
192
 
                qc = *pos & 0x0f;
193
 
                aad_len += 2;
194
 
        }
195
 
        /* CCM Initial Block:
196
 
         * Flag (Include authentication header, M=3 (8-octet MIC),
197
 
         *       L=1 (2-octet Dlen))
198
 
         * Nonce: 0x00 | A2 | PN
199
 
         * Dlen */
200
 
        b0[0] = 0x59;
201
 
        b0[1] = qc;
202
 
        memcpy(b0 + 2, hdr->addr2, ETH_ALEN);
203
 
        memcpy(b0 + 8, pn, CCMP_PN_LEN);
204
 
        b0[14] = (dlen >> 8) & 0xff;
205
 
        b0[15] = dlen & 0xff;
206
 
 
207
 
        /* AAD:
208
 
         * FC with bits 4..6 and 11..13 masked to zero; 14 is always one
209
 
         * A1 | A2 | A3
210
 
         * SC with bits 4..15 (seq#) masked to zero
211
 
         * A4 (if present)
212
 
         * QC (if present)
213
 
         */
214
 
        pos = (u8 *) hdr;
215
 
        aad[0] = 0; /* aad_len >> 8 */
216
 
        aad[1] = aad_len & 0xff;
217
 
        aad[2] = pos[0] & 0x8f;
218
 
        aad[3] = pos[1] & 0xc7;
219
 
        memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN);
220
 
        pos = (u8 *) &hdr->seq_ctl;
221
 
        aad[22] = pos[0] & 0x0f;
222
 
        aad[23] = 0; /* all bits masked */
223
 
        memset(aad + 24, 0, 8);
224
 
        if (a4_included)
225
 
                memcpy(aad + 24, hdr->addr4, ETH_ALEN);
226
 
        if (qc_included) {
227
 
                aad[a4_included ? 30 : 24] = qc;
228
 
                /* rest of QC masked */
229
 
        }
230
 
 
231
 
        /* Start with the first block and AAD */
232
 
        rtllib_ccmp_aes_encrypt(tfm, b0, auth);
233
 
        xor_block(auth, aad, AES_BLOCK_LEN);
234
 
        rtllib_ccmp_aes_encrypt(tfm, auth, auth);
235
 
        xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
236
 
        rtllib_ccmp_aes_encrypt(tfm, auth, auth);
237
 
        b0[0] &= 0x07;
238
 
        b0[14] = b0[15] = 0;
239
 
        rtllib_ccmp_aes_encrypt(tfm, b0, s0);
240
 
}
241
 
 
242
 
 
243
 
 
244
 
static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
245
 
{
246
 
        struct rtllib_ccmp_data *key = priv;
247
 
        int data_len, i;
248
 
        u8 *pos;
249
 
        struct rtllib_hdr_4addr *hdr;
250
 
        cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
251
 
#ifdef _RTL8192_EXT_PATCH_      
252
 
        u8 broadcastaddr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
253
 
        u8 is_broadcast_data = 0;
254
 
#endif
255
 
        if (skb_headroom(skb) < CCMP_HDR_LEN ||
256
 
            skb_tailroom(skb) < CCMP_MIC_LEN ||
257
 
            skb->len < hdr_len)
258
 
                return -1;
259
 
 
260
 
        data_len = skb->len - hdr_len;
261
 
        pos = skb_push(skb, CCMP_HDR_LEN);
262
 
        memmove(pos, pos + CCMP_HDR_LEN, hdr_len);
263
 
        pos += hdr_len;
264
 
 
265
 
        i = CCMP_PN_LEN - 1;
266
 
        while (i >= 0) {
267
 
                key->tx_pn[i]++;
268
 
                if (key->tx_pn[i] != 0)
269
 
                        break;
270
 
                i--;
271
 
        }
272
 
 
273
 
        *pos++ = key->tx_pn[5];
274
 
        *pos++ = key->tx_pn[4];
275
 
        *pos++ = 0;
276
 
        *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */;
277
 
        *pos++ = key->tx_pn[3];
278
 
        *pos++ = key->tx_pn[2];
279
 
        *pos++ = key->tx_pn[1];
280
 
        *pos++ = key->tx_pn[0];
281
 
 
282
 
 
283
 
        hdr = (struct rtllib_hdr_4addr *) skb->data;
284
 
#ifdef _RTL8192_EXT_PATCH_      
285
 
        if(tcb_desc->badhoc == 0){
286
 
                if(memcmp(hdr->addr1,broadcastaddr,6) == 0){
287
 
                        is_broadcast_data = 1;
288
 
                        tcb_desc->bHwSec = 0;
289
 
                }
290
 
                if(is_multicast_ether_addr(hdr->addr1)){
291
 
                        tcb_desc->bHwSec = 0;
292
 
                }
293
 
        }
294
 
#endif
295
 
        if (!tcb_desc->bHwSec)
296
 
        {
297
 
                int blocks, last, len;
298
 
                u8 *mic;
299
 
                u8 *b0 = key->tx_b0;
300
 
                u8 *b = key->tx_b;
301
 
                u8 *e = key->tx_e;
302
 
                u8 *s0 = key->tx_s0;
303
 
 
304
 
                mic = skb_put(skb, CCMP_MIC_LEN);
305
 
                
306
 
                ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
307
 
        
308
 
                blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
309
 
                last = data_len % AES_BLOCK_LEN;
310
 
        
311
 
                for (i = 1; i <= blocks; i++) {
312
 
                        len = (i == blocks && last) ? last : AES_BLOCK_LEN;
313
 
                        /* Authentication */
314
 
                        xor_block(b, pos, len);
315
 
                        rtllib_ccmp_aes_encrypt(key->tfm, b, b);
316
 
                        /* Encryption, with counter */
317
 
                        b0[14] = (i >> 8) & 0xff;
318
 
                        b0[15] = i & 0xff;
319
 
                        rtllib_ccmp_aes_encrypt(key->tfm, b0, e);
320
 
                        xor_block(pos, e, len);
321
 
                        pos += len;
322
 
                }
323
 
        
324
 
                for (i = 0; i < CCMP_MIC_LEN; i++)
325
 
                        mic[i] = b[i] ^ s0[i];
326
 
        }
327
 
        return 0;
328
 
}
329
 
 
330
 
 
331
 
static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
332
 
{
333
 
        struct rtllib_ccmp_data *key = priv;
334
 
        u8 keyidx, *pos;
335
 
        struct rtllib_hdr_4addr *hdr;
336
 
        cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
337
 
        u8 pn[6];
338
 
 
339
 
        if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) {
340
 
                key->dot11RSNAStatsCCMPFormatErrors++;
341
 
                return -1;
342
 
        }
343
 
 
344
 
        hdr = (struct rtllib_hdr_4addr *) skb->data;
345
 
        pos = skb->data + hdr_len;
346
 
        keyidx = pos[3];
347
 
        if (!(keyidx & (1 << 5))) {
348
 
                if (net_ratelimit()) {
349
 
                        printk(KERN_DEBUG "CCMP: received packet without ExtIV"
350
 
                               " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2));
351
 
                }
352
 
                key->dot11RSNAStatsCCMPFormatErrors++;
353
 
                return -2;
354
 
        }
355
 
        keyidx >>= 6;
356
 
        if (key->key_idx != keyidx) {
357
 
                printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame "
358
 
                       "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv);
359
 
                return -6;
360
 
        }
361
 
        if (!key->key_set) {
362
 
                if (net_ratelimit()) {
363
 
                        printk(KERN_DEBUG "CCMP: received packet from " MAC_FMT
364
 
                               " with keyid=%d that does not have a configured"
365
 
                               " key\n", MAC_ARG(hdr->addr2), keyidx);
366
 
                }
367
 
                return -3;
368
 
        }
369
 
 
370
 
        pn[0] = pos[7];
371
 
        pn[1] = pos[6];
372
 
        pn[2] = pos[5];
373
 
        pn[3] = pos[4];
374
 
        pn[4] = pos[1];
375
 
        pn[5] = pos[0];
376
 
        pos += 8;
377
 
#ifndef _RTL8192_EXT_PATCH_     
378
 
        if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
379
 
                if (net_ratelimit()) {
380
 
                        ;
381
 
                }
382
 
                key->dot11RSNAStatsCCMPReplays++;
383
 
                return -4;
384
 
        }
385
 
#endif
386
 
        if (!tcb_desc->bHwSec)
387
 
        {
388
 
                size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN;
389
 
                u8 *mic = skb->data + skb->len - CCMP_MIC_LEN;
390
 
                u8 *b0 = key->rx_b0;
391
 
                u8 *b = key->rx_b;
392
 
                u8 *a = key->rx_a;
393
 
                int i, blocks, last, len;
394
 
                
395
 
 
396
 
                ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
397
 
                xor_block(mic, b, CCMP_MIC_LEN);
398
 
        
399
 
                blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
400
 
                last = data_len % AES_BLOCK_LEN;
401
 
        
402
 
                for (i = 1; i <= blocks; i++) {
403
 
                        len = (i == blocks && last) ? last : AES_BLOCK_LEN;
404
 
                        /* Decrypt, with counter */
405
 
                        b0[14] = (i >> 8) & 0xff;
406
 
                        b0[15] = i & 0xff;
407
 
                        rtllib_ccmp_aes_encrypt(key->tfm, b0, b);
408
 
                        xor_block(pos, b, len);
409
 
                        /* Authentication */
410
 
                        xor_block(a, pos, len);
411
 
                        rtllib_ccmp_aes_encrypt(key->tfm, a, a);
412
 
                        pos += len;
413
 
                }
414
 
        
415
 
                if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
416
 
                        if (net_ratelimit()) {
417
 
                                printk(KERN_DEBUG "CCMP: decrypt failed: STA="
418
 
                                MAC_FMT "\n", MAC_ARG(hdr->addr2));
419
 
                        }
420
 
                        key->dot11RSNAStatsCCMPDecryptErrors++;
421
 
                        return -5;
422
 
                }
423
 
        
424
 
                memcpy(key->rx_pn, pn, CCMP_PN_LEN);
425
 
        }
426
 
        /* Remove hdr and MIC */
427
 
        memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len);
428
 
        skb_pull(skb, CCMP_HDR_LEN);
429
 
        skb_trim(skb, skb->len - CCMP_MIC_LEN);
430
 
 
431
 
        return keyidx;
432
 
}
433
 
 
434
 
 
435
 
static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
436
 
{
437
 
        struct rtllib_ccmp_data *data = priv;
438
 
        int keyidx;
439
 
        struct crypto_tfm *tfm = data->tfm;
440
 
 
441
 
        keyidx = data->key_idx;
442
 
        memset(data, 0, sizeof(*data));
443
 
        data->key_idx = keyidx;
444
 
        data->tfm = tfm;
445
 
        if (len == CCMP_TK_LEN) {
446
 
                memcpy(data->key, key, CCMP_TK_LEN);
447
 
                data->key_set = 1;
448
 
                if (seq) {
449
 
                        data->rx_pn[0] = seq[5];
450
 
                        data->rx_pn[1] = seq[4];
451
 
                        data->rx_pn[2] = seq[3];
452
 
                        data->rx_pn[3] = seq[2];
453
 
                        data->rx_pn[4] = seq[1];
454
 
                        data->rx_pn[5] = seq[0];
455
 
                }
456
 
                crypto_cipher_setkey((void*)data->tfm, data->key, CCMP_TK_LEN);
457
 
        } else if (len == 0)
458
 
                data->key_set = 0;
459
 
        else
460
 
                return -1;
461
 
 
462
 
        return 0;
463
 
}
464
 
 
465
 
 
466
 
static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
467
 
{
468
 
        struct rtllib_ccmp_data *data = priv;
469
 
 
470
 
        if (len < CCMP_TK_LEN)
471
 
                return -1;
472
 
 
473
 
        if (!data->key_set)
474
 
                return 0;
475
 
        memcpy(key, data->key, CCMP_TK_LEN);
476
 
 
477
 
        if (seq) {
478
 
                seq[0] = data->tx_pn[5];
479
 
                seq[1] = data->tx_pn[4];
480
 
                seq[2] = data->tx_pn[3];
481
 
                seq[3] = data->tx_pn[2];
482
 
                seq[4] = data->tx_pn[1];
483
 
                seq[5] = data->tx_pn[0];
484
 
        }
485
 
 
486
 
        return CCMP_TK_LEN;
487
 
}
488
 
 
489
 
 
490
 
static char * rtllib_ccmp_print_stats(char *p, void *priv)
491
 
{
492
 
        struct rtllib_ccmp_data *ccmp = priv;
493
 
        p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
494
 
                     "tx_pn=%02x%02x%02x%02x%02x%02x "
495
 
                     "rx_pn=%02x%02x%02x%02x%02x%02x "
496
 
                     "format_errors=%d replays=%d decrypt_errors=%d\n",
497
 
                     ccmp->key_idx, ccmp->key_set,
498
 
                     MAC_ARG(ccmp->tx_pn), MAC_ARG(ccmp->rx_pn),
499
 
                     ccmp->dot11RSNAStatsCCMPFormatErrors,
500
 
                     ccmp->dot11RSNAStatsCCMPReplays,
501
 
                     ccmp->dot11RSNAStatsCCMPDecryptErrors);
502
 
 
503
 
        return p;
504
 
}
505
 
 
506
 
void rtllib_ccmp_null(void)
507
 
{
508
 
        return;
509
 
}
510
 
 
511
 
static struct rtllib_crypto_ops rtllib_crypt_ccmp = {
512
 
        .name                   = "CCMP",
513
 
        .init                   = rtllib_ccmp_init,
514
 
        .deinit                 = rtllib_ccmp_deinit,
515
 
        .encrypt_mpdu           = rtllib_ccmp_encrypt,
516
 
        .decrypt_mpdu           = rtllib_ccmp_decrypt,
517
 
        .encrypt_msdu           = NULL,
518
 
        .decrypt_msdu           = NULL,
519
 
        .set_key                = rtllib_ccmp_set_key,
520
 
        .get_key                = rtllib_ccmp_get_key,
521
 
        .print_stats            = rtllib_ccmp_print_stats,
522
 
        .extra_prefix_len       = CCMP_HDR_LEN,
523
 
        .extra_postfix_len      = CCMP_MIC_LEN,
524
 
        .owner                  = THIS_MODULE,
525
 
};
526
 
 
527
 
 
528
 
int __init rtllib_crypto_ccmp_init(void)
529
 
{
530
 
        return rtllib_register_crypto_ops(&rtllib_crypt_ccmp);
531
 
}
532
 
 
533
 
 
534
 
void __exit rtllib_crypto_ccmp_exit(void)
535
 
{
536
 
        rtllib_unregister_crypto_ops(&rtllib_crypt_ccmp);
537
 
}
538
 
 
539
 
#ifndef BUILT_IN_RTLLIB
540
 
EXPORT_SYMBOL_RSL(rtllib_ccmp_null);
541
 
 
542
 
module_init(rtllib_crypto_ccmp_init);
543
 
module_exit(rtllib_crypto_ccmp_exit);
544
 
#endif