Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
9e6225ae
Commit
9e6225ae
authored
Dec 12, 2009
by
Nick Mathewson
🎨
Browse files
Merge commit 'sebastian/coverity'
parents
0c1b3070
f1b7295b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/common/crypto.c
View file @
9e6225ae
...
...
@@ -427,10 +427,7 @@ crypto_create_init_cipher(const char *key, int encrypt_mode)
return
NULL
;
}
if
(
crypto_cipher_set_key
(
crypto
,
key
))
{
crypto_log_errors
(
LOG_WARN
,
"setting symmetric key"
);
goto
error
;
}
crypto_cipher_set_key
(
crypto
,
key
);
if
(
encrypt_mode
)
r
=
crypto_cipher_encrypt_init_cipher
(
crypto
);
...
...
@@ -1254,16 +1251,14 @@ crypto_cipher_generate_key(crypto_cipher_env_t *env)
/** Set the symmetric key for the cipher in <b>env</b> to the first
* CIPHER_KEY_LEN bytes of <b>key</b>. Does not initialize the cipher.
* Return 0 on success, -1 on failure.
*/
int
void
crypto_cipher_set_key
(
crypto_cipher_env_t
*
env
,
const
char
*
key
)
{
tor_assert
(
env
);
tor_assert
(
key
);
memcpy
(
env
->
key
,
key
,
CIPHER_KEY_LEN
);
return
0
;
}
/** Generate an initialization vector for our AES-CTR cipher; store it
...
...
src/common/crypto.h
View file @
9e6225ae
...
...
@@ -151,7 +151,7 @@ int crypto_pk_check_fingerprint_syntax(const char *s);
/* symmetric crypto */
int
crypto_cipher_generate_key
(
crypto_cipher_env_t
*
env
);
int
crypto_cipher_set_key
(
crypto_cipher_env_t
*
env
,
const
char
*
key
);
void
crypto_cipher_set_key
(
crypto_cipher_env_t
*
env
,
const
char
*
key
);
void
crypto_cipher_generate_iv
(
char
*
iv_out
);
int
crypto_cipher_set_iv
(
crypto_cipher_env_t
*
env
,
const
char
*
iv
);
const
char
*
crypto_cipher_get_key
(
crypto_cipher_env_t
*
env
);
...
...
src/or/config.c
View file @
9e6225ae
...
...
@@ -1575,7 +1575,10 @@ config_get_commandlines(int argc, char **argv, config_line_t **result)
*
new
=
tor_malloc_zero
(
sizeof
(
config_line_t
));
s
=
argv
[
i
];
while
(
*
s
==
'-'
)
/* Each keyword may be prefixed with one or two dashes. */
if
(
*
s
==
'-'
)
s
++
;
if
(
*
s
==
'-'
)
s
++
;
(
*
new
)
->
key
=
tor_strdup
(
expand_abbrev
(
&
options_format
,
s
,
1
,
1
));
...
...
src/or/directory.c
View file @
9e6225ae
...
...
@@ -1463,21 +1463,22 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
}
(
void
)
skewed
;
/* skewed isn't used yet. */
if
(
status_code
==
503
&&
body_len
<
16
)
{
routerstatus_t
*
rs
;
trusted_dir_server_t
*
ds
;
log_info
(
LD_DIR
,
"Received http status code %d (%s) from server "
"'%s:%d'. I'll try again soon."
,
status_code
,
escaped
(
reason
),
conn
->
_base
.
address
,
conn
->
_base
.
port
);
if
((
rs
=
router_get_consensus_status_by_id
(
conn
->
identity_digest
)))
rs
->
last_dir_503_at
=
now
;
if
((
ds
=
router_get_trusteddirserver_by_digest
(
conn
->
identity_digest
)))
ds
->
fake_status
.
last_dir_503_at
=
now
;
if
(
status_code
==
503
)
{
if
(
body_len
<
16
)
{
routerstatus_t
*
rs
;
trusted_dir_server_t
*
ds
;
log_info
(
LD_DIR
,
"Received http status code %d (%s) from server "
"'%s:%d'. I'll try again soon."
,
status_code
,
escaped
(
reason
),
conn
->
_base
.
address
,
conn
->
_base
.
port
);
if
((
rs
=
router_get_consensus_status_by_id
(
conn
->
identity_digest
)))
rs
->
last_dir_503_at
=
now
;
if
((
ds
=
router_get_trusteddirserver_by_digest
(
conn
->
identity_digest
)))
ds
->
fake_status
.
last_dir_503_at
=
now
;
tor_free
(
body
);
tor_free
(
headers
);
tor_free
(
reason
);
return
-
1
;
}
else
if
(
status_code
==
503
)
{
tor_free
(
body
);
tor_free
(
headers
);
tor_free
(
reason
);
return
-
1
;
}
/* XXXX022 Remove this once every server with bug 539 is obsolete. */
log_info
(
LD_DIR
,
"Server at '%s:%d' sent us a 503 response, but included "
"a body anyway. We'll pretend it gave us a 200."
,
...
...
Write
Preview
Supports
Markdown
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