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
918ce7a0
Commit
918ce7a0
authored
20 years ago
by
Roger Dingledine
Browse files
Options
Downloads
Patches
Plain Diff
a few more ints to size_ts
svn:r2461
parent
a1041154
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/crypto.c
+6
-4
6 additions, 4 deletions
src/common/crypto.c
src/common/crypto.h
+2
-2
2 additions, 2 deletions
src/common/crypto.h
with
8 additions
and
6 deletions
src/common/crypto.c
+
6
−
4
View file @
918ce7a0
...
...
@@ -135,7 +135,7 @@ crypto_log_errors(int severity, const char *doing)
func
=
(
const
char
*
)
ERR_func_error_string
(
err
);
if
(
!
msg
)
msg
=
"(null)"
;
if
(
doing
)
{
log
(
severity
,
"crypto error while %s: %s (in %s:%s)"
,
doing
,
msg
,
lib
,
func
);
log
(
severity
,
"crypto error while %s: %s (in %s:%s)"
,
doing
,
msg
,
lib
,
func
);
}
else
{
log
(
severity
,
"crypto error: %s (in %s:%s)"
,
msg
,
lib
,
func
);
}
...
...
@@ -377,7 +377,7 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k
* string, *<b>len</b> to the string's length, and return 0. On
* failure, return -1.
*/
int
crypto_pk_write_public_key_to_string
(
crypto_pk_env_t
*
env
,
char
**
dest
,
in
t
*
len
)
{
int
crypto_pk_write_public_key_to_string
(
crypto_pk_env_t
*
env
,
char
**
dest
,
size_
t
*
len
)
{
BUF_MEM
*
buf
;
BIO
*
b
;
...
...
@@ -397,6 +397,7 @@ int crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest, int
BIO_set_close
(
b
,
BIO_NOCLOSE
);
/* so BIO_free doesn't free buf */
BIO_free
(
b
);
tor_assert
(
buf
->
length
>=
0
);
*
dest
=
tor_malloc
(
buf
->
length
+
1
);
memcpy
(
*
dest
,
buf
->
data
,
buf
->
length
);
(
*
dest
)[
buf
->
length
]
=
0
;
/* null terminate it */
...
...
@@ -410,7 +411,7 @@ int crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest, int
* <b>src</b>, and store the result in <b>env</b>. Return 0 on success, -1 on
* failure.
*/
int
crypto_pk_read_public_key_from_string
(
crypto_pk_env_t
*
env
,
const
char
*
src
,
in
t
len
)
{
int
crypto_pk_read_public_key_from_string
(
crypto_pk_env_t
*
env
,
const
char
*
src
,
size_
t
len
)
{
BIO
*
b
;
tor_assert
(
env
&&
src
);
...
...
@@ -455,6 +456,7 @@ crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env,
return
-
1
;
}
len
=
BIO_get_mem_data
(
bio
,
&
cp
);
tor_assert
(
len
>=
0
);
s
=
tor_malloc
(
len
+
1
);
strncpy
(
s
,
cp
,
len
);
s
[
len
]
=
'\0'
;
...
...
@@ -1473,7 +1475,7 @@ base64_decode(char *dest, size_t destlen, const char *src, size_t srclen)
EVP_ENCODE_CTX
ctx
;
int
len
,
ret
;
/* 64 bytes of input -> *up to* 48 bytes of output.
Plus one more byte, in ca
e
s I'm wrong.
Plus one more byte, in cas
e
I'm wrong.
*/
if
(
destlen
<
((
srclen
/
64
)
+
1
)
*
49
)
return
-
1
;
...
...
This diff is collapsed.
Click to expand it.
src/common/crypto.h
+
2
−
2
View file @
918ce7a0
...
...
@@ -59,8 +59,8 @@ void crypto_free_cipher_env(crypto_cipher_env_t *env);
/* public key crypto */
int
crypto_pk_generate_key
(
crypto_pk_env_t
*
env
);
int
crypto_pk_write_public_key_to_string
(
crypto_pk_env_t
*
env
,
char
**
dest
,
in
t
*
len
);
int
crypto_pk_read_public_key_from_string
(
crypto_pk_env_t
*
env
,
const
char
*
src
,
in
t
len
);
int
crypto_pk_write_public_key_to_string
(
crypto_pk_env_t
*
env
,
char
**
dest
,
size_
t
*
len
);
int
crypto_pk_read_public_key_from_string
(
crypto_pk_env_t
*
env
,
const
char
*
src
,
size_
t
len
);
int
crypto_pk_write_private_key_to_filename
(
crypto_pk_env_t
*
env
,
const
char
*
fname
);
int
crypto_pk_check_key
(
crypto_pk_env_t
*
env
);
int
crypto_pk_read_private_key_from_filename
(
crypto_pk_env_t
*
env
,
const
char
*
keyfile
);
...
...
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