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
c99bec6e
Commit
c99bec6e
authored
Apr 08, 2003
by
Jon Grimm
Committed by
Sridhar Samudrala
Apr 08, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP] Add wrappers for sctp with no crypto support.
parent
8d0df569
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
include/net/sctp/sctp.h
include/net/sctp/sctp.h
+12
-0
net/sctp/endpointola.c
net/sctp/endpointola.c
+1
-1
net/sctp/sm_make_chunk.c
net/sctp/sm_make_chunk.c
+8
-6
net/sctp/socket.c
net/sctp/socket.c
+2
-2
No files found.
include/net/sctp/sctp.h
View file @
c99bec6e
...
...
@@ -328,6 +328,18 @@ static inline void sctp_v6_exit(void) { return; }
#endif
/* #if defined(CONFIG_IPV6) */
/* Some wrappers, in case crypto not available. */
#if defined (CONFIG_CRYPTO_HMAC)
#define sctp_crypto_alloc_tfm crypto_alloc_tfm
#define sctp_crypto_free_tfm crypto_free_tfm
#define sctp_crypto_hmac crypto_hmac
#else
#define sctp_crypto_alloc_tfm(x...) NULL
#define sctp_crypto_free_tfm(x...)
#define sctp_crypto_hmac(x...)
#endif
/* Map an association to an assoc_id. */
static
inline
sctp_assoc_t
sctp_assoc2id
(
const
sctp_association_t
*
asoc
)
{
...
...
net/sctp/endpointola.c
View file @
c99bec6e
...
...
@@ -203,7 +203,7 @@ void sctp_endpoint_destroy(struct sctp_endpoint *ep)
/* Free up the HMAC transform. */
if
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
)
crypto_free_tfm
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
);
sctp_
crypto_free_tfm
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
);
/* Cleanup. */
sctp_inq_free
(
&
ep
->
base
.
inqueue
);
...
...
net/sctp/sm_make_chunk.c
View file @
c99bec6e
...
...
@@ -1358,7 +1358,7 @@ sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
sctp_signed_cookie_t
*
cookie
;
struct
scatterlist
sg
;
int
headersize
,
bodysize
;
unsigned
int
keylen
=
SCTP_SECRET_SIZE
;
unsigned
int
keylen
;
char
*
key
;
headersize
=
sizeof
(
sctp_paramhdr_t
)
+
SCTP_SECRET_SIZE
;
...
...
@@ -1412,10 +1412,11 @@ sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
sg
.
page
=
virt_to_page
(
&
cookie
->
c
);
sg
.
offset
=
(
unsigned
long
)(
&
cookie
->
c
)
%
PAGE_SIZE
;
sg
.
length
=
bodysize
;
keylen
=
SCTP_SECRET_SIZE
;
key
=
(
char
*
)
ep
->
secret_key
[
ep
->
current_key
];
crypto_hmac
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
,
key
,
&
keylen
,
&
sg
,
1
,
cookie
->
signature
);
sctp_crypto_hmac
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
,
key
,
&
keylen
,
&
sg
,
1
,
cookie
->
signature
);
}
nodata:
...
...
@@ -1471,14 +1472,15 @@ struct sctp_association *sctp_unpack_cookie(
key
=
(
char
*
)
ep
->
secret_key
[
ep
->
current_key
];
memset
(
digest
,
0x00
,
sizeof
(
digest
));
crypto_hmac
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
,
key
,
&
keylen
,
&
sg
,
1
,
digest
);
sctp_crypto_hmac
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
,
key
,
&
keylen
,
&
sg
,
1
,
digest
);
if
(
memcmp
(
digest
,
cookie
->
signature
,
SCTP_SIGNATURE_SIZE
))
{
/* Try the previous key. */
key
=
(
char
*
)
ep
->
secret_key
[
ep
->
last_key
];
memset
(
digest
,
0x00
,
sizeof
(
digest
));
crypto_hmac
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
,
key
,
&
keylen
,
&
sg
,
1
,
digest
);
sctp_crypto_hmac
(
sctp_sk
(
ep
->
base
.
sk
)
->
hmac
,
key
,
&
keylen
,
&
sg
,
1
,
digest
);
if
(
memcmp
(
digest
,
cookie
->
signature
,
SCTP_SIGNATURE_SIZE
))
{
/* Yikes! Still bad signature! */
...
...
net/sctp/socket.c
View file @
c99bec6e
...
...
@@ -2745,7 +2745,7 @@ int sctp_inet_listen(struct socket *sock, int backlog)
/* Allocate HMAC for generating cookie. */
if
(
sctp_hmac_alg
)
{
tfm
=
crypto_alloc_tfm
(
sctp_hmac_alg
,
0
);
tfm
=
sctp_
crypto_alloc_tfm
(
sctp_hmac_alg
,
0
);
if
(
!
tfm
)
{
err
=
-
ENOSYS
;
goto
out
;
...
...
@@ -2772,7 +2772,7 @@ int sctp_inet_listen(struct socket *sock, int backlog)
return
err
;
cleanup:
if
(
tfm
)
crypto_free_tfm
(
tfm
);
sctp_
crypto_free_tfm
(
tfm
);
goto
out
;
}
...
...
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