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
Kirill Smelkov
linux
Commits
16ffa71a
Commit
16ffa71a
authored
Mar 07, 2003
by
James Morris
Committed by
David S. Miller
Mar 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CRYPTO]: Eliminate crypto_tfm.crt_ctx, from Adam Richter.
parent
c7870e13
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
11 deletions
+13
-11
crypto/api.c
crypto/api.c
+0
-2
crypto/cipher.c
crypto/cipher.c
+4
-4
crypto/digest.c
crypto/digest.c
+4
-4
crypto/internal.h
crypto/internal.h
+5
-0
include/linux/crypto.h
include/linux/crypto.h
+0
-1
No files found.
crypto/api.c
View file @
16ffa71a
...
...
@@ -128,8 +128,6 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
memset
(
tfm
,
0
,
sizeof
(
*
tfm
));
tfm
->
crt_ctx
=
(
void
*
)
&
tfm
[
1
];
tfm
->
__crt_alg
=
alg
;
if
(
crypto_init_flags
(
tfm
,
flags
))
...
...
crypto/cipher.c
View file @
16ffa71a
...
...
@@ -223,14 +223,14 @@ static void cbc_process(struct crypto_tfm *tfm,
if
(
enc
)
{
tfm
->
crt_u
.
cipher
.
cit_xor_block
(
iv
,
src
);
fn
(
tfm
->
crt_ctx
,
dst
,
iv
);
fn
(
crypto_tfm_ctx
(
tfm
)
,
dst
,
iv
);
memcpy
(
iv
,
dst
,
crypto_tfm_alg_blocksize
(
tfm
));
}
else
{
const
int
need_stack
=
(
src
==
dst
);
u8
stack
[
need_stack
?
crypto_tfm_alg_blocksize
(
tfm
)
:
0
];
u8
*
buf
=
need_stack
?
stack
:
dst
;
fn
(
tfm
->
crt_ctx
,
buf
,
src
);
fn
(
crypto_tfm_ctx
(
tfm
)
,
buf
,
src
);
tfm
->
crt_u
.
cipher
.
cit_xor_block
(
buf
,
iv
);
memcpy
(
iv
,
src
,
crypto_tfm_alg_blocksize
(
tfm
));
if
(
buf
!=
dst
)
...
...
@@ -241,7 +241,7 @@ static void cbc_process(struct crypto_tfm *tfm,
static
void
ecb_process
(
struct
crypto_tfm
*
tfm
,
u8
*
dst
,
u8
*
src
,
cryptfn_t
fn
,
int
enc
,
void
*
info
)
{
fn
(
tfm
->
crt_ctx
,
dst
,
src
);
fn
(
crypto_tfm_ctx
(
tfm
)
,
dst
,
src
);
}
static
int
setkey
(
struct
crypto_tfm
*
tfm
,
const
u8
*
key
,
unsigned
int
keylen
)
...
...
@@ -252,7 +252,7 @@ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
tfm
->
crt_flags
|=
CRYPTO_TFM_RES_BAD_KEY_LEN
;
return
-
EINVAL
;
}
else
return
cia
->
cia_setkey
(
tfm
->
crt_ctx
,
key
,
keylen
,
return
cia
->
cia_setkey
(
crypto_tfm_ctx
(
tfm
)
,
key
,
keylen
,
&
tfm
->
crt_flags
);
}
...
...
crypto/digest.c
View file @
16ffa71a
...
...
@@ -19,7 +19,7 @@
static
void
init
(
struct
crypto_tfm
*
tfm
)
{
tfm
->
__crt_alg
->
cra_digest
.
dia_init
(
tfm
->
crt_ctx
);
tfm
->
__crt_alg
->
cra_digest
.
dia_init
(
crypto_tfm_ctx
(
tfm
)
);
}
static
void
update
(
struct
crypto_tfm
*
tfm
,
...
...
@@ -29,7 +29,7 @@ static void update(struct crypto_tfm *tfm,
for
(
i
=
0
;
i
<
nsg
;
i
++
)
{
char
*
p
=
crypto_kmap
(
sg
[
i
].
page
,
0
)
+
sg
[
i
].
offset
;
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
tfm
->
crt_ctx
,
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
crypto_tfm_ctx
(
tfm
)
,
p
,
sg
[
i
].
length
);
crypto_kunmap
(
p
,
0
);
crypto_yield
(
tfm
);
...
...
@@ -38,7 +38,7 @@ static void update(struct crypto_tfm *tfm,
static
void
final
(
struct
crypto_tfm
*
tfm
,
u8
*
out
)
{
tfm
->
__crt_alg
->
cra_digest
.
dia_final
(
tfm
->
crt_ctx
,
out
);
tfm
->
__crt_alg
->
cra_digest
.
dia_final
(
crypto_tfm_ctx
(
tfm
)
,
out
);
}
static
void
digest
(
struct
crypto_tfm
*
tfm
,
...
...
@@ -50,7 +50,7 @@ static void digest(struct crypto_tfm *tfm,
for
(
i
=
0
;
i
<
nsg
;
i
++
)
{
char
*
p
=
crypto_kmap
(
sg
[
i
].
page
,
0
)
+
sg
[
i
].
offset
;
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
tfm
->
crt_ctx
,
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
crypto_tfm_ctx
(
tfm
)
,
p
,
sg
[
i
].
length
);
crypto_kunmap
(
p
,
0
);
crypto_yield
(
tfm
);
...
...
crypto/internal.h
View file @
16ffa71a
...
...
@@ -46,6 +46,11 @@ static inline u32 crypto_cipher_flags(u32 flags)
return
flags
&
(
CRYPTO_TFM_MODE_MASK
|
CRYPTO_TFM_REQ_WEAK_KEY
);
}
static
inline
void
*
crypto_tfm_ctx
(
struct
crypto_tfm
*
tfm
)
{
return
(
void
*
)
&
tfm
[
1
];
}
struct
crypto_alg
*
crypto_alg_lookup
(
const
char
*
name
);
#ifdef CONFIG_KMOD
...
...
include/linux/crypto.h
View file @
16ffa71a
...
...
@@ -172,7 +172,6 @@ struct compress_tfm {
struct
crypto_tfm
{
void
*
crt_ctx
;
u32
crt_flags
;
union
{
...
...
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