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
4cbbc184
Commit
4cbbc184
authored
Nov 01, 2002
by
James Morris
Committed by
David S. Miller
Nov 01, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CRYPTO]: Add crypto_alg_available interface.
parent
95d6c210
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
7 deletions
+57
-7
crypto/api.c
crypto/api.c
+15
-7
crypto/autoload.c
crypto/autoload.c
+10
-0
crypto/internal.h
crypto/internal.h
+8
-0
crypto/tcrypt.c
crypto/tcrypt.c
+19
-0
include/linux/crypto.h
include/linux/crypto.h
+5
-0
No files found.
crypto/api.c
View file @
4cbbc184
...
...
@@ -100,13 +100,7 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
struct
crypto_tfm
*
tfm
=
NULL
;
struct
crypto_alg
*
alg
;
alg
=
crypto_alg_lookup
(
name
);
#ifdef CONFIG_KMOD
if
(
alg
==
NULL
)
{
crypto_alg_autoload
(
name
);
alg
=
crypto_alg_lookup
(
name
);
}
#endif
alg
=
crypto_alg_mod_lookup
(
name
);
if
(
alg
==
NULL
)
goto
out
;
...
...
@@ -208,6 +202,19 @@ int crypto_unregister_alg(struct crypto_alg *alg)
return
ret
;
}
int
crypto_alg_available
(
const
char
*
name
,
u32
flags
)
{
int
ret
=
0
;
struct
crypto_alg
*
alg
=
crypto_alg_mod_lookup
(
name
);
if
(
alg
)
{
crypto_alg_put
(
alg
);
ret
=
1
;
}
return
ret
;
}
static
void
*
c_start
(
struct
seq_file
*
m
,
loff_t
*
pos
)
{
struct
list_head
*
v
;
...
...
@@ -297,3 +304,4 @@ EXPORT_SYMBOL_GPL(crypto_register_alg);
EXPORT_SYMBOL_GPL
(
crypto_unregister_alg
);
EXPORT_SYMBOL_GPL
(
crypto_alloc_tfm
);
EXPORT_SYMBOL_GPL
(
crypto_free_tfm
);
EXPORT_SYMBOL_GPL
(
crypto_alg_available
);
crypto/autoload.c
View file @
4cbbc184
...
...
@@ -25,3 +25,13 @@ void crypto_alg_autoload(const char *name)
{
request_module
(
name
);
}
struct
crypto_alg
*
crypto_alg_mod_lookup
(
const
char
*
name
)
{
struct
crypto_alg
*
alg
=
crypto_alg_lookup
(
name
);
if
(
alg
==
NULL
)
{
crypto_alg_autoload
(
name
);
alg
=
crypto_alg_lookup
(
name
);
}
return
alg
;
}
crypto/internal.h
View file @
4cbbc184
...
...
@@ -40,8 +40,16 @@ static inline u32 crypto_cipher_flags(u32 flags)
return
flags
&
(
CRYPTO_TFM_MODE_MASK
|
CRYPTO_TFM_REQ_WEAK_KEY
);
}
struct
crypto_alg
*
crypto_alg_lookup
(
const
char
*
name
);
#ifdef CONFIG_KMOD
void
crypto_alg_autoload
(
const
char
*
name
);
struct
crypto_alg
*
crypto_alg_mod_lookup
(
const
char
*
name
);
#else
static
inline
struct
crypto_alg
*
crypto_alg_mod_lookup
(
const
char
*
name
)
{
return
crypto_alg_lookup
(
name
);
}
#endif
int
crypto_init_digest_flags
(
struct
crypto_tfm
*
tfm
,
u32
flags
);
...
...
crypto/tcrypt.c
View file @
4cbbc184
...
...
@@ -46,6 +46,8 @@ static int mode = 0;
static
char
*
xbuf
;
static
char
*
tvmem
;
static
char
*
check
[]
=
{
"des"
,
"md5"
,
"des3_ede"
,
"rot13"
,
"sha1"
,
NULL
};
static
void
hexdump
(
unsigned
char
*
buf
,
unsigned
int
len
)
{
...
...
@@ -1299,6 +1301,19 @@ test_des3_ede(void)
crypto_free_tfm
(
tfm
);
}
static
void
test_available
(
void
)
{
char
**
name
=
check
;
while
(
*
name
)
{
printk
(
"alg %s "
,
*
name
);
printk
((
crypto_alg_available
(
*
name
,
0
))
?
"found
\n
"
:
"not found
\n
"
);
name
++
;
}
}
static
void
do_test
(
void
)
{
...
...
@@ -1332,6 +1347,10 @@ do_test(void)
test_md4
();
break
;
case
100
:
test_available
();
break
;
default:
/* useful for debugging */
printk
(
"not testing anything
\n
"
);
...
...
include/linux/crypto.h
View file @
4cbbc184
...
...
@@ -111,6 +111,11 @@ struct crypto_alg {
int
crypto_register_alg
(
struct
crypto_alg
*
alg
);
int
crypto_unregister_alg
(
struct
crypto_alg
*
alg
);
/*
* Algorithm query interface.
*/
int
crypto_alg_available
(
const
char
*
name
,
u32
flags
);
/*
* Transforms: user-instantiated objects which encapsulate algorithms
* and core processing logic. Managed via crypto_alloc_tfm() and
...
...
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