Loading src/common/crypto.c +24 −23 Original line number Diff line number Diff line Loading @@ -66,8 +66,8 @@ struct crypto_cipher_env_t static INLINE int crypto_cipher_iv_length(int type) { /* printf("%d -> %d IV\n",type, EVP_CIPHER_iv_length( crypto_cipher_evp_cipher(type,0))); printf("%d -> %d IV\n",type, EVP_CIPHER_iv_length(crypto_cipher_evp_cipher(type,0))); */ switch(type) { Loading @@ -83,8 +83,8 @@ crypto_cipher_iv_length(int type) { static INLINE int crypto_cipher_key_length(int type) { /* printf("%d -> %d\n",type, EVP_CIPHER_key_length( crypto_cipher_evp_cipher(type,0))); printf("%d -> %d\n",type, EVP_CIPHER_key_length(crypto_cipher_evp_cipher(type,0))); */ switch(type) { Loading Loading @@ -830,7 +830,7 @@ struct crypto_digest_env_t { }; crypto_digest_env_t * crypto_digest_new_env(int type) crypto_new_digest_env(int type) { crypto_digest_env_t *r; assert(type == CRYPTO_SHA1_DIGEST); Loading @@ -840,7 +840,7 @@ crypto_digest_new_env(int type) } void crypto_digest_free(crypto_digest_env_t *digest) { crypto_free_digest_env(crypto_digest_env_t *digest) { assert(digest); tor_free(digest); } Loading Loading @@ -997,6 +997,7 @@ int crypto_dh_compute_secret(crypto_dh_env_t *dh, goto error; secret_tmp = tor_malloc(crypto_dh_get_bytes(dh)+1); secret_len = DH_compute_key(secret_tmp, pubkey_bn, dh->dh); assert(secret_len == crypto_dh_get_bytes(dh)); for (i = 0; i < secret_bytes_out; i += 20) { secret_tmp[secret_len] = (unsigned char) i/20; if (crypto_SHA_digest(secret_tmp, secret_len+1, hash)) Loading src/common/crypto.h +2 −2 Original line number Diff line number Diff line Loading @@ -99,8 +99,8 @@ crypto_cipher_env_t *crypto_create_init_cipher(int cipher_type, char *key, char /* SHA-1 */ int crypto_SHA_digest(const unsigned char *m, int len, unsigned char *digest); crypto_digest_env_t *crypto_new_digest_env(int type); void crypto_digest_free(crypto_digest_env_t *digest); crypto_digest_env_t *crypto_digest_new_env(int type); void crypto_free_digest_env(crypto_digest_env_t *digest); void crypto_digest_add_bytes(crypto_digest_env_t *digest, const char *data, size_t len); void crypto_digest_get_digest(crypto_digest_env_t *digest, Loading Loading
src/common/crypto.c +24 −23 Original line number Diff line number Diff line Loading @@ -66,8 +66,8 @@ struct crypto_cipher_env_t static INLINE int crypto_cipher_iv_length(int type) { /* printf("%d -> %d IV\n",type, EVP_CIPHER_iv_length( crypto_cipher_evp_cipher(type,0))); printf("%d -> %d IV\n",type, EVP_CIPHER_iv_length(crypto_cipher_evp_cipher(type,0))); */ switch(type) { Loading @@ -83,8 +83,8 @@ crypto_cipher_iv_length(int type) { static INLINE int crypto_cipher_key_length(int type) { /* printf("%d -> %d\n",type, EVP_CIPHER_key_length( crypto_cipher_evp_cipher(type,0))); printf("%d -> %d\n",type, EVP_CIPHER_key_length(crypto_cipher_evp_cipher(type,0))); */ switch(type) { Loading Loading @@ -830,7 +830,7 @@ struct crypto_digest_env_t { }; crypto_digest_env_t * crypto_digest_new_env(int type) crypto_new_digest_env(int type) { crypto_digest_env_t *r; assert(type == CRYPTO_SHA1_DIGEST); Loading @@ -840,7 +840,7 @@ crypto_digest_new_env(int type) } void crypto_digest_free(crypto_digest_env_t *digest) { crypto_free_digest_env(crypto_digest_env_t *digest) { assert(digest); tor_free(digest); } Loading Loading @@ -997,6 +997,7 @@ int crypto_dh_compute_secret(crypto_dh_env_t *dh, goto error; secret_tmp = tor_malloc(crypto_dh_get_bytes(dh)+1); secret_len = DH_compute_key(secret_tmp, pubkey_bn, dh->dh); assert(secret_len == crypto_dh_get_bytes(dh)); for (i = 0; i < secret_bytes_out; i += 20) { secret_tmp[secret_len] = (unsigned char) i/20; if (crypto_SHA_digest(secret_tmp, secret_len+1, hash)) Loading
src/common/crypto.h +2 −2 Original line number Diff line number Diff line Loading @@ -99,8 +99,8 @@ crypto_cipher_env_t *crypto_create_init_cipher(int cipher_type, char *key, char /* SHA-1 */ int crypto_SHA_digest(const unsigned char *m, int len, unsigned char *digest); crypto_digest_env_t *crypto_new_digest_env(int type); void crypto_digest_free(crypto_digest_env_t *digest); crypto_digest_env_t *crypto_digest_new_env(int type); void crypto_free_digest_env(crypto_digest_env_t *digest); void crypto_digest_add_bytes(crypto_digest_env_t *digest, const char *data, size_t len); void crypto_digest_get_digest(crypto_digest_env_t *digest, Loading