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
fb3652c1
Commit
fb3652c1
authored
Oct 28, 2002
by
James Morris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CRYPTO]: Update to IV get/set interface.
parent
03882e04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
crypto/tcrypt.c
crypto/tcrypt.c
+13
-5
include/linux/crypto.h
include/linux/crypto.h
+9
-2
No files found.
crypto/tcrypt.c
View file @
fb3652c1
...
...
@@ -982,6 +982,14 @@ test_des(void)
memcpy
(
tvmem
,
des_cbc_enc_tv_template
,
tsize
);
des_tv
=
(
void
*
)
tvmem
;
crypto_cipher_set_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
crypto_cipher_get_iv
(
tfm
,
res
,
crypto_tfm_alg_ivsize
(
tfm
));
if
(
memcmp
(
res
,
des_tv
[
i
].
iv
,
sizeof
(
res
)))
{
printk
(
"crypto_cipher_[set|get]_iv() failed
\n
"
);
goto
out
;
}
for
(
i
=
0
;
i
<
DES_CBC_ENC_TEST_VECTORS
;
i
++
)
{
printk
(
"test %d:
\n
"
,
i
+
1
);
...
...
@@ -1000,8 +1008,8 @@ test_des(void)
sg
[
0
].
offset
=
((
long
)
p
&
~
PAGE_MASK
);
sg
[
0
].
length
=
len
;
crypto_cipher_
copy
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
crypto_cipher_
set
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
ret
=
crypto_cipher_encrypt
(
tfm
,
sg
,
1
);
if
(
ret
)
{
...
...
@@ -1060,7 +1068,7 @@ test_des(void)
sg
[
1
].
offset
=
((
long
)
p
&
~
PAGE_MASK
);
sg
[
1
].
length
=
11
;
crypto_cipher_
copy
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
crypto_cipher_
set
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
ret
=
crypto_cipher_encrypt
(
tfm
,
sg
,
2
);
if
(
ret
)
{
...
...
@@ -1108,7 +1116,7 @@ test_des(void)
sg
[
0
].
offset
=
((
long
)
p
&
~
PAGE_MASK
);
sg
[
0
].
length
=
len
;
crypto_cipher_
copy
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_cipher_
set
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_blocksize
(
tfm
));
ret
=
crypto_cipher_decrypt
(
tfm
,
sg
,
1
);
...
...
@@ -1161,7 +1169,7 @@ test_des(void)
sg
[
1
].
offset
=
((
long
)
p
&
~
PAGE_MASK
);
sg
[
1
].
length
=
4
;
crypto_cipher_
copy
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
crypto_cipher_
set
_iv
(
tfm
,
des_tv
[
i
].
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
ret
=
crypto_cipher_decrypt
(
tfm
,
sg
,
2
);
if
(
ret
)
{
...
...
include/linux/crypto.h
View file @
fb3652c1
...
...
@@ -275,13 +275,20 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
return
tfm
->
crt_cipher
.
cit_decrypt
(
tfm
,
sg
,
nsg
);
}
static
inline
void
crypto_cipher_
copy
_iv
(
struct
crypto_tfm
*
tfm
,
u8
*
src
,
size_t
len
)
static
inline
void
crypto_cipher_
set
_iv
(
struct
crypto_tfm
*
tfm
,
u8
*
src
,
size_t
len
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
memcpy
(
tfm
->
crt_cipher
.
cit_iv
,
src
,
len
);
}
static
inline
void
crypto_cipher_get_iv
(
struct
crypto_tfm
*
tfm
,
u8
*
dst
,
size_t
len
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
memcpy
(
dst
,
tfm
->
crt_cipher
.
cit_iv
,
len
);
}
static
inline
void
crypto_comp_compress
(
struct
crypto_tfm
*
tfm
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_COMP
);
...
...
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