summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
AgeCommit message (Collapse)Author
2012-01-18Rename nonconformant identifiers.Nick Mathewson
Fixes bug 4893. These changes are pure mechanical, and were generated with this perl script: /usr/bin/perl -w -i.bak -p s/crypto_pk_env_t/crypto_pk_t/g; s/crypto_dh_env_t/crypto_dh_t/g; s/crypto_cipher_env_t/crypto_cipher_t/g; s/crypto_digest_env_t/crypto_digest_t/g; s/aes_free_cipher/aes_cipher_free/g; s/crypto_free_cipher_env/crypto_cipher_free/g; s/crypto_free_digest_env/crypto_digest_free/g; s/crypto_free_pk_env/crypto_pk_free/g; s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g; s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g; s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g; s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g; s/crypto_new_cipher_env/crypto_cipher_new/g; s/crypto_new_digest_env/crypto_digest_new/g; s/crypto_new_digest256_env/crypto_digest256_new/g; s/crypto_new_pk_env/crypto_pk_new/g; s/crypto_create_crypto_env/crypto_cipher_new/g; s/connection_create_listener/connection_listener_new/g; s/smartlist_create/smartlist_new/g; s/transport_create/transport_new/g;
2012-01-10whitespace and warning fixes for bug4746Nick Mathewson
2012-01-10Merge remote-tracking branch 'asn-mytor/bug4746'Nick Mathewson
2012-01-10Test for broken counter-mode at runtimeNick Mathewson
To solve bug 4779, we want to avoid OpenSSL 1.0.0's counter mode. But Fedora (and maybe others) lie about the actual OpenSSL version, so we can't trust the header to tell us if it's safe. Instead, let's do a run-time test to see whether it's safe, and if not, use our built-in version. fermenthor contributed a pretty essential fixup to this patch. Thanks!
2012-01-10We no longer need to detect openssl without RAND_poll()Nick Mathewson
We require openssl 0.9.7 or later, and RAND_poll() was first added in openssl 0.9.6.
2012-01-10Add macros to construct openssl version numbersNick Mathewson
It's a pain to convert 0x0090813f to and from 0.9.8s-release on the fly, so these macros should help.
2012-01-10Make sure MAX_DNS_LABEL_SIZE is definedSebastian Hahn
MAX_DNS_LABEL_SIZE was only defined for old versions of openssl, which broke the build. Spotted by xiando. Fixes bug 4413; not in any released version.
2012-01-09Tweaks for bug4413 fixNick Mathewson
The thing that's limited to 63 bytes is a "label", not a hostname. Docment input constraints and behavior on bogus inputs. Generally it's better to check for overflow-like conditions before than after. In this case, it's not a true overflow, so we're okay, but let's be consistent. pedantic less->fewer in the documentation
2012-01-09Remove (untriggerable) overflow in crypto_random_hostname()Stephen Palmateer
Fixes bug 4413; bugfix on xxxx. Hostname components cannot be larger than 63 characters. This simple check makes certain randlen cannot overflow rand_bytes_len.
2011-12-19Add an informative header on the 'keys/dynamic_dh_params' file.George Kadianakis
2011-12-12Don't crash on startup of a dormant relayRobert Ransom
If a relay is dormant at startup, it will call init_keys before crypto_set_tls_dh_prime. This is bad. Let's make it not so bad, because someday it *will* happen again.
2011-12-02Work around a false positive in Coverity.Sebastian Hahn
Fixes cid 501 and 502.
2011-11-30Free the global DH parameters in crypto_global_cleanup().George Kadianakis
2011-11-30Move crypto_global_cleanup() to the bottom of crypto.c.George Kadianakis
2011-11-29Merge remote-tracking branch 'asn-mytor/bug4548_take2'Nick Mathewson
2011-11-26Write dynamic DH parameters to a file.George Kadianakis
Instead of only writing the dynamic DH prime modulus to a file, write the whole DH parameters set for forward compatibility. At the moment we only accept '2' as the group generator. The DH parameters gets stored in base64-ed DER format to the 'dynamic_dh_params' file.
2011-11-25Move DH_GENERATOR to crypto.c.George Kadianakis
2011-11-25Move broken primes to dynamic_dh_modulus.broken.George Kadianakis
2011-11-25Do dynamic DH modulus storing in crypto.c.George Kadianakis
2011-11-25Use EVP for AES only when hardware accel is presentNick Mathewson
Fixes bug 4525, fix on 0.2.3.8-alpha.
2011-11-25Finishing touches.George Kadianakis
- Make check-spaces happy. - Remove a stray header from crypto.h
2011-11-25Rename 'dynamic prime' to 'dynamic DH modulus'.George Kadianakis
2011-11-25Notify the user that her computer is generating numbers.George Kadianakis
2011-11-25Make sure that the stored DH prime is safe to use.George Kadianakis
2011-11-24Move crypto_get_stored_dynamic_prime() to crypto.cGeorge Kadianakis
2011-11-24Move store_dynamic_prime() to crypto.c.George Kadianakis
2011-11-24Tone down the logging.George Kadianakis
2011-11-24Implement dynamic prime reading and storing to disk.George Kadianakis
2011-11-24Make DynamicPrimes SIGHUP-able.George Kadianakis
Instead of passing the DynamicPrimes configuration option to crypto_global_init(), generate and set a new TLS DH prime when we read the torrc.
2011-11-24Improve code in the dynamic primes realm.George Kadianakis
2011-11-24Improve logging.George Kadianakis
2011-11-24Make it compile.George Kadianakis
2011-11-24Rename "Rakshasa" to "Dynamic Prime".George Kadianakis
2011-11-24Introduce the DynamicPrimes configuration option.George Kadianakis
2011-11-24Copy/Paste Jake's stuff.George Kadianakis
This commit copies parts of Jake's f3bb6846975193d9a6649c31f94bda47e4014070 commit verbatim to the current master.
2011-11-03Remove some duplicate includesAndrea Gelmini
2011-10-26Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-10-10Remove a no-longer-relevant commentNick Mathewson
2011-10-10Add a sha256 hmac function, with testsNick Mathewson
2011-10-10New function to get all digests of a public keyNick Mathewson
2011-10-06Make internal error check for unrecognized digest algorithm more robustNick Mathewson
Fixes Coverity CID 479.
2011-07-15Make WIN32_WINNT defines conditionalNick Mathewson
Requested by Gisle Vanem on tor-dev. I'm not quite sure this is the right solution, but it's probably harmless.
2011-06-06Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-06-06Check maximum properly in crypto_rand_int()Nick Mathewson
George Kadianakis notes that if you give crypto_rand_int() a value above INT_MAX, it can return a negative number, which is not what the documentation would imply. The simple solution is to assert that the input is in [1,INT_MAX+1]. If in the future we need a random-value function that can return values up to UINT_MAX, we can add one. Fixes bug 3306; bugfix on 0.2.2pre14.
2011-06-03Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-06-03Reject 128-byte keys that are not 1024-bitNick Mathewson
When we added the check for key size, we required that the keys be 128 bytes. But RSA_size (which defers to BN_num_bytes) will return 128 for keys of length 1017..1024. This patch adds a new crypto_pk_num_bits() that returns the actual number of significant bits in the modulus, and uses that to enforce key sizes. Also, credit the original bug3318 in the changes file.
2011-05-16Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-05-16Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
Fixed trivial conflict due to headers moving into their own .h files from or.h. Conflicts: src/or/or.h
2011-05-16squash! Add crypto_pk_check_key_public_exponent functionNick Mathewson
Rename crypto_pk_check_key_public_exponent to crypto_pk_public_exponent_ok: it's nice to name predicates s.t. you can tell how to interpret true and false.
2011-05-16Add crypto_pk_check_key_public_exponent functionRobert Ransom