diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-01-13 21:09:40 -0800 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-01-15 13:11:44 -0500 |
commit | 7ea674e0e0dfa982ae901450d4e16371aad0def8 (patch) | |
tree | 63422ad0e4028270a189005578ad7f214299d00a /src/common/crypto.c | |
parent | 60fa447afa22ac09d3b0ba44a7af343d9a42a5fa (diff) | |
download | tor-7ea674e0e0dfa982ae901450d4e16371aad0def8.tar.gz tor-7ea674e0e0dfa982ae901450d4e16371aad0def8.zip |
Remove some unnecessary occurrences of +1.
I dug through the OpenSSL source and verified that RSA_private_decrypt will
not write more than RSA_size(key) bytes to its output buffer.
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r-- | src/common/crypto.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 15b58188ed..127224d549 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -923,7 +923,7 @@ crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const char *data, log_warn(LD_BUG, "couldn't compute digest"); return -1; } - buflen = crypto_pk_keysize(env)+1; + buflen = crypto_pk_keysize(env); buf = tor_malloc(buflen); r = crypto_pk_public_checksig(env,buf,buflen,sig,siglen); if (r != DIGEST_LEN) { @@ -1108,8 +1108,8 @@ crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env, warnOnFailure); } - buf = tor_malloc(pkeylen+1); - outlen = crypto_pk_private_decrypt(env,buf,pkeylen+1,from,pkeylen,padding, + buf = tor_malloc(pkeylen); + outlen = crypto_pk_private_decrypt(env,buf,pkeylen,from,pkeylen,padding, warnOnFailure); if (outlen<0) { log_fn(warnOnFailure?LOG_WARN:LOG_DEBUG, LD_CRYPTO, @@ -2659,4 +2659,3 @@ setup_openssl_threading(void) return 0; } #endif - |