Commit Graph
100 Commits
Author SHA1 Message Date
moneromooo-monero 7e7b1a8252 Revert "return subaddress in get_bulk_payments"
This reverts commit b60f48f0e3.
2017-12-25 20:04:40 +00:00
moneromooo-monero 5ad312a1c3 wallet2: switch to chacha20 instead of chacha8
Wallet caches and keys files are loaded with chacha8 as needed,
but only saved with chacha20. Other data (eg, cold wallet data
files, etc) will be incompatible.
2017-12-25 19:28:06 +00:00
moneromooo-monero 1e5491e942 Add a chacha20 variant to go with chacha8 2017-12-25 19:28:03 +00:00
moneromooo-monero bd1f6029a3 http_client: rewrite header parsing manually for speed
boost::regex is stupendously atrocious at parsing malformed data
2017-12-23 11:29:58 +00:00
moneromooo-monero ec724eb64a tests: add levin fuzz test 2017-12-23 11:29:55 +00:00
moneromooo-monero f1bdc9a42a tests: add http client fuzz test 2017-12-23 11:29:52 +00:00
moneromooo-monero 0272df9e61 add parse_url fuzz test 2017-12-23 11:29:49 +00:00
moneromooo-monero 261b0dd0e0 tests: add base58 fuzz test 2017-12-23 11:27:45 +00:00
moneromooo-monero fd05208762 fuzz_testing: allow automatically resuming an interrupted job 2017-12-23 11:27:42 +00:00
moneromooo-monero c80bb0eb6f tests: don't init stuff we don't need in fuzz tests - faster 2017-12-23 11:27:40 +00:00
moneromooo-monero 53b83a83fc tests: better load-from-binary fuzz test data file
Looks like there's some kind of header/signature
2017-12-23 11:27:37 +00:00
moneromooo-monero 1a379ef656 fuzz_testing: build with ASAN (assumed to be available) 2017-12-23 11:27:34 +00:00
moneromooo-monero 4cd4a4313d fuzz_testing: create out directory if needed, and fix filename passing 2017-12-23 11:27:31 +00:00
moneromooo-monero c27d909239 Makefile: build fuzz tests statically, starts faster 2017-12-23 11:27:28 +00:00
moneromooo-monero 95aa0bf79b add load_from_binary/load_from_json fuzzers 2017-12-23 11:27:25 +00:00
moneromooo-monero 6c94516fb4 wipeable_string: move a wipe from reserve to grow
That way, all implicit wipes ends up in grow, which is more robust
2017-12-19 14:06:42 +00:00
moneromooo-monero 5f801b6adf wipeable_string: ignore reserve size less than actual size
This was asserting, but stoffu pointed out the std::string standard
considers this ok and ignorable
2017-12-19 14:00:41 +00:00
moneromooo-monero 9ec44a2b06 wipeable_string: fix clear and push_back 2017-12-19 11:55:45 +00:00
moneromooo-monero bd5cce07b3 network_throttle: fix ineffective locking 2017-12-18 15:16:11 +00:00
moneromooo-monero e0a61299fb network_throttle: remove unused xxx static member 2017-12-18 15:16:09 +00:00
moneromooo-monero 24f584d90d cryptonote_core: remove unused functions with off by one bugs 2017-12-18 15:16:06 +00:00
moneromooo-monero b1634aa3e8 blockchain: don't leave dangling pointers in this 2017-12-18 15:16:03 +00:00
moneromooo-monero 8e60b81c48 cryptonote_core: fix db leak on error 2017-12-18 15:16:00 +00:00
moneromooo-monero 213e326cc9 abstract_tcp_server2: log init_server errors as fatal
so they show up by default
2017-12-18 15:15:57 +00:00
moneromooo-monero b51dc56687 use const refs in for loops for non tiny types 2017-12-18 15:15:54 +00:00
moneromooo-monero f0568ca6ac net_parse_helpers: fix regex error checking 2017-12-18 15:15:52 +00:00
moneromooo-monero b49ddc766d check accessing an element past the end of a container 2017-12-18 15:15:49 +00:00
moneromooo-monero 2305bf260d check return value for generate_key_derivation and derive_public_key 2017-12-18 15:15:46 +00:00
moneromooo-monero a4240d9ffc catch const exceptions 2017-12-18 15:15:43 +00:00
moneromooo-monero 45a1c4c088 add empty container sanity checks when using front() and back() 2017-12-18 15:15:40 +00:00
moneromooo-monero 56fa6ce15f tests: fix a buffer overread in a unit test
and remove a leftover debugging sanity check
2017-12-18 15:15:37 +00:00
moneromooo-monero b4524892fb rpc: guard against json parsing a non object 2017-12-18 15:15:32 +00:00
moneromooo-monero c2ed8618e4 easylogging++: avoid buffer underflow 2017-12-18 15:15:29 +00:00
moneromooo-monero 187a6ab2d2 epee: trap failure to parse URI from request 2017-12-18 15:15:26 +00:00
moneromooo-monero 061789b5dd checkpoints: trap failure to load JSON checkpoints 2017-12-18 15:15:23 +00:00
moneromooo-monero ba2fefb9a4 checkpoints: pass std::string by const ref, not const value 2017-12-18 15:15:19 +00:00
moneromooo-monero 38c8f4e0a3 mlog: terminate a string at last char, just in case 2017-12-18 15:15:16 +00:00
moneromooo-monero d753d716a6 fix a few leaks by throwing objects, not newed pointers to objects 2017-12-18 15:15:13 +00:00
moneromooo-monero fe568db83d p2p: use size_t for arbitrary counters instead of uint8_t 2017-12-18 15:15:10 +00:00
moneromooo-monero 46d6fa35c9 cryptonote_protocol: sanity check chain hashes from peer 2017-12-18 15:15:07 +00:00
moneromooo-monero 25584f8639 cryptonote_protocol: print peer versions when unexpected
also avoid integer underflow on zero height
2017-12-18 15:15:05 +00:00
moneromooo-monero 490a5d41ca rpc: do not try to use an invalid txid in relay_tx 2017-12-18 15:15:01 +00:00
moneromooo-monero d9b137f161 cryptonote_core: fix blockchain init call after prototype change 2017-12-17 18:47:46 +00:00
moneromooo-monero ceabc4f92b change the N-1/N multisig second message signer for auth 2017-12-17 16:12:50 +00:00
moneromooo-monero 55c2845d1a core_tests: multisig test now tests multiple inputs 2017-12-17 16:12:47 +00:00
moneromooo-monero 98db7ee467 wallet: factor multisig info parsing 2017-12-17 16:12:44 +00:00
moneromooo-monero 31a97e761e wallet: use raw encrypted data in multisig import/export RPC 2017-12-17 16:12:41 +00:00
moneromooo-monero 2fa707d1a5 wallet: add multisig sign/submit RPC 2017-12-17 16:12:35 +00:00
moneromooo-monero e36f5b6021 Match surae's recommendation to derive multisig keys 2017-12-17 16:12:32 +00:00
moneromooo-monero a36c261d7a wallet2: fix slow multisig unit tests with subaddress patch
While there, move the wallet2 ctor to the cpp file as it's a huge
amount of init list now, and remove an unused one.
2017-12-17 16:12:30 +00:00
moneromooo-monero fa5697127f make multisig work with subaddresses
Thanks to kenshi84 for help getting this work
2017-12-17 16:12:27 +00:00
moneromooo-monero dffa0dceaf simplewallet: add export_raw_multisig command
It exports raw transactions, so they may be used by other tools,
for instance to be relayed to the network externally.
2017-12-17 16:12:24 +00:00
moneromooo-monero 7f4c220b70 simplewallet: add multisig to wallet type in wallet_info output 2017-12-17 16:12:21 +00:00
moneromooo-monero 265290388b wallet: guard against partly initialized multisig wallet 2017-12-17 16:12:18 +00:00
moneromooo-monero 66e34e85b1 add multisig core test and factor multisig building blocks 2017-12-17 16:12:15 +00:00
moneromooo-monero f4eda44ce3 N-1/N multisig 2017-12-17 16:12:12 +00:00
moneromooo-monero cd64c7990c multisig address generation RPC 2017-12-17 16:12:09 +00:00
moneromooo-monero fff871a455 gen_multisig: generates multisig wallets if participants trust each other 2017-12-17 16:12:06 +00:00
moneromooo-monero 95a21a793d wallet2: allow empty wallet filename to avoid saving data
Useful to speed tests up and avoid unnecessary leftover files
2017-12-17 16:12:03 +00:00
moneromooo-monero b84b3565f3 tests: add multisig unit tests 2017-12-17 16:12:00 +00:00
moneromooo-monero 4c313324b1 Add N/N multisig tx generation and signing
Scheme by luigi1111:

    Multisig for RingCT on Monero

    2 of 2

    User A (coordinator):
    Spendkey b,B
    Viewkey a,A (shared)

    User B:
    Spendkey c,C
    Viewkey a,A (shared)

    Public Address: C+B, A

    Both have their own watch only wallet via C+B, a

    A will coordinate spending process (though B could easily as well, coordinator is more needed for more participants)

    A and B watch for incoming outputs

    B creates "half" key images for discovered output D:
    I2_D = (Hs(aR)+c) * Hp(D)

    B also creates 1.5 random keypairs (one scalar and 2 pubkeys; one on base G and one on base Hp(D)) for each output, storing the scalar(k) (linked to D),
    and sending the pubkeys with I2_D.

    A also creates "half" key images:
    I1_D = (Hs(aR)+b) * Hp(D)

    Then I_D = I1_D + I2_D

    Having I_D allows A to check spent status of course, but more importantly allows A to actually build a transaction prefix (and thus transaction).

    A builds the transaction until most of the way through MLSAG_Gen, adding the 2 pubkeys (per input) provided with I2_D
    to his own generated ones where they are needed (secret row L, R).

    At this point, A has a mostly completed transaction (but with an invalid/incomplete signature). A sends over the tx and includes r,
    which allows B (with the recipient's address) to verify the destination and amount (by reconstructing the stealth address and decoding ecdhInfo).

    B then finishes the signature by computing ss[secret_index][0] = ss[secret_index][0] + k - cc[secret_index]*c (secret indices need to be passed as well).

    B can then broadcast the tx, or send it back to A for broadcasting. Once B has completed the signing (and verified the tx to be valid), he can add the full I_D
    to his cache, allowing him to verify spent status as well.

    NOTE:
    A and B *must* present key A and B to each other with a valid signature proving they know a and b respectively.
    Otherwise, trickery like the following becomes possible:
    A creates viewkey a,A, spendkey b,B, and sends a,A,B to B.
    B creates a fake key C = zG - B. B sends C back to A.
    The combined spendkey C+B then equals zG, allowing B to spend funds at any time!
    The signature fixes this, because B does not know a c corresponding to C (and thus can't produce a signature).

    2 of 3

    User A (coordinator)
    Shared viewkey a,A
    "spendkey" j,J

    User B
    "spendkey" k,K

    User C
    "spendkey" m,M

    A collects K and M from B and C
    B collects J and M from A and C
    C collects J and K from A and B

    A computes N = nG, n = Hs(jK)
    A computes O = oG, o = Hs(jM)

    B anc C compute P = pG, p = Hs(kM) || Hs(mK)
    B and C can also compute N and O respectively if they wish to be able to coordinate

    Address: N+O+P, A

    The rest follows as above. The coordinator possesses 2 of 3 needed keys; he can get the other
    needed part of the signature/key images from either of the other two.

    Alternatively, if secure communication exists between parties:
    A gives j to B
    B gives k to C
    C gives m to A

    Address: J+K+M, A

    3 of 3

    Identical to 2 of 2, except the coordinator must collect the key images from both of the others.
    The transaction must also be passed an additional hop: A -> B -> C (or A -> C -> B), who can then broadcast it
    or send it back to A.

    N-1 of N

    Generally the same as 2 of 3, except participants need to be arranged in a ring to pass their keys around
    (using either the secure or insecure method).
    For example (ignoring viewkey so letters line up):
    [4 of 5]
    User: spendkey
    A: a
    B: b
    C: c
    D: d
    E: e

    a -> B, b -> C, c -> D, d -> E, e -> A

    Order of signing does not matter, it just must reach n-1 users. A "remaining keys" list must be passed around with
    the transaction so the signers know if they should use 1 or both keys.
    Collecting key image parts becomes a little messy, but basically every wallet sends over both of their parts with a tag for each.
    Thia way the coordinating wallet can keep track of which images have been added and which wallet they come from. Reasoning:
    1. The key images must be added only once (coordinator will get key images for key a from both A and B, he must add only one to get the proper key actual key image)
    2. The coordinator must keep track of which helper pubkeys came from which wallet (discussed in 2 of 2 section). The coordinator
    must choose only one set to use, then include his choice in the "remaining keys" list so the other wallets know which of their keys to use.

    You can generalize it further to N-2 of N or even M of N, but I'm not sure there's legitimate demand to justify the complexity. It might
    also be straightforward enough to support with minimal changes from N-1 format.
    You basically just give each user additional keys for each additional "-1" you desire. N-2 would be 3 keys per user, N-3 4 keys, etc.

The process is somewhat cumbersome:

To create a N/N multisig wallet:

 - each participant creates a normal wallet
 - each participant runs "prepare_multisig", and sends the resulting string to every other participant
 - each participant runs "make_multisig N A B C D...", with N being the threshold and A B C D... being the strings received from other participants (the threshold must currently equal N)

As txes are received, participants' wallets will need to synchronize so that those new outputs may be spent:

 - each participant runs "export_multisig FILENAME", and sends the FILENAME file to every other participant
 - each participant runs "import_multisig A B C D...", with A B C D... being the filenames received from other participants

Then, a transaction may be initiated:

 - one of the participants runs "transfer ADDRESS AMOUNT"
 - this partly signed transaction will be written to the "multisig_monero_tx" file
 - the initiator sends this file to another participant
 - that other participant runs "sign_multisig multisig_monero_tx"
 - the resulting transaction is written to the "multisig_monero_tx" file again
 - if the threshold was not reached, the file must be sent to another participant, until enough have signed
 - the last participant to sign runs "submit_multisig multisig_monero_tx" to relay the transaction to the Monero network
2017-12-17 16:11:57 +00:00
moneromooo-monero 6d219a9250 wallet: add multisig key generation
Scheme by luigi1111
2017-12-17 16:11:53 +00:00
moneromooo-monero 43f5269f84 Wallets now do not depend on the daemon rpc lib
The shared RPC code is now moved off into a separate lib
2017-12-16 23:28:59 +00:00
moneromooo-monero bb89ae8b20 move connection_basic and network_throttle from src/p2p to epee
These even had the epee namespace.
This fixes some ugly circular dependencies.
2017-12-16 23:28:43 +00:00
moneromooo-monero 4abf25f3c9 cryptonote_core does not depend on p2p anymore
As a followon side effect, this makes a lot of inline code
included only in particular cpp files (and instanciated
when necessary.
2017-12-16 23:28:38 +00:00
moneromooo-monero 09ce03d612 move includes around to lessen overall load 2017-12-16 22:46:38 +00:00
moneromooo-moneroandJonathan Roelofs 7193b89fe5 Scrub keys from memory just before scope end.
Partially implements #74.

Securely erases keys from memory after they are no longer needed. Might have a
performance impact, which I haven't measured (perf measurements aren't
generally reliable on laptops).

Thanks to @stoffu for the suggestion to specialize the pod_to_hex/hex_to_pod
functions. Using overloads + SFINAE instead generalizes it so other types can
be marked as scrubbed without adding more boilerplate.
2017-12-16 15:40:33 -07:00
moneromooo-monero aaae94f00b wallet2: reinstate the single preferred output selection
Removing it nullified the min-outputs-{count,value} system,
and will not increase the number of attempted transactions
in the general case.
2017-12-16 12:31:03 +00:00
moneromooo-monero cb9aa23cc5 levin_protocol_handler_async: another attempt at fixing at exception 2017-12-15 18:38:53 +00:00
moneromooo-monero 64d23ce331 Revert "epee: keep a ref to a connection we're deleting"
This reverts commit f2939bdce8.
2017-12-15 13:23:21 +00:00
moneromooo-monero 043494924b wallet2: error out in get_seed if the language is invalid 2017-12-15 11:01:14 +00:00
moneromooo-monero 7f4bb612fb levin_protocol_handler_async: add missing response handler locking 2017-12-15 10:47:45 +00:00
moneromooo-monero ae55bacd8c resumption support for updates using range requests 2017-12-15 10:46:23 +00:00
moneromooo-monero fe0fae5089 epee: add a get_file_size function 2017-12-15 10:32:36 +00:00
moneromooo-monero d28c388f88 p2p: stop net server before closing starting connections
This fixes a hang on exit due to race where a connection adds
itself to the server after the starting connections are closed,
but before the net server marks itself as stopped.
2017-12-15 10:31:12 +00:00
moneromooo-monero a1d44f2746 updates: use https for updates 2017-12-14 13:33:06 +00:00
moneromooo-monero 472a93c83a download: SSL suport 2017-12-14 09:12:58 +00:00
moneromooo-monero f5bc7f1855 simplewallet: fix default unspent_outputs output with subaddresses
If no subaddress index is given, consider all of them
2017-12-13 10:09:42 +00:00
moneromooo-monero dba2de61e7 levin_protocol_handler_async: call handler destroy function on dtor 2017-12-11 18:33:37 +00:00
moneromooo-monero 27aa8ce95b net_utils_base: fix peer list parsing
Fields are written with their "name" as key, and that name changed.
2017-12-09 22:16:58 +00:00
moneromooo-monero 46eaaae79b ringct: always use outPk.mask to decode amounts 2017-12-09 18:02:55 +00:00
moneromooo-monero 8d4469a0ac ringct: do not include bulletproof commitments in signed message
Those are not serialized, but are restored from the outPk masks,
so depending on what tries to validate the tx, those commitments
may or may not be filled with valid data at the time. The outPk
masks are already hashed as part of the rctSigBase field.
2017-12-09 15:30:15 +00:00
moneromooo-monero 1741fb5f2b node_rpc_proxy: remove unused local and time call 2017-12-09 11:28:18 +00:00
moneromooo-monero ead48f7d92 core: fix input ordering from v7 2017-12-09 11:24:38 +00:00
moneromooo-monero c83d0b3ee2 add bulletproofs from v7 on testnet 2017-12-08 13:50:45 +00:00
moneromooo-monero 8620ef0a0d bulletproofs: switch H/G in Pedersen commitments to match rct
Changes from sarang
2017-12-08 13:48:18 +00:00
moneromooo-monero d58835b2f6 integrate bulletproofs into monero 2017-12-08 13:48:15 +00:00
moneromooo-monero 90b8d9f271 add bulletproofs to the build, with basic unit tests
Based on Java code from Sarang Noether
2017-12-08 13:41:13 +00:00
moneromooo-monero fe1202646c perf_timer: add non scoped start/stop timer defines 2017-12-07 19:23:14 +00:00
moneromooo-monero ada4291469 add a version of ge_double_scalarmult_precomp_vartime with A precomp 2017-12-07 19:23:10 +00:00
moneromooo-monero d43eef6def ringct: add a version of addKeys which returns the result 2017-12-07 19:23:08 +00:00
moneromooo-monero 3d0b54bd01 epee: add do while(0) around brace statement in a macro
Allows use in more complex expressions
2017-12-07 19:23:02 +00:00
moneromooo-monero 3f24e90149 wallet2: don't write a .new file when not needed 2017-12-07 12:07:18 +00:00
moneromooo-monero 83b0f9e6c5 version: add -master to master version
This makes master versions play better with automated update checks
2017-12-07 10:33:12 +00:00
moneromooo-monero 493f7d0974 util: allow non numeric version parts 2017-12-07 10:32:48 +00:00
moneromooo-monero ca18ff644b wallet2: detect spends in txes without a valid public tx key 2017-12-06 15:55:06 +00:00
moneromooo-monero 6afcd8e37d cn_deserialize: print tx extra fields in partly decoded tx extra 2017-12-06 15:54:17 +00:00
moneromooo-monero b927f0b17e cryptonote_protocol: fix corner case looping asking for same block hashes 2017-12-03 13:05:10 +00:00
moneromooo-monero fe5ab2c439 epee: fix kv_unserialize return value when a field is not found 2017-12-01 16:43:57 +00:00
moneromooo-monero abebe392c7 rpc: add offline state in info rpc 2017-11-30 15:44:01 +00:00