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
04001db3
Commit
04001db3
authored
Oct 28, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPSEC]: Remove debugging code.
parent
6c55c29f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
133 deletions
+0
-133
net/ipv4/ah.c
net/ipv4/ah.c
+0
-90
net/ipv4/xfrm_policy.c
net/ipv4/xfrm_policy.c
+0
-43
No files found.
net/ipv4/ah.c
View file @
04001db3
...
@@ -124,63 +124,6 @@ void skb_ah_walk(const struct sk_buff *skb, struct crypto_tfm *tfm)
...
@@ -124,63 +124,6 @@ void skb_ah_walk(const struct sk_buff *skb, struct crypto_tfm *tfm)
BUG
();
BUG
();
}
}
#if 0 /* obsolete? */
static void
ah_old_digest(struct xfrm_state *x, struct sk_buff *skb, u8 *auth_data)
{
struct ah_data *ahp = (struct ah_data*)x->data;
struct crypto_tfm *tfm = ahp->tfm;
u8 pad[512/8 - ahp->key_len];
memset(auth_data, 0, ahp->digest_len);
memset(pad, 0, sizeof(pad));
crypto_digest_init(tfm);
tfm->__crt_alg->cra_digest.dia_update(tfm->crt_ctx, ahp->key, ahp->key_len);
tfm->__crt_alg->cra_digest.dia_update(tfm->crt_ctx, ahp->key, sizeof(pad)-ahp->key_len);
skb_ah_walk(skb, tfm);
tfm->__crt_alg->cra_digest.dia_update(tfm->crt_ctx, ahp->key, ahp->key_len);
crypto_digest_final(tfm, auth_data);
}
#endif
/* I bring apologies for wrong use of crypto lib. Use of official
* api to get hmac digest is too chumbersome.
*/
static
void
ah_hmac_digest
(
struct
xfrm_state
*
x
,
struct
sk_buff
*
skb
,
u8
*
auth_data
)
{
struct
ah_data
*
ahp
=
(
struct
ah_data
*
)
x
->
data
;
struct
crypto_tfm
*
tfm
=
ahp
->
tfm
;
int
i
;
char
tmp_digest
[
crypto_tfm_digestsize
(
tfm
)];
char
pad
[
crypto_tfm_blocksize
(
tfm
)];
memset
(
auth_data
,
0
,
ahp
->
digest_len
);
memset
(
pad
,
0
,
sizeof
(
pad
));
memcpy
(
pad
,
ahp
->
key
,
ahp
->
key_len
);
for
(
i
=
0
;
i
<
crypto_tfm_blocksize
(
tfm
);
i
++
)
pad
[
i
]
^=
0x36
;
crypto_digest_init
(
tfm
);
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
tfm
->
crt_ctx
,
pad
,
sizeof
(
pad
));
skb_ah_walk
(
skb
,
tfm
);
crypto_digest_final
(
tfm
,
tmp_digest
);
memset
(
pad
,
0
,
sizeof
(
pad
));
memcpy
(
pad
,
ahp
->
key
,
ahp
->
key_len
);
for
(
i
=
0
;
i
<
crypto_tfm_blocksize
(
tfm
);
i
++
)
pad
[
i
]
^=
0x5c
;
crypto_digest_init
(
tfm
);
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
tfm
->
crt_ctx
,
pad
,
sizeof
(
pad
));
tfm
->
__crt_alg
->
cra_digest
.
dia_update
(
tfm
->
crt_ctx
,
tmp_digest
,
crypto_tfm_digestsize
(
tfm
));
crypto_digest_final
(
tfm
,
auth_data
);
}
int
ah_output
(
struct
sk_buff
*
skb
)
int
ah_output
(
struct
sk_buff
*
skb
)
{
{
int
err
;
int
err
;
...
@@ -372,36 +315,3 @@ static void __exit ah4_fini(void)
...
@@ -372,36 +315,3 @@ static void __exit ah4_fini(void)
if
(
inet_del_protocol
(
&
ah4_protocol
,
IPPROTO_AH
)
<
0
)
if
(
inet_del_protocol
(
&
ah4_protocol
,
IPPROTO_AH
)
<
0
)
printk
(
KERN_INFO
"ip ah close: can't remove protocol
\n
"
);
printk
(
KERN_INFO
"ip ah close: can't remove protocol
\n
"
);
}
}
void
ah_destroy
(
struct
xfrm_state
*
x
)
{
}
struct
ah_data
debugging_ah_state
=
{
.
key
=
"PIZDETSPIZDETSPIZDETSPIZDETSPIZDETS"
,
.
key_len
=
32
,
.
digest_len
=
16
,
.
digest
=
ah_hmac_digest
};
int
ah_init_state
(
struct
xfrm_state
*
x
,
void
*
args
)
{
debugging_ah_state
.
tfm
=
crypto_alloc_tfm
(
CRYPTO_ALG_MD5
);
x
->
data
=
&
debugging_ah_state
;
x
->
props
.
header_len
=
16
+
16
;
return
0
;
}
struct
xfrm_type
ah_type
=
{
.
description
=
"AH4-HMAC"
,
.
refcnt
=
ATOMIC_INIT
(
1
),
.
proto
=
IPPROTO_AH
,
.
algo
=
0
,
.
init_state
=
ah_init_state
,
.
destructor
=
ah_destroy
,
.
input
=
ah_input
,
.
output
=
ah_output
};
net/ipv4/xfrm_policy.c
View file @
04001db3
...
@@ -784,47 +784,6 @@ struct dst_ops xfrm4_dst_ops = {
...
@@ -784,47 +784,6 @@ struct dst_ops xfrm4_dst_ops = {
.
entry_size
=
sizeof
(
struct
xfrm_dst
),
.
entry_size
=
sizeof
(
struct
xfrm_dst
),
};
};
void
create_debug_policy
(
void
)
{
extern
struct
xfrm_type
ah_type
;
struct
xfrm_policy
*
pol
=
xfrm_policy_alloc
();
struct
xfrm_state
*
x
;
if
(
!
pol
)
panic
(
"panic
\n
"
);
pol
->
expires
=
~
0UL
;
pol
->
action
=
XFRM_POLICY_ALLOW
;
pol
->
xfrm_nr
=
1
;
pol
->
xfrm_vec
[
0
]
=
(
struct
xfrm_tmpl
){
.
id
=
{
.
proto
=
IPPROTO_AH
},
.
algos
=
~
0
};
pol
->
selector
=
(
struct
xfrm_selector
){
.
daddr
=
{
.
a4
=
{
.
addr
=
__constant_htonl
(
0x7f000001
),
.
mask
=
~
0
}
},
.
dport
=
__constant_htons
(
8888
),
.
dport_mask
=
~
0
,
.
prefixlen_d
=
32
,
.
proto
=
IPPROTO_UDP
};
xfrm_policy_list
[
XFRM_POLICY_OUT
]
=
pol
;
x
=
xfrm_state_alloc
();
x
->
sel
=
pol
->
selector
;
/* Debug. */
x
->
id
.
proto
=
IPPROTO_AH
;
x
->
id
.
spi
=
1
;
x
->
id
.
daddr
=
pol
->
selector
.
daddr
;
x
->
km
.
state
=
XFRM_STATE_VALID
;
x
->
km
.
warn_bytes
=
0
;
x
->
replay
.
oseq
=
1
;
x
->
type
=
&
ah_type
;
x
->
type
->
init_state
(
x
,
NULL
);
xfrm_state_insert
(
x
);
}
void
__init
xfrm_init
(
void
)
void
__init
xfrm_init
(
void
)
{
{
xfrm4_dst_ops
.
kmem_cachep
=
kmem_cache_create
(
"xfrm4_dst_cache"
,
xfrm4_dst_ops
.
kmem_cachep
=
kmem_cache_create
(
"xfrm4_dst_cache"
,
...
@@ -840,6 +799,4 @@ void __init xfrm_init(void)
...
@@ -840,6 +799,4 @@ void __init xfrm_init(void)
xfrm_state_init
();
xfrm_state_init
();
xfrm_input_init
();
xfrm_input_init
();
ah4_init
();
ah4_init
();
create_debug_policy
();
}
}
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