Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
a90a111a
Commit
a90a111a
authored
8 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Label a few conditions in link authentication code as bugs.
parent
672fe4be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/or/connection_or.c
+24
-7
24 additions, 7 deletions
src/or/connection_or.c
with
24 additions
and
7 deletions
src/or/connection_or.c
+
24
−
7
View file @
a90a111a
...
...
@@ -2329,8 +2329,12 @@ connection_or_send_auth_challenge_cell(or_connection_t *conn)
cell
=
var_cell_new
(
auth_challenge_cell_encoded_len
(
ac
));
ssize_t
len
=
auth_challenge_cell_encode
(
cell
->
payload
,
cell
->
payload_len
,
ac
);
if
(
len
!=
cell
->
payload_len
)
if
(
len
!=
cell
->
payload_len
)
{
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Encoded auth challenge cell length not as expected"
);
goto
done
;
/* LCOV_EXCL_STOP */
}
cell
->
command
=
CELL_AUTH_CHALLENGE
;
connection_or_write_var_cell_to_buf
(
cell
,
conn
);
...
...
@@ -2514,23 +2518,30 @@ connection_or_compute_authenticate_cell_body(or_connection_t *conn,
set_uint16
(
result
->
payload
,
htons
(
authtype
));
if
((
len
=
auth1_encode
(
out
,
outlen
,
auth
,
ctx
))
<
0
)
{
log_warn
(
LD_OR
,
"Unable to encode signed part of AUTH1 data."
);
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Unable to encode signed part of AUTH1 data."
);
goto
err
;
/* LCOV_EXCL_STOP */
}
if
(
server
)
{
auth1_t
*
tmp
=
NULL
;
ssize_t
len2
=
auth1_parse
(
&
tmp
,
out
,
len
,
ctx
);
if
(
!
tmp
)
{
log_warn
(
LD_OR
,
"Unable to parse signed part of AUTH1 data."
);
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Unable to parse signed part of AUTH1 data that we just "
"encoded"
);
goto
err
;
/* LCOV_EXCL_STOP */
}
result
->
payload_len
=
(
tmp
->
end_of_signed
-
result
->
payload
);
auth1_free
(
tmp
);
if
(
len2
!=
len
)
{
log_warn
(
LD_OR
,
"Mismatched length when re-parsing AUTH1 data."
);
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Mismatched length when re-parsing AUTH1 data."
);
goto
err
;
/* LCOV_EXCL_STOP */
}
goto
done
;
}
...
...
@@ -2538,8 +2549,10 @@ connection_or_compute_authenticate_cell_body(or_connection_t *conn,
if
(
ed_signing_key
&&
is_ed
)
{
ed25519_signature_t
sig
;
if
(
ed25519_sign
(
&
sig
,
out
,
len
,
ed_signing_key
)
<
0
)
{
log_warn
(
LD_OR
,
"Unable to sign ed25519 cert"
);
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Unable to sign ed25519 authentication data"
);
goto
err
;
/* LCOV_EXCL_STOP */
}
auth1_setlen_sig
(
auth
,
ED25519_SIG_LEN
);
memcpy
(
auth1_getarray_sig
(
auth
),
sig
.
sig
,
ED25519_SIG_LEN
);
...
...
@@ -2563,8 +2576,10 @@ connection_or_compute_authenticate_cell_body(or_connection_t *conn,
len
=
auth1_encode
(
out
,
outlen
,
auth
,
ctx
);
if
(
len
<
0
)
{
log_warn
(
LD_OR
,
"Unable to encode signed AUTH1 data."
);
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Unable to encode signed AUTH1 data."
);
goto
err
;
/* LCOV_EXCL_STOP */
}
tor_assert
(
len
+
AUTH_CELL_HEADER_LEN
<=
result
->
payload_len
);
result
->
payload_len
=
len
+
AUTH_CELL_HEADER_LEN
;
...
...
@@ -2606,8 +2621,10 @@ connection_or_send_authenticate_cell,(or_connection_t *conn, int authtype))
get_current_auth_keypair
(),
0
/* not server */
);
if
(
!
cell
)
{
/* LCOV_EXCL_START */
log_warn
(
LD_BUG
,
"Unable to compute authenticate cell!"
);
return
-
1
;
/* LCOV_EXCL_STOP */
}
connection_or_write_var_cell_to_buf
(
cell
,
conn
);
var_cell_free
(
cell
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment