summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
AgeCommit message (Collapse)Author
2015-08-12Add crypto_rand_unmocked, which is crypto_rand without mocking.Yawning Angel
There is odd issues with calling crypto_rand from our copy of ed25519-donna, due to mocking that are not easily resolved.
2015-07-31Move formatting functions around.Nick Mathewson
The base64 and base32 functions used to be in crypto.c; crypto_format.h had no header; some general-purpose functions were in crypto_curve25519.c. This patch makes a {crypto,util}_format.[ch], and puts more functions there. Small modules are beautiful!
2015-07-06Integrate and enable ed25519-donna.Yawning Angel
The runtime sanity checking is slightly different from the optimized basepoint stuff in that it uses a given implementation's self tests if available, and checks if signing/verification works with a test vector from the IETF EdDSA draft. The unit tests include a new testcase that will fuzz donna against ref0, including the blinding and curve25519 key conversion routines. If this is something that should be done at runtime (No?), the code can be stolen from there. Note: Integrating batch verification is not done yet.
2015-07-06Integrate the accelerated Curve25519 scalar basemult.Yawning Angel
Integration work scavanged from nickm's `ticket8897_9663_v2` branch, with minor modifications. Tor will still sanity check the output but now also attempts to catch extreme breakage by spot checking the optimized implementation vs known values from the NaCl documentation. Implements feature 9663.
2015-06-29More tweaks for windows compilation. (ick)Nick Mathewson
2015-06-29Remove checks for visual C 6.Nick Mathewson
2015-05-28Add assertions to crypto_dh_dup()Nick Mathewson
Without these, coverity is annoyed that aren't checking for NULL in bench.c CID 1293335 -- found by coverity.
2015-05-28Merge branch '12498_ed25519_keys_v6'Nick Mathewson
Fixed numerous conflicts, and ported code to use new base64 api.
2015-05-28Note some functions that should move or be mergedNick Mathewson
2015-05-28Implement proposal 228: cross-certification with onion keysNick Mathewson
Routers now use TAP and ntor onion keys to sign their identity keys, and put these signatures in their descriptors. That allows other parties to be confident that the onion keys are indeed controlled by the router that generated the descriptor.
2015-05-28Implement ed25519-signed descriptorsNick Mathewson
Now that we have ed25519 keys, we can sign descriptors with them and check those signatures as documented in proposal 220.
2015-05-21Generate error ASAP if building with too-old opensslNick Mathewson
2015-05-20Merge branch 'bug16034_no_more_openssl_098_squashed'Nick Mathewson
Conflicts: src/test/testing_common.c
2015-05-20Now that OpenSSL 0.9.8 is dead, crypto_seed_rng() needs no argsNick Mathewson
It needed an argument before because it wasn't safe to call RAND_poll() on openssl 0.9.8c if you had already opened more fds than would fit in fd_set.
2015-05-20Remove code to support OpenSSL 0.9.8Nick Mathewson
2015-05-13ERR_remove_state() is deprecated since OpenSSL 1.0.0.Yawning Angel
OpenSSL 1.1.0 must be built with "enable-deprecated", and compiled with `OPENSSL_USE_DEPRECATED` for this to work, so instead, use the newer routine as appropriate.
2015-04-28Add "ADD_ONION"/"DEL_ONION" and "GETINFO onions/*" to the controller.Yawning Angel
These commands allow for the creation and management of ephemeral Onion ("Hidden") services that are either bound to the lifetime of the originating control connection, or optionally the lifetime of the tor instance. Implements #6411.
2015-04-23Fix some RNG function issuesNick Mathewson
2015-04-23whitespace fixesNick Mathewson
2015-04-23Fix some conversion problemsNick Mathewson
2015-04-23Merge remote-tracking branch 'public/bug15745_027_03'Nick Mathewson
2015-04-23Fix some implicit conversion warningsNick Mathewson
2015-04-23Use a custom Base64 encoder with more control over the output format.Yawning Angel
2015-04-21Make the crypto_rand_int_range return value right-exclusive.Nick Mathewson
2015-04-21Add crypto_rand_int_range() and use itDavid Goulet
Incidently, this fixes a bug where the maximum value was never used when only using crypto_rand_int(). For instance this example below in rendservice.c never gets to INTRO_POINT_LIFETIME_MAX_SECONDS. int intro_point_lifetime_seconds = INTRO_POINT_LIFETIME_MIN_SECONDS + crypto_rand_int(INTRO_POINT_LIFETIME_MAX_SECONDS - INTRO_POINT_LIFETIME_MIN_SECONDS); Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-10Remove `USE_OPENSSL_BASE64` and the associated code.Yawning Angel
The alternative has been available since 2007, there's no way to actually enable the ifdef, and it breaks on well formed but not OpenSSL style inputs.
2015-04-01Merge branch 'bug13736'Nick Mathewson
2015-04-01Unindent a block in crypto_set_tls_dh_primeNick Mathewson
2015-03-14Remove relative paths to header files.cypherpunks
The paths are already in the directory search path of the compiler therefore no need to include them in the source code.
2015-03-14Remove DynamicDHGroups as obsoleted by PluggableTransports or P256.Nick Mathewson
Closes ticket 13736.
2015-01-28Try to work around changes in openssl 1.1.0Nick Mathewson
Prefer not to use a couple of deprecated functions; include more headers in tortls.c This is part of ticket 14188.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-22Merge remote-tracking branch 'origin/maint-0.2.5'Nick Mathewson
2014-12-22Merge remote-tracking branch 'public/bug14013_024' into maint-0.2.5Nick Mathewson
2014-12-22When decoding a base-{16,32,64} value, clear the target buffer firstNick Mathewson
This is a good idea in case the caller stupidly doesn't check the return value from baseX_decode(), and as a workaround for the current inconsistent API of base16_decode. Prevents any fallout from bug 14013.
2014-12-02Constify crypto_pk_get_digest().George Kadianakis
2014-11-09Downgrade RSA signature verification failure error message to info loglevel.rl1987
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-10-20Memwipe more keys after tor has finished with themteor
Ensure we securely wipe keys from memory after crypto_digest_get_digest and init_curve25519_keypair_from_file have finished using them. Fixes bug 13477.
2014-10-09Merge remote-tracking branch 'public/bug10816'Nick Mathewson
2014-08-29Drop check for NTE_BAD_KEYSET errorNick Mathewson
Any error when acquiring the CryptoAPI context should get treated as bad. Also, this one can't happen for the arguments we're giving. Fixes bug 10816; bugfix on 0.0.2pre26.
2014-08-28Move secret-to-key functionality into a separate moduleNick Mathewson
I'm about to add more of these, so we might as well trudge forward.
2014-08-28Rename secret_to_key to secret_to_key_rfc2440Nick Mathewson
2014-08-13Apply coccinelle script to replace malloc(a*b)->calloc(a,b)Nick Mathewson
2014-06-20Thread support is now requiredNick Mathewson
Long ago we supported systems where there was no support for threads, or where the threading library was broken. We shouldn't have do that any more: on every OS that matters, threads exist, and the OS supports running threads across multiple CPUs. This resolves tickets 9495 and 12439. It's a prerequisite to making our workqueue code work better, since sensible workqueue implementations don't split across multiple processes.
2014-04-16Make sure everything using an interned string is preceded by a logNick Mathewson
(It's nice to know what we were about to rename before we died from renaming it.)
2014-03-25Fix warnings from doxygenNick Mathewson
Most of these are simple. The only nontrivial part is that our pattern for using ENUM_BF was confusing doxygen by making declarations that didn't look like declarations.
2014-03-23Never run crypto_early_init() more than onceRoger Dingledine
Previously we had set up all the infrastructure to avoid calling it after the first time, but didn't actually use it.
2014-03-23whitespace fixRoger Dingledine
2014-02-28Write hashed bridge fingerprint to logs and to disk.Karsten Loesing
Implements #10884.