summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
AgeCommit message (Collapse)Author
2012-06-05Fix "make check-spaces" issuesNick Mathewson
2012-06-04Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson
2012-06-04Add about 60 more DOCDOC comments to 0.2.3Nick Mathewson
Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together.
2012-05-30Fix clang 3.1 compile warning in crypto.cSebastian Hahn
(Tweaked by nickm)
2012-05-14Bump _WIN32_WINNT to 0x0501 throughout the codeNick Mathewson
This tells the windows headers to give us definitions that didn't exist before XP -- like the ones that we need for IPv6 support. See bug #5861. We didn't run into this issue with mingw, since mingw doesn't respect _WIN32_WINNT as well as it should for some of its definitions.
2012-05-14Remove all instances of WIN32_WINNT (without leading _)Nick Mathewson
We started adding it in 59e2c77824840f back in 2004, 8 years and 3 days ago. It's time to deprogram ourselves from this cargo cult.
2012-04-18Remove needless check for a buffer that could not be NULL.Nick Mathewson
Fixes coverity CID 508: coverity scan doesn't like checking a variable for non-NULL after it has been definitely dereferenced. This should take us back down to zero coverity issues.
2012-03-30Remove a couple redundant NULL-checks before crypto_cipher_freeNick Mathewson
Calling crypto_cipher_free(NULL) is always safe, since (by convention) all of our xyz_free() functions treat xyz_free(NULL) as a no-op. Flagged by coverity scan; fixes CID 508 and 509.
2012-03-27Excise PK_NO_PADDING entirely: Unpadded RSA is silly.Nick Mathewson
We never use it, so having it around is pointless. Suggested by Sebastian
2012-03-27Refactor the API for setting up a block cipher.Nick Mathewson
It allows us more flexibility on the backend if the user needs to specify the key and IV at setup time.
2012-03-27Remove support for PK_NO_PADDING in crypto_pk_public_hybrid_encryptNick Mathewson
We never use it, and it would be a stupid thing if we started using it.
2012-02-20Fix crypto_hmac_sha256 documentation commentRobert Ransom
2012-01-31Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32Nick Mathewson
This commit is completely mechanical; I used this perl script to make it: #!/usr/bin/perl -w -i.bak -p if (/^\s*\#/) { s/MS_WINDOWS/_WIN32/g; s/\bWIN32\b/_WIN32/g; }
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