[or-cvs] rename digest_copy to digest_dup, make it return, make gcc ...
Roger Dingledine
arma at seul.org
Tue Dec 16 05:47:23 UTC 2003
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common
Modified Files:
crypto.c crypto.h
Log Message:
rename digest_copy to digest_dup, make it return, make gcc happier
Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- crypto.c 16 Dec 2003 05:29:03 -0000 1.47
+++ crypto.c 16 Dec 2003 05:47:21 -0000 1.48
@@ -818,7 +818,6 @@
}
}
-
/* SHA-1 */
int crypto_SHA_digest(const unsigned char *m, int len, unsigned char *digest)
{
@@ -833,8 +832,9 @@
crypto_digest_env_t *
crypto_digest_new_env(int type)
{
+ crypto_digest_env_t *r;
assert(type == CRYPTO_SHA1_DIGEST);
- crypto_digest_env_t *r = tor_malloc(sizeof(crypto_digest_env_t));
+ r = tor_malloc(sizeof(crypto_digest_env_t));
SHA1_Init(&r->d);
return r;
}
@@ -844,16 +844,18 @@
assert(digest);
tor_free(digest);
}
+
void
crypto_digest_add_bytes(crypto_digest_env_t *digest, const char *data,
- size_t len)
+ size_t len)
{
assert(digest);
assert(data);
SHA1_Update(&digest->d, (void*)data, len);
}
+
void crypto_digest_get_digest(crypto_digest_env_t *digest,
- char *out, size_t out_len)
+ char *out, size_t out_len)
{
static char r[SHA_DIGEST_LENGTH];
assert(digest && out);
@@ -863,17 +865,18 @@
}
crypto_digest_env_t *
-crypto_digest_copy(const crypto_digest_env_t *digest)
+crypto_digest_dup(const crypto_digest_env_t *digest)
{
crypto_digest_env_t *r;
assert(digest);
r = tor_malloc(sizeof(crypto_digest_env_t));
memcpy(r,digest,sizeof(crypto_digest_env_t));
+ return r;
}
void
crypto_digest_assign(crypto_digest_env_t *into,
- const crypto_digest_env_t *from)
+ const crypto_digest_env_t *from)
{
assert(into && from);
memcpy(into,from,sizeof(crypto_digest_env_t));
@@ -883,7 +886,6 @@
static BIGNUM *dh_param_p = NULL;
static BIGNUM *dh_param_g = NULL;
-
static void init_dh_param() {
BIGNUM *p, *g;
int r;
Index: crypto.h
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- crypto.h 16 Dec 2003 05:29:04 -0000 1.24
+++ crypto.h 16 Dec 2003 05:47:21 -0000 1.25
@@ -102,12 +102,12 @@
crypto_digest_env_t *crypto_new_digest_env(int type);
void crypto_digest_free(crypto_digest_env_t *digest);
void crypto_digest_add_bytes(crypto_digest_env_t *digest, const char *data,
- size_t len);
+ size_t len);
void crypto_digest_get_digest(crypto_digest_env_t *digest,
- char *out, size_t out_len);
-crypto_digest_env_t *crypto_digest_copy(const crypto_digest_env_t *digest);
+ char *out, size_t out_len);
+crypto_digest_env_t *crypto_digest_dup(const crypto_digest_env_t *digest);
void crypto_digest_assign(crypto_digest_env_t *into,
- const crypto_digest_env_t *from);
+ const crypto_digest_env_t *from);
/* random numbers */
int crypto_seed_rng();
More information about the tor-commits
mailing list