Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
e3305626
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e3305626
编写于
11月 09, 2005
作者:
C
Christoph Hellwig
提交者:
Jeff Garzik
11月 09, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ieee80211: cleanup crypto list handling, other minor cleanups.
上级
c2a8fad4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
111 deletion
+42
-111
include/net/ieee80211_crypt.h
include/net/ieee80211_crypt.h
+1
-0
net/ieee80211/ieee80211_crypt.c
net/ieee80211/ieee80211_crypt.c
+41
-111
未找到文件。
include/net/ieee80211_crypt.h
浏览文件 @
e3305626
...
...
@@ -31,6 +31,7 @@ enum {
struct
ieee80211_crypto_ops
{
const
char
*
name
;
struct
list_head
list
;
/* init new crypto context (e.g., allocate private data space,
* select IV, etc.); returns NULL on failure or pointer to allocated
...
...
net/ieee80211/ieee80211_crypt.c
浏览文件 @
e3305626
...
...
@@ -11,15 +11,14 @@
*
*/
#include <linux/
config
.h>
#include <linux/
errno
.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <asm/string.h>
#include <asm/errno.h>
#include <linux/string.h>
#include <net/ieee80211.h>
MODULE_AUTHOR
(
"Jouni Malinen"
);
MODULE_DESCRIPTION
(
"HostAP crypto"
);
MODULE_LICENSE
(
"GPL"
);
...
...
@@ -29,32 +28,20 @@ struct ieee80211_crypto_alg {
struct
ieee80211_crypto_ops
*
ops
;
};
struct
ieee80211_crypto
{
struct
list_head
algs
;
spinlock_t
lock
;
};
static
struct
ieee80211_crypto
*
hcrypt
;
static
LIST_HEAD
(
ieee80211_crypto_algs
);
static
DEFINE_SPINLOCK
(
ieee80211_crypto_lock
);
void
ieee80211_crypt_deinit_entries
(
struct
ieee80211_device
*
ieee
,
int
force
)
{
struct
list_head
*
ptr
,
*
n
;
struct
ieee80211_crypt_data
*
entry
;
struct
ieee80211_crypt_data
*
entry
,
*
next
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
ieee
->
lock
,
flags
);
if
(
list_empty
(
&
ieee
->
crypt_deinit_list
))
goto
unlock
;
for
(
ptr
=
ieee
->
crypt_deinit_list
.
next
,
n
=
ptr
->
next
;
ptr
!=
&
ieee
->
crypt_deinit_list
;
ptr
=
n
,
n
=
ptr
->
next
)
{
entry
=
list_entry
(
ptr
,
struct
ieee80211_crypt_data
,
list
);
list_for_each_entry_safe
(
entry
,
next
,
&
ieee
->
crypt_deinit_list
,
list
)
{
if
(
atomic_read
(
&
entry
->
refcnt
)
!=
0
&&
!
force
)
continue
;
list_del
(
ptr
);
list_del
(
&
entry
->
list
);
if
(
entry
->
ops
)
{
entry
->
ops
->
deinit
(
entry
->
priv
);
...
...
@@ -62,7 +49,6 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force)
}
kfree
(
entry
);
}
unlock:
spin_unlock_irqrestore
(
&
ieee
->
lock
,
flags
);
}
...
...
@@ -125,9 +111,6 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
unsigned
long
flags
;
struct
ieee80211_crypto_alg
*
alg
;
if
(
hcrypt
==
NULL
)
return
-
1
;
alg
=
kmalloc
(
sizeof
(
*
alg
),
GFP_KERNEL
);
if
(
alg
==
NULL
)
return
-
ENOMEM
;
...
...
@@ -135,9 +118,9 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
memset
(
alg
,
0
,
sizeof
(
*
alg
));
alg
->
ops
=
ops
;
spin_lock_irqsave
(
&
hcrypt
->
lock
,
flags
);
list_add
(
&
alg
->
list
,
&
hcrypt
->
algs
);
spin_unlock_irqrestore
(
&
hcrypt
->
lock
,
flags
);
spin_lock_irqsave
(
&
ieee80211_crypto_
lock
,
flags
);
list_add
(
&
alg
->
list
,
&
ieee80211_crypto_
algs
);
spin_unlock_irqrestore
(
&
ieee80211_crypto_
lock
,
flags
);
printk
(
KERN_DEBUG
"ieee80211_crypt: registered algorithm '%s'
\n
"
,
ops
->
name
);
...
...
@@ -147,64 +130,49 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
int
ieee80211_unregister_crypto_ops
(
struct
ieee80211_crypto_ops
*
ops
)
{
struct
ieee80211_crypto_alg
*
alg
;
unsigned
long
flags
;
struct
list_head
*
ptr
;
struct
ieee80211_crypto_alg
*
del_alg
=
NULL
;
if
(
hcrypt
==
NULL
)
return
-
1
;
spin_lock_irqsave
(
&
hcrypt
->
lock
,
flags
);
for
(
ptr
=
hcrypt
->
algs
.
next
;
ptr
!=
&
hcrypt
->
algs
;
ptr
=
ptr
->
next
)
{
struct
ieee80211_crypto_alg
*
alg
=
(
struct
ieee80211_crypto_alg
*
)
ptr
;
if
(
alg
->
ops
==
ops
)
{
list_del
(
&
alg
->
list
);
del_alg
=
alg
;
break
;
}
}
spin_unlock_irqrestore
(
&
hcrypt
->
lock
,
flags
);
if
(
del_alg
)
{
printk
(
KERN_DEBUG
"ieee80211_crypt: unregistered algorithm "
"'%s'
\n
"
,
ops
->
name
);
kfree
(
del_alg
)
;
spin_lock_irqsave
(
&
ieee80211_crypto_lock
,
flags
);
list_for_each_entry
(
alg
,
&
ieee80211_crypto_algs
,
list
)
{
if
(
alg
->
ops
==
ops
)
goto
found
;
}
return
del_alg
?
0
:
-
1
;
spin_unlock_irqrestore
(
&
ieee80211_crypto_lock
,
flags
);
return
-
EINVAL
;
found:
printk
(
KERN_DEBUG
"ieee80211_crypt: unregistered algorithm "
"'%s'
\n
"
,
ops
->
name
);
list_del
(
&
alg
->
list
);
spin_unlock_irqrestore
(
&
ieee80211_crypto_lock
,
flags
);
kfree
(
alg
);
return
0
;
}
struct
ieee80211_crypto_ops
*
ieee80211_get_crypto_ops
(
const
char
*
name
)
{
struct
ieee80211_crypto_alg
*
alg
;
unsigned
long
flags
;
struct
list_head
*
ptr
;
struct
ieee80211_crypto_alg
*
found_alg
=
NULL
;
if
(
hcrypt
==
NULL
)
return
NULL
;
spin_lock_irqsave
(
&
hcrypt
->
lock
,
flags
);
for
(
ptr
=
hcrypt
->
algs
.
next
;
ptr
!=
&
hcrypt
->
algs
;
ptr
=
ptr
->
next
)
{
struct
ieee80211_crypto_alg
*
alg
=
(
struct
ieee80211_crypto_alg
*
)
ptr
;
if
(
strcmp
(
alg
->
ops
->
name
,
name
)
==
0
)
{
found_alg
=
alg
;
break
;
}
spin_lock_irqsave
(
&
ieee80211_crypto_lock
,
flags
);
list_for_each_entry
(
alg
,
&
ieee80211_crypto_algs
,
list
)
{
if
(
strcmp
(
alg
->
ops
->
name
,
name
)
==
0
)
goto
found
;
}
spin_unlock_irqrestore
(
&
hcrypt
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
ieee80211_crypto_lock
,
flags
);
return
NULL
;
if
(
found_alg
)
return
found_alg
->
ops
;
else
return
NULL
;
found:
spin_unlock_irqrestore
(
&
ieee80211_crypto_lock
,
flags
);
return
alg
->
ops
;
}
static
void
*
ieee80211_crypt_null_init
(
int
keyidx
)
{
return
(
void
*
)
1
;
}
static
void
ieee80211_crypt_null_deinit
(
void
*
priv
)
{
}
...
...
@@ -213,56 +181,18 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.
name
=
"NULL"
,
.
init
=
ieee80211_crypt_null_init
,
.
deinit
=
ieee80211_crypt_null_deinit
,
.
encrypt_mpdu
=
NULL
,
.
decrypt_mpdu
=
NULL
,
.
encrypt_msdu
=
NULL
,
.
decrypt_msdu
=
NULL
,
.
set_key
=
NULL
,
.
get_key
=
NULL
,
.
extra_mpdu_prefix_len
=
0
,
.
extra_mpdu_postfix_len
=
0
,
.
owner
=
THIS_MODULE
,
};
static
int
__init
ieee80211_crypto_init
(
void
)
{
int
ret
=
-
ENOMEM
;
hcrypt
=
kmalloc
(
sizeof
(
*
hcrypt
),
GFP_KERNEL
);
if
(
!
hcrypt
)
goto
out
;
memset
(
hcrypt
,
0
,
sizeof
(
*
hcrypt
));
INIT_LIST_HEAD
(
&
hcrypt
->
algs
);
spin_lock_init
(
&
hcrypt
->
lock
);
ret
=
ieee80211_register_crypto_ops
(
&
ieee80211_crypt_null
);
if
(
ret
<
0
)
{
kfree
(
hcrypt
);
hcrypt
=
NULL
;
}
out:
return
ret
;
return
ieee80211_register_crypto_ops
(
&
ieee80211_crypt_null
);
}
static
void
__exit
ieee80211_crypto_deinit
(
void
)
{
struct
list_head
*
ptr
,
*
n
;
if
(
hcrypt
==
NULL
)
return
;
for
(
ptr
=
hcrypt
->
algs
.
next
,
n
=
ptr
->
next
;
ptr
!=
&
hcrypt
->
algs
;
ptr
=
n
,
n
=
ptr
->
next
)
{
struct
ieee80211_crypto_alg
*
alg
=
(
struct
ieee80211_crypto_alg
*
)
ptr
;
list_del
(
ptr
);
printk
(
KERN_DEBUG
"ieee80211_crypt: unregistered algorithm "
"'%s' (deinit)
\n
"
,
alg
->
ops
->
name
);
kfree
(
alg
);
}
kfree
(
hcrypt
);
ieee80211_unregister_crypto_ops
(
&
ieee80211_crypt_null
);
BUG_ON
(
!
list_empty
(
&
ieee80211_crypto_algs
));
}
EXPORT_SYMBOL
(
ieee80211_crypt_deinit_entries
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录