Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
f1853422
Commit
f1853422
authored
Dec 05, 2002
by
James Morris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CRYPTO]: Dont compile procfs stuff if procfs is not enabled.
parent
7ac20748
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
86 deletions
+119
-86
crypto/Makefile
crypto/Makefile
+3
-1
crypto/api.c
crypto/api.c
+4
-84
crypto/internal.h
crypto/internal.h
+7
-1
crypto/proc.c
crypto/proc.c
+105
-0
No files found.
crypto/Makefile
View file @
f1853422
...
...
@@ -5,8 +5,10 @@
export-objs
:=
api.o hmac.o
autoload-crypto-$(CONFIG_KMOD)
=
autoload.o
proc-crypto-$(CONFIG_PROC_FS)
=
proc.o
obj-$(CONFIG_CRYPTO)
+=
api.o cipher.o digest.o compress.o
$
(
autoload-crypto-y
)
obj-$(CONFIG_CRYPTO)
+=
api.o cipher.o digest.o compress.o
\
$
(
autoload-crypto-y
)
$
(
proc-crypto-y
)
obj-$(CONFIG_CRYPTO_HMAC)
+=
hmac.o
obj-$(CONFIG_CRYPTO_NULL)
+=
crypto_null.o
...
...
crypto/api.c
View file @
f1853422
...
...
@@ -16,12 +16,11 @@
#include <linux/init.h>
#include <linux/crypto.h>
#include <linux/rwsem.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include "internal.h"
static
LIST_HEAD
(
crypto_alg_list
);
static
DECLARE_RWSEM
(
crypto_alg_sem
);
LIST_HEAD
(
crypto_alg_list
);
DECLARE_RWSEM
(
crypto_alg_sem
);
static
inline
int
crypto_alg_get
(
struct
crypto_alg
*
alg
)
{
...
...
@@ -240,89 +239,10 @@ int crypto_alg_available(const char *name, u32 flags)
return
ret
;
}
static
void
*
c_start
(
struct
seq_file
*
m
,
loff_t
*
pos
)
{
struct
list_head
*
v
;
loff_t
n
=
*
pos
;
down_read
(
&
crypto_alg_sem
);
list_for_each
(
v
,
&
crypto_alg_list
)
if
(
!
n
--
)
return
list_entry
(
v
,
struct
crypto_alg
,
cra_list
);
return
NULL
;
}
static
void
*
c_next
(
struct
seq_file
*
m
,
void
*
p
,
loff_t
*
pos
)
{
struct
list_head
*
v
=
p
;
(
*
pos
)
++
;
v
=
v
->
next
;
return
(
v
==
&
crypto_alg_list
)
?
NULL
:
list_entry
(
v
,
struct
crypto_alg
,
cra_list
);
}
static
void
c_stop
(
struct
seq_file
*
m
,
void
*
p
)
{
up_read
(
&
crypto_alg_sem
);
}
static
int
c_show
(
struct
seq_file
*
m
,
void
*
p
)
{
struct
crypto_alg
*
alg
=
(
struct
crypto_alg
*
)
p
;
seq_printf
(
m
,
"name : %s
\n
"
,
alg
->
cra_name
);
seq_printf
(
m
,
"module : %s
\n
"
,
module_name
(
alg
->
cra_module
));
seq_printf
(
m
,
"blocksize : %u
\n
"
,
alg
->
cra_blocksize
);
switch
(
alg
->
cra_flags
&
CRYPTO_ALG_TYPE_MASK
)
{
case
CRYPTO_ALG_TYPE_CIPHER
:
seq_printf
(
m
,
"min keysize : %u
\n
"
,
alg
->
cra_cipher
.
cia_min_keysize
);
seq_printf
(
m
,
"max keysize : %u
\n
"
,
alg
->
cra_cipher
.
cia_max_keysize
);
seq_printf
(
m
,
"ivsize : %u
\n
"
,
alg
->
cra_cipher
.
cia_ivsize
);
break
;
case
CRYPTO_ALG_TYPE_DIGEST
:
seq_printf
(
m
,
"digestsize : %u
\n
"
,
alg
->
cra_digest
.
dia_digestsize
);
break
;
}
seq_putc
(
m
,
'\n'
);
return
0
;
}
static
struct
seq_operations
crypto_seq_ops
=
{
.
start
=
c_start
,
.
next
=
c_next
,
.
stop
=
c_stop
,
.
show
=
c_show
};
static
int
crypto_info_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
crypto_seq_ops
);
}
struct
file_operations
proc_crypto_ops
=
{
.
open
=
crypto_info_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
};
static
int
__init
init_crypto
(
void
)
{
struct
proc_dir_entry
*
proc
;
printk
(
KERN_INFO
"Initializing Cryptographic API
\n
"
);
proc
=
create_proc_entry
(
"crypto"
,
0
,
NULL
);
if
(
proc
)
proc
->
proc_fops
=
&
proc_crypto_ops
;
crypto_init_proc
();
return
0
;
}
...
...
crypto/internal.h
View file @
f1853422
...
...
@@ -11,7 +11,6 @@
*/
#ifndef _CRYPTO_INTERNAL_H
#define _CRYPTO_INTERNAL_H
#include <linux/mm.h>
#include <linux/highmem.h>
#include <asm/hardirq.h>
...
...
@@ -65,6 +64,13 @@ static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
{
}
#endif
#ifdef CONFIG_PROC_FS
void
__init
crypto_init_proc
(
void
);
#else
static
inline
void
crypto_init_proc
(
void
)
{
}
#endif
int
crypto_init_digest_flags
(
struct
crypto_tfm
*
tfm
,
u32
flags
);
int
crypto_init_cipher_flags
(
struct
crypto_tfm
*
tfm
,
u32
flags
);
int
crypto_init_compress_flags
(
struct
crypto_tfm
*
tfm
,
u32
flags
);
...
...
crypto/proc.c
0 → 100644
View file @
f1853422
/*
* Scatterlist Cryptographic API.
*
* Procfs information.
*
* Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/
#include <linux/init.h>
#include <linux/crypto.h>
#include <linux/rwsem.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "internal.h"
extern
struct
list_head
crypto_alg_list
;
extern
struct
rw_semaphore
crypto_alg_sem
;
static
void
*
c_start
(
struct
seq_file
*
m
,
loff_t
*
pos
)
{
struct
list_head
*
v
;
loff_t
n
=
*
pos
;
down_read
(
&
crypto_alg_sem
);
list_for_each
(
v
,
&
crypto_alg_list
)
if
(
!
n
--
)
return
list_entry
(
v
,
struct
crypto_alg
,
cra_list
);
return
NULL
;
}
static
void
*
c_next
(
struct
seq_file
*
m
,
void
*
p
,
loff_t
*
pos
)
{
struct
list_head
*
v
=
p
;
(
*
pos
)
++
;
v
=
v
->
next
;
return
(
v
==
&
crypto_alg_list
)
?
NULL
:
list_entry
(
v
,
struct
crypto_alg
,
cra_list
);
}
static
void
c_stop
(
struct
seq_file
*
m
,
void
*
p
)
{
up_read
(
&
crypto_alg_sem
);
}
static
int
c_show
(
struct
seq_file
*
m
,
void
*
p
)
{
struct
crypto_alg
*
alg
=
(
struct
crypto_alg
*
)
p
;
seq_printf
(
m
,
"name : %s
\n
"
,
alg
->
cra_name
);
seq_printf
(
m
,
"module : %s
\n
"
,
module_name
(
alg
->
cra_module
));
seq_printf
(
m
,
"blocksize : %u
\n
"
,
alg
->
cra_blocksize
);
switch
(
alg
->
cra_flags
&
CRYPTO_ALG_TYPE_MASK
)
{
case
CRYPTO_ALG_TYPE_CIPHER
:
seq_printf
(
m
,
"min keysize : %u
\n
"
,
alg
->
cra_cipher
.
cia_min_keysize
);
seq_printf
(
m
,
"max keysize : %u
\n
"
,
alg
->
cra_cipher
.
cia_max_keysize
);
seq_printf
(
m
,
"ivsize : %u
\n
"
,
alg
->
cra_cipher
.
cia_ivsize
);
break
;
case
CRYPTO_ALG_TYPE_DIGEST
:
seq_printf
(
m
,
"digestsize : %u
\n
"
,
alg
->
cra_digest
.
dia_digestsize
);
break
;
}
seq_putc
(
m
,
'\n'
);
return
0
;
}
static
struct
seq_operations
crypto_seq_ops
=
{
.
start
=
c_start
,
.
next
=
c_next
,
.
stop
=
c_stop
,
.
show
=
c_show
};
static
int
crypto_info_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
crypto_seq_ops
);
}
static
struct
file_operations
proc_crypto_ops
=
{
.
open
=
crypto_info_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
};
void
__init
crypto_init_proc
(
void
)
{
struct
proc_dir_entry
*
proc
;
proc
=
create_proc_entry
(
"crypto"
,
0
,
NULL
);
if
(
proc
)
proc
->
proc_fops
=
&
proc_crypto_ops
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment