[or-cvs] add crypto_cipher_rewind to reverse crypto_cipher_advance

Roger Dingledine arma at seul.org
Tue Dec 23 07:43:07 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:
add crypto_cipher_rewind to reverse crypto_cipher_advance


Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- crypto.c	17 Dec 2003 05:31:52 -0000	1.50
+++ crypto.c	23 Dec 2003 07:43:05 -0000	1.51
@@ -808,6 +808,12 @@
 }
 
 int
+crypto_cipher_rewind(crypto_cipher_env_t *env, long delta)
+{
+  return crypto_cipher_advance(env, -delta);
+}
+
+int
 crypto_cipher_advance(crypto_cipher_env_t *env, long delta)
 {
   if (env->type == CRYPTO_CIPHER_AES_CTR) {
@@ -841,8 +847,8 @@
 
 void
 crypto_free_digest_env(crypto_digest_env_t *digest) {
-  assert(digest);
-  tor_free(digest);
+  if(digest)
+    free(digest);
 }
 
 void

Index: crypto.h
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- crypto.h	17 Dec 2003 05:31:52 -0000	1.27
+++ crypto.h	23 Dec 2003 07:43:05 -0000	1.28
@@ -92,6 +92,7 @@
 int crypto_cipher_decrypt(crypto_cipher_env_t *env, unsigned char *from, unsigned int fromlen, unsigned char *to);
 
 /* only implemented for CRYPTO_CIPHER_AES_CTR */
+int crypto_cipher_rewind(crypto_cipher_env_t *env, long delta);
 int crypto_cipher_advance(crypto_cipher_env_t *env, long delta);
 
 /* convenience function: wraps crypto_create_crypto_env, set_key, set_iv, and init. */



More information about the tor-commits mailing list