Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
rtl8192u
ieee80211
proc.c
Go to the documentation of this file.
1
/*
2
* Scatterlist Cryptographic API.
3
*
4
* Procfs information.
5
*
6
* Copyright (c) 2002 James Morris <
[email protected]
>
7
*
8
* This program is free software; you can redistribute it and/or modify it
9
* under the terms of the GNU General Public License as published by the Free
10
* Software Foundation; either version 2 of the License, or (at your option)
11
* any later version.
12
*
13
*/
14
#include <
linux/init.h
>
15
//#include <linux/crypto.h>
16
#include "
rtl_crypto.h
"
17
#include <
linux/rwsem.h
>
18
#include <
linux/proc_fs.h
>
19
#include <
linux/seq_file.h
>
20
#include "
internal.h
"
21
22
extern
struct
list_head
crypto_alg_list
;
23
extern
struct
rw_semaphore
crypto_alg_sem
;
24
25
static
void
*
c_start
(
struct
seq_file
*
m
, loff_t *
pos
)
26
{
27
struct
list_head
*
v
;
28
loff_t
n
= *
pos
;
29
30
down_read
(&crypto_alg_sem);
31
list_for_each
(v, &crypto_alg_list)
32
if
(!n--)
33
return
list_entry
(v,
struct
crypto_alg
, cra_list);
34
return
NULL
;
35
}
36
37
static
void
*c_next(
struct
seq_file
*m,
void
*
p
, loff_t *pos)
38
{
39
struct
list_head
*v =
p
;
40
41
(*pos)++;
42
v = v->
next
;
43
return
(v == &crypto_alg_list) ?
44
NULL :
list_entry
(v,
struct
crypto_alg, cra_list);
45
}
46
47
static
void
c_stop(
struct
seq_file
*m,
void
*p)
48
{
49
up_read
(&crypto_alg_sem);
50
}
51
52
static
int
c_show(
struct
seq_file
*m,
void
*p)
53
{
54
struct
crypto_alg *alg = (
struct
crypto_alg *)p;
55
56
seq_printf
(m,
"name : %s\n"
, alg->
cra_name
);
57
seq_printf
(m,
"module : %s\n"
,
58
(alg->
cra_module
?
59
alg->
cra_module
->name :
60
"kernel"
));
61
62
switch
(alg->
cra_flags
&
CRYPTO_ALG_TYPE_MASK
) {
63
case
CRYPTO_ALG_TYPE_CIPHER
:
64
seq_printf
(m,
"type : cipher\n"
);
65
seq_printf
(m,
"blocksize : %u\n"
, alg->
cra_blocksize
);
66
seq_printf
(m,
"min keysize : %u\n"
,
67
alg->cra_cipher.cia_min_keysize);
68
seq_printf
(m,
"max keysize : %u\n"
,
69
alg->cra_cipher.cia_max_keysize);
70
break
;
71
72
case
CRYPTO_ALG_TYPE_DIGEST
:
73
seq_printf
(m,
"type : digest\n"
);
74
seq_printf
(m,
"blocksize : %u\n"
, alg->
cra_blocksize
);
75
seq_printf
(m,
"digestsize : %u\n"
,
76
alg->cra_digest.dia_digestsize);
77
break
;
78
case
CRYPTO_ALG_TYPE_COMPRESS
:
79
seq_printf
(m,
"type : compression\n"
);
80
break
;
81
default
:
82
seq_printf
(m,
"type : unknown\n"
);
83
break
;
84
}
85
86
seq_putc
(m,
'\n'
);
87
return
0;
88
}
89
90
static
struct
seq_operations
crypto_seq_ops = {
91
.start =
c_start
,
92
.next = c_next,
93
.stop = c_stop,
94
.show = c_show
95
};
96
97
static
int
crypto_info_open(
struct
inode
*
inode
,
struct
file
*
file
)
98
{
99
return
seq_open
(file, &crypto_seq_ops);
100
}
101
102
static
struct
file_operations
proc_crypto_ops = {
103
.open = crypto_info_open,
104
.read =
seq_read
,
105
.llseek =
seq_lseek
,
106
.release =
seq_release
107
};
108
109
void
__init
crypto_init_proc
(
void
)
110
{
111
struct
proc_dir_entry
*proc;
112
113
proc =
create_proc_entry
(
"crypto"
, 0, NULL);
114
if
(proc)
115
proc->
proc_fops
= &proc_crypto_ops;
116
}
Generated on Thu Jan 10 2013 13:11:17 for Linux Kernel by
1.8.2