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
f7ab034d
Commit
f7ab034d
authored
Aug 17, 2003
by
Mikael Ylikoski
Committed by
David S. Miller
Aug 17, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPSEC]: Fix oops using null ciper in CBC mode.
parent
68bc1ac9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
13 additions
and
17 deletions
+13
-17
crypto/aes.c
crypto/aes.c
+0
-1
crypto/blowfish.c
crypto/blowfish.c
+0
-1
crypto/cipher.c
crypto/cipher.c
+3
-4
crypto/crypto_null.c
crypto/crypto_null.c
+0
-1
crypto/des.c
crypto/des.c
+0
-2
crypto/proc.c
crypto/proc.c
+0
-2
crypto/serpent.c
crypto/serpent.c
+0
-1
crypto/twofish.c
crypto/twofish.c
+0
-1
include/linux/crypto.h
include/linux/crypto.h
+2
-2
net/ipv4/esp4.c
net/ipv4/esp4.c
+4
-1
net/ipv6/esp6.c
net/ipv6/esp6.c
+4
-1
No files found.
crypto/aes.c
View file @
f7ab034d
...
@@ -442,7 +442,6 @@ static struct crypto_alg aes_alg = {
...
@@ -442,7 +442,6 @@ static struct crypto_alg aes_alg = {
.
cipher
=
{
.
cipher
=
{
.
cia_min_keysize
=
AES_MIN_KEY_SIZE
,
.
cia_min_keysize
=
AES_MIN_KEY_SIZE
,
.
cia_max_keysize
=
AES_MAX_KEY_SIZE
,
.
cia_max_keysize
=
AES_MAX_KEY_SIZE
,
.
cia_ivsize
=
AES_BLOCK_SIZE
,
.
cia_setkey
=
aes_set_key
,
.
cia_setkey
=
aes_set_key
,
.
cia_encrypt
=
aes_encrypt
,
.
cia_encrypt
=
aes_encrypt
,
.
cia_decrypt
=
aes_decrypt
.
cia_decrypt
=
aes_decrypt
...
...
crypto/blowfish.c
View file @
f7ab034d
...
@@ -456,7 +456,6 @@ static struct crypto_alg alg = {
...
@@ -456,7 +456,6 @@ static struct crypto_alg alg = {
.
cra_u
=
{
.
cipher
=
{
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
BF_MIN_KEY_SIZE
,
.
cia_min_keysize
=
BF_MIN_KEY_SIZE
,
.
cia_max_keysize
=
BF_MAX_KEY_SIZE
,
.
cia_max_keysize
=
BF_MAX_KEY_SIZE
,
.
cia_ivsize
=
BF_BLOCK_SIZE
,
.
cia_setkey
=
bf_setkey
,
.
cia_setkey
=
bf_setkey
,
.
cia_encrypt
=
bf_encrypt
,
.
cia_encrypt
=
bf_encrypt
,
.
cia_decrypt
=
bf_decrypt
}
}
.
cia_decrypt
=
bf_decrypt
}
}
...
...
crypto/cipher.c
View file @
f7ab034d
...
@@ -345,7 +345,6 @@ int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags)
...
@@ -345,7 +345,6 @@ int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags)
int
crypto_init_cipher_ops
(
struct
crypto_tfm
*
tfm
)
int
crypto_init_cipher_ops
(
struct
crypto_tfm
*
tfm
)
{
{
int
ret
=
0
;
int
ret
=
0
;
struct
crypto_alg
*
alg
=
tfm
->
__crt_alg
;
struct
cipher_tfm
*
ops
=
&
tfm
->
crt_cipher
;
struct
cipher_tfm
*
ops
=
&
tfm
->
crt_cipher
;
ops
->
cit_setkey
=
setkey
;
ops
->
cit_setkey
=
setkey
;
...
@@ -381,8 +380,7 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
...
@@ -381,8 +380,7 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
BUG
();
BUG
();
}
}
if
(
alg
->
cra_cipher
.
cia_ivsize
&&
if
(
ops
->
cit_mode
==
CRYPTO_TFM_MODE_CBC
)
{
ops
->
cit_mode
!=
CRYPTO_TFM_MODE_ECB
)
{
switch
(
crypto_tfm_alg_blocksize
(
tfm
))
{
switch
(
crypto_tfm_alg_blocksize
(
tfm
))
{
case
8
:
case
8
:
...
@@ -401,7 +399,8 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
...
@@ -401,7 +399,8 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
goto
out
;
goto
out
;
}
}
ops
->
cit_iv
=
kmalloc
(
alg
->
cra_cipher
.
cia_ivsize
,
GFP_KERNEL
);
ops
->
cit_ivsize
=
crypto_tfm_alg_blocksize
(
tfm
);
ops
->
cit_iv
=
kmalloc
(
ops
->
cit_ivsize
,
GFP_KERNEL
);
if
(
ops
->
cit_iv
==
NULL
)
if
(
ops
->
cit_iv
==
NULL
)
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
}
}
...
...
crypto/crypto_null.c
View file @
f7ab034d
...
@@ -89,7 +89,6 @@ static struct crypto_alg cipher_null = {
...
@@ -89,7 +89,6 @@ static struct crypto_alg cipher_null = {
.
cra_u
=
{
.
cipher
=
{
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
NULL_KEY_SIZE
,
.
cia_min_keysize
=
NULL_KEY_SIZE
,
.
cia_max_keysize
=
NULL_KEY_SIZE
,
.
cia_max_keysize
=
NULL_KEY_SIZE
,
.
cia_ivsize
=
0
,
.
cia_setkey
=
null_setkey
,
.
cia_setkey
=
null_setkey
,
.
cia_encrypt
=
null_encrypt
,
.
cia_encrypt
=
null_encrypt
,
.
cia_decrypt
=
null_decrypt
}
}
.
cia_decrypt
=
null_decrypt
}
}
...
...
crypto/des.c
View file @
f7ab034d
...
@@ -1249,7 +1249,6 @@ static struct crypto_alg des_alg = {
...
@@ -1249,7 +1249,6 @@ static struct crypto_alg des_alg = {
.
cra_u
=
{
.
cipher
=
{
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
DES_KEY_SIZE
,
.
cia_min_keysize
=
DES_KEY_SIZE
,
.
cia_max_keysize
=
DES_KEY_SIZE
,
.
cia_max_keysize
=
DES_KEY_SIZE
,
.
cia_ivsize
=
DES_BLOCK_SIZE
,
.
cia_setkey
=
des_setkey
,
.
cia_setkey
=
des_setkey
,
.
cia_encrypt
=
des_encrypt
,
.
cia_encrypt
=
des_encrypt
,
.
cia_decrypt
=
des_decrypt
}
}
.
cia_decrypt
=
des_decrypt
}
}
...
@@ -1265,7 +1264,6 @@ static struct crypto_alg des3_ede_alg = {
...
@@ -1265,7 +1264,6 @@ static struct crypto_alg des3_ede_alg = {
.
cra_u
=
{
.
cipher
=
{
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
DES3_EDE_KEY_SIZE
,
.
cia_min_keysize
=
DES3_EDE_KEY_SIZE
,
.
cia_max_keysize
=
DES3_EDE_KEY_SIZE
,
.
cia_max_keysize
=
DES3_EDE_KEY_SIZE
,
.
cia_ivsize
=
DES3_EDE_BLOCK_SIZE
,
.
cia_setkey
=
des3_ede_setkey
,
.
cia_setkey
=
des3_ede_setkey
,
.
cia_encrypt
=
des3_ede_encrypt
,
.
cia_encrypt
=
des3_ede_encrypt
,
.
cia_decrypt
=
des3_ede_decrypt
}
}
.
cia_decrypt
=
des3_ede_decrypt
}
}
...
...
crypto/proc.c
View file @
f7ab034d
...
@@ -62,8 +62,6 @@ static int c_show(struct seq_file *m, void *p)
...
@@ -62,8 +62,6 @@ static int c_show(struct seq_file *m, void *p)
alg
->
cra_cipher
.
cia_min_keysize
);
alg
->
cra_cipher
.
cia_min_keysize
);
seq_printf
(
m
,
"max keysize : %u
\n
"
,
seq_printf
(
m
,
"max keysize : %u
\n
"
,
alg
->
cra_cipher
.
cia_max_keysize
);
alg
->
cra_cipher
.
cia_max_keysize
);
seq_printf
(
m
,
"ivsize : %u
\n
"
,
alg
->
cra_cipher
.
cia_ivsize
);
break
;
break
;
case
CRYPTO_ALG_TYPE_DIGEST
:
case
CRYPTO_ALG_TYPE_DIGEST
:
...
...
crypto/serpent.c
View file @
f7ab034d
...
@@ -483,7 +483,6 @@ static struct crypto_alg serpent_alg = {
...
@@ -483,7 +483,6 @@ static struct crypto_alg serpent_alg = {
.
cra_u
=
{
.
cipher
=
{
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
SERPENT_MIN_KEY_SIZE
,
.
cia_min_keysize
=
SERPENT_MIN_KEY_SIZE
,
.
cia_max_keysize
=
SERPENT_MAX_KEY_SIZE
,
.
cia_max_keysize
=
SERPENT_MAX_KEY_SIZE
,
.
cia_ivsize
=
SERPENT_BLOCK_SIZE
,
.
cia_setkey
=
setkey
,
.
cia_setkey
=
setkey
,
.
cia_encrypt
=
encrypt
,
.
cia_encrypt
=
encrypt
,
.
cia_decrypt
=
decrypt
}
}
.
cia_decrypt
=
decrypt
}
}
...
...
crypto/twofish.c
View file @
f7ab034d
...
@@ -877,7 +877,6 @@ static struct crypto_alg alg = {
...
@@ -877,7 +877,6 @@ static struct crypto_alg alg = {
.
cra_u
=
{
.
cipher
=
{
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
TF_MIN_KEY_SIZE
,
.
cia_min_keysize
=
TF_MIN_KEY_SIZE
,
.
cia_max_keysize
=
TF_MAX_KEY_SIZE
,
.
cia_max_keysize
=
TF_MAX_KEY_SIZE
,
.
cia_ivsize
=
TF_BLOCK_SIZE
,
.
cia_setkey
=
twofish_setkey
,
.
cia_setkey
=
twofish_setkey
,
.
cia_encrypt
=
twofish_encrypt
,
.
cia_encrypt
=
twofish_encrypt
,
.
cia_decrypt
=
twofish_decrypt
}
}
.
cia_decrypt
=
twofish_decrypt
}
}
...
...
include/linux/crypto.h
View file @
f7ab034d
...
@@ -65,7 +65,6 @@ struct scatterlist;
...
@@ -65,7 +65,6 @@ struct scatterlist;
struct
cipher_alg
{
struct
cipher_alg
{
unsigned
int
cia_min_keysize
;
unsigned
int
cia_min_keysize
;
unsigned
int
cia_max_keysize
;
unsigned
int
cia_max_keysize
;
unsigned
int
cia_ivsize
;
int
(
*
cia_setkey
)(
void
*
ctx
,
const
u8
*
key
,
int
(
*
cia_setkey
)(
void
*
ctx
,
const
u8
*
key
,
unsigned
int
keylen
,
u32
*
flags
);
unsigned
int
keylen
,
u32
*
flags
);
void
(
*
cia_encrypt
)(
void
*
ctx
,
u8
*
dst
,
const
u8
*
src
);
void
(
*
cia_encrypt
)(
void
*
ctx
,
u8
*
dst
,
const
u8
*
src
);
...
@@ -128,6 +127,7 @@ struct crypto_tfm;
...
@@ -128,6 +127,7 @@ struct crypto_tfm;
struct
cipher_tfm
{
struct
cipher_tfm
{
void
*
cit_iv
;
void
*
cit_iv
;
unsigned
int
cit_ivsize
;
u32
cit_mode
;
u32
cit_mode
;
int
(
*
cit_setkey
)(
struct
crypto_tfm
*
tfm
,
int
(
*
cit_setkey
)(
struct
crypto_tfm
*
tfm
,
const
u8
*
key
,
unsigned
int
keylen
);
const
u8
*
key
,
unsigned
int
keylen
);
...
@@ -237,7 +237,7 @@ static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
...
@@ -237,7 +237,7 @@ static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
static
inline
unsigned
int
crypto_tfm_alg_ivsize
(
struct
crypto_tfm
*
tfm
)
static
inline
unsigned
int
crypto_tfm_alg_ivsize
(
struct
crypto_tfm
*
tfm
)
{
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
return
tfm
->
__crt_alg
->
cra_cipher
.
cia
_ivsize
;
return
tfm
->
crt_cipher
.
cit
_ivsize
;
}
}
static
inline
unsigned
int
crypto_tfm_alg_blocksize
(
struct
crypto_tfm
*
tfm
)
static
inline
unsigned
int
crypto_tfm_alg_blocksize
(
struct
crypto_tfm
*
tfm
)
...
...
net/ipv4/esp4.c
View file @
f7ab034d
...
@@ -505,7 +505,10 @@ int esp_init_state(struct xfrm_state *x, void *args)
...
@@ -505,7 +505,10 @@ int esp_init_state(struct xfrm_state *x, void *args)
}
}
esp
->
conf
.
key
=
x
->
ealg
->
alg_key
;
esp
->
conf
.
key
=
x
->
ealg
->
alg_key
;
esp
->
conf
.
key_len
=
(
x
->
ealg
->
alg_key_len
+
7
)
/
8
;
esp
->
conf
.
key_len
=
(
x
->
ealg
->
alg_key_len
+
7
)
/
8
;
esp
->
conf
.
tfm
=
crypto_alloc_tfm
(
x
->
ealg
->
alg_name
,
CRYPTO_TFM_MODE_CBC
);
if
(
x
->
props
.
ealgo
==
SADB_EALG_NULL
)
esp
->
conf
.
tfm
=
crypto_alloc_tfm
(
x
->
ealg
->
alg_name
,
CRYPTO_TFM_MODE_ECB
);
else
esp
->
conf
.
tfm
=
crypto_alloc_tfm
(
x
->
ealg
->
alg_name
,
CRYPTO_TFM_MODE_CBC
);
if
(
esp
->
conf
.
tfm
==
NULL
)
if
(
esp
->
conf
.
tfm
==
NULL
)
goto
error
;
goto
error
;
esp
->
conf
.
ivlen
=
crypto_tfm_alg_ivsize
(
esp
->
conf
.
tfm
);
esp
->
conf
.
ivlen
=
crypto_tfm_alg_ivsize
(
esp
->
conf
.
tfm
);
...
...
net/ipv6/esp6.c
View file @
f7ab034d
...
@@ -409,7 +409,10 @@ int esp6_init_state(struct xfrm_state *x, void *args)
...
@@ -409,7 +409,10 @@ int esp6_init_state(struct xfrm_state *x, void *args)
}
}
esp
->
conf
.
key
=
x
->
ealg
->
alg_key
;
esp
->
conf
.
key
=
x
->
ealg
->
alg_key
;
esp
->
conf
.
key_len
=
(
x
->
ealg
->
alg_key_len
+
7
)
/
8
;
esp
->
conf
.
key_len
=
(
x
->
ealg
->
alg_key_len
+
7
)
/
8
;
esp
->
conf
.
tfm
=
crypto_alloc_tfm
(
x
->
ealg
->
alg_name
,
CRYPTO_TFM_MODE_CBC
);
if
(
x
->
props
.
ealgo
==
SADB_EALG_NULL
)
esp
->
conf
.
tfm
=
crypto_alloc_tfm
(
x
->
ealg
->
alg_name
,
CRYPTO_TFM_MODE_ECB
);
else
esp
->
conf
.
tfm
=
crypto_alloc_tfm
(
x
->
ealg
->
alg_name
,
CRYPTO_TFM_MODE_CBC
);
if
(
esp
->
conf
.
tfm
==
NULL
)
if
(
esp
->
conf
.
tfm
==
NULL
)
goto
error
;
goto
error
;
esp
->
conf
.
ivlen
=
crypto_tfm_alg_ivsize
(
esp
->
conf
.
tfm
);
esp
->
conf
.
ivlen
=
crypto_tfm_alg_ivsize
(
esp
->
conf
.
tfm
);
...
...
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