< fanatid> Hey to all, can somebody explain, why BIP66 not checks that R or S more than 33 bytes (but checks that total length can't be more than 73 bytes)
< fanatid> for example this (in hex) will be valid for BIP66: 3044021458a2f39bd87f0000000506030000000000050603022c402dde9afe7f0000010000000100000004000000040000000000000000000000000000000a00000000000000 but invalid for secp256k1
< sipa> fanatid: it's just a minimal subset of rules that are sufficient to make parsing easy, but don't guarantee that it's valid
< sipa> fanatid: there are more arbitrary restrictions that could have been included
< sipa> fanatid: for example, checking that the R or S integer is less than the secp256k1 curve order (which would rule out some 33-byte values)
< fanatid> I understand that there are not all restrictions, it's just very strange to see that BIP66 checks total length, but not checks r|s length
< sipa> fanatid: or you could go as far as checking that R is a valid secp256k1 X coordinate mod the order
< sipa> fanatid: adding that would not have added anything; the total length check is included because otherwise the rest of the bip66 code would have needed to be able to deal with >1-byte length descriptors
< sipa> in retrospect, maybe we could have added length restrictions
< sipa> but it doesn't matter much, and the rules are as they are
< fanatid> sipa: thank you, can you paste answer in github issue? (or I can do this, if you busy)
< sipa> if we'd change it again, i would argue that signatures have to be valid, or ""; anything else results in a failed script execution
< sipa> and i do plan to propose a 64-byte Schnorr signature based scheme after segwit at some point, but that doesn't affect existing signature parsing of course
< sipa> fanatid: there was some discussion about this precise issue before, i think
< sipa> fanatid: probably on the ML or the BIP pr itself
< GitHub82> [bitcoin] laanwj pushed 2 new commits to master: https://github.com/bitcoin/bitcoin/compare/c946a15075ba...490064111f86
< GitHub82> bitcoin/master bb16c88 João Barbosa: Prevent multiple calls to CWallet::AvailableCoins
< GitHub82> bitcoin/master 4900641 Wladimir J. van der Laan: Merge #7649: Prevent multiple calls to CWallet::AvailableCoins...
< GitHub173> [bitcoin] laanwj closed pull request #7649: Prevent multiple calls to CWallet::AvailableCoins (master...enhancement/prevent-multiple-calls-availablecoins) https://github.com/bitcoin/bitcoin/pull/7649
< wumpus> I'm shocked how many people still use windows xp, and even run bitcoin nodes on it
< ajweutr> I'm shocked how many people still use windows.
< wumpus> well okay but how can you rationalize running internet-connected software on something that will get no security updates anymore
< sipa> running internet-connected *wallet* software
< wumpus> it's like signing a general 'yes I want to be part of your botnet' waiver
< wumpus> well they claim not to use the wallet
< btcdrak> wumpus: there are hundreds of thousands of ATMs around the world still running Windows XP...
< wumpus> absurd
< Luke-Jr> wumpus: as if a node has any value besides security
< wumpus> the thing is, the last thing I want is to discourage people from running a node, but they should also understand that we can't devote much time to supporting a 15 year old OS that was abandoned by the vendor
< sipa> in other news: i now run bitcoin core on my phonr
< sipa> *phone
< btcdrak> wumpus: given that XP has been EOL for years now, should we be supporting it at all? Basically, the OS is insecure.
< btcdrak> sipa: are you using Abcore?
< sipa> btcdrak: yeah
< wumpus> sipa: cool :)
< wumpus> intdrak: I'd expected so, but see the response to the issue where I dare proposing dropping support for windows xp and older: https://github.com/bitcoin/bitcoin/issues/7681
< wumpus> apparently release 0.12.0 is already unstable on wxp, it appears due to some msvcrt.dll issue. If that doesn't get resolved, we have to make it official and drop support for it.
< GitHub103> [bitcoin] laanwj opened pull request #7737: devtools: make github-merge.py use py3 (master...2016_03_python_3_github_merge) https://github.com/bitcoin/bitcoin/pull/7737
< intdrak> wumpus: I dont think the comment in #7681 is true. There is _unofficial support_ from a 3rd party dev called "harkaz". There is no official support for XP, it's EOL.
< wumpus> in any case I didn't even give a date or milestone, and still people reply like that
< wumpus> a third party releasing a service pack? seems legit...
< sipa> wumpus: it's two people...
< wumpus> yeah...
< wumpus> maybe I'm unduly worried, it was more about the speed at which those replies came in, apparently it's another useless thing people feel very strongly about
< wumpus> in any case if anyone actually wants to support bitcoin core on XP, be my guest, you're welcome, but don't simply expect it from others
< intdrak> wumpus: I think your response is reasonable: try to fix it now, and remove support from 0.13 in any case.
< intdrak> and if it cant be fixed, too bad.
< GitHub138> [bitcoin] laanwj pushed 3 new commits to master: https://github.com/bitcoin/bitcoin/compare/490064111f86...909b72b10b4d
< GitHub138> bitcoin/master 5fd2318 fanquake: [Depends] Miniupnpc 1.9.20160209...
< GitHub138> bitcoin/master c85f475 fanquake: [Depends] Latest config.guess & config.sub
< GitHub138> bitcoin/master 909b72b Wladimir J. van der Laan: Merge #7710: [Depends] Bump miniupnpc and config.guess+sub...
< GitHub55> [bitcoin] laanwj closed pull request #7710: [Depends] Bump miniupnpc and config.guess+sub (master...depends-02) https://github.com/bitcoin/bitcoin/pull/7710
< wumpus> right
< GitHub116> [bitcoin] laanwj pushed 3 new commits to master: https://github.com/bitcoin/bitcoin/compare/909b72b10b4d...e2ebd259fbe8
< GitHub116> bitcoin/master fe00ca7 Andrew C: Create generatetoaddress rpc...
< GitHub116> bitcoin/master d5c5c71 Andrew C: RPC tests for generatetoaddress...
< GitHub116> bitcoin/master e2ebd25 Wladimir J. van der Laan: Merge #7671: [RPC] Add generatetoaddress rpc to mine to an address...
< GitHub149> [bitcoin] laanwj closed pull request #7671: [RPC] Add generatetoaddress rpc to mine to an address (master...generate-to-addr) https://github.com/bitcoin/bitcoin/pull/7671
< Luke-Jr> intdrak: is "3rd party unofficial support" significantly different from a Linux distro fork in this regard?
< Luke-Jr> (not that I think we need to support XP. if nobody cares enough to fix it, it can go bye-bye)
< sipa> Luke-Jr: that's a good point
< wumpus> did they legally take over the support from microsoft?
< wumpus> if so, I suppose it's comparable, if not, it's something completely different
< sipa> Luke-Jr: i think that the fact that most of the code is closed source does make a quantitave different, but it's fuzzy
< wumpus> in any case it isn't any reason to influence our decision about supporting it or not
< wumpus> someone needs to step up to support it, if not, it's done
< Luke-Jr> sipa: they can't identify unfixed bugs maybe, but they could in theory backport or identify unbackportable stuff
< Luke-Jr> wumpus: from a security perspective, I don't know why the legalities would matter. but I agree it isn't very relevant.
< wumpus> Luke-Jr: well I think from a security perspective, for a closed source OS, microsoft's blessing is very imporant.
< wumpus> and you can't support a closed source OS if you don't know what is going on behind the scenes, if you don't have access to internal documents and source code etc
< wumpus> you were comparing it to a linux distro fork where everything happens in the open - taking over support for a close source product is very different
< sipa> yeah, i think that in theory you can say that a linux distro without any official support is not different from an unofficially supported windows os
< sipa> but in practice, it's a huge difference; closed source is one, but also the fact that linux distros do more just packaging of work done by other projects
< wumpus> you can't really continue someone elses' development with closed source software... or what, reverse engineer, use a hex editor?
< sipa> windows unsupported probably means that there are components in the OS on which _nobody_ is even working anymore
< wumpus> would you claim that makes *no* difference from a security perspective?
< morcos> wumpus: i'm not going to be around for the meeting tomorrow. but would have been nice if we'd made more progress on our action items for last week.
< morcos> whats the best way to get a few volunteers to review these backports so we can start RC's for the CSV soft fork?
< wumpus> I don't have an answer to that, unfortunately
< wumpus> getting people to review things is very hard
< wumpus> you could try spamming it here a few times, or on twitter, or wherever
< wumpus> ideally, people that care about backports at all would spend work reviewing what is backported to their favorite version
< morcos> i think we should be a bit more willing to ask specific contributors (who would be appropriate for the PR) when its something high priority like this that we all agree is holding up progress (to some degree)
< wumpus> sure, you can always @ people and ping them in the PR
< wumpus> it tends to work
< instagibbs> morcos, asking *specific* people probably works better
< instagibbs> "Someone call 911" vs "You call 911"
< instagibbs> (911 being US emergency number)
< intdrak> luke-jr: sipa: I think it's completely different. MS Windows is closed source, so I'm not sure how he can be providing reliable support - certainly no way to audit it.
< sipa> yes, i agree that in practice is completely different
< sipa> but the criterion is not whether or not there is a official support (because many linux distros have no official support whatsoever), but whether the available support is sufficient
< wumpus> any linux distribution worth its salt at least has security upgrades
< sipa> yes, agree completely - i was just arguing semantics
< sipa> sorry :)
< intdrak> morcos: I have been hassling people in private to do reviews. I'll go bang on a few more doors
< wumpus> as for official support, yea, for Ubuntu, Redhat, etc you can get some kind of support contract, doubt that's possible for the smaller ones
< GitHub144> [bitcoin] laanwj pushed 2 new commits to master: https://github.com/bitcoin/bitcoin/compare/e2ebd259fbe8...3bdc583b3f07
< GitHub144> bitcoin/master 68d4282 Alex Morcos: Fix calculation of balances and available coins....
< GitHub144> bitcoin/master 3bdc583 Wladimir J. van der Laan: Merge #7715: Fix calculation of balances and available coins....
< GitHub191> [bitcoin] laanwj closed pull request #7715: Fix calculation of balances and available coins. (master...fixconflicts_take2) https://github.com/bitcoin/bitcoin/pull/7715
< wumpus> morcos: the other option, of course, is to just start merging stuff :)
< GitHub160> [bitcoin] laanwj pushed 1 new commit to 0.12: https://github.com/bitcoin/bitcoin/commit/19866c1ffcb860bc2980e00e956685b9a8f96529
< GitHub160> bitcoin/0.12 19866c1 Alex Morcos: Fix calculation of balances and available coins....
< intdrak> I would assume the backports are relatively straightforward to review.
< wumpus> if there are to be any bounties in the bitcoin core project ever it'd be for reviewing code, that's by far the most difficult thing to motivate people to do
< btcdrak> Well the PRs people need to review are #7648, #7543 and #7716
< wumpus> some projects have a bot that automatically picks a random reviewer from some list for a PR when it's finished, is that maybe an idea? :p https://github.com/maidsafe/safe_ffi/pull/45
< sipa_> at google there was a policy that you pick an appropriate reviewer yourself
< btcdrak> hrm. offer a bounty and the winner is decided by the the merge commit hash :-P
< sipa_> btcdrak: you can grind commit hashes :p
< wumpus> well for some PRs it's pretty straightforward who should review it, e.g. cfields for build system changes, for others not so much
< wumpus> another option would be to put some time pressure behind it, post a date in the PR, if no comments by then it will be merged as-is
< btcdrak> #7648 is pretty straight forward and it's got lots of RPC tests to verify behaviour.
< sipa_> wumpus: ouch!
< sipa_> (i generally agree that trying to provide fast feedback on PRs is something to aim for... but automatic merging may be a bridge too far)
< wumpus> sipa_: just throwing out ideas I've seen in other projects, not saying it's a good idea :)
< wumpus> it also depends on the kind of change, I tend to merge pure tests changes semi-automatically, obviously we don't want that for consensus changes
< btcdrak> I think the only solution is more staff.
< jonasschnelli> we could incentives reviews by adding btc-micropayment to contributors that commented a tested ACK (<githash> of later merged PR ... :) *duck*
< jonasschnelli> I'm pretty sure we would get a lot of (untested) tested ACKs
< btcdrak> yeah ^
< wumpus> jonasschnelli: yea you'd have to require an extensive testing report in that case, to be sure someone actually did the work
< btcdrak> need some kind of "proof of review, proof of test"
< wumpus> jonasschnelli: and that's probably not as far as people are willing to go for a micropayment :)
< jonasschnelli> wumpus: Right. He needs to calculate a sha256 of the random chosen words of the change source-code. :)
< sipa_> or you could encourage PRs to have a hash of a message that reveals something the author believes a reviewer should notice, and you can get a bounty for correctly finding it
< btcdrak> you'd have to introduce a couple of bugs on purpose to see if people picked up on it to know if they really looked properly
< morcos> i think we should not treat all PR's equally
< morcos> for some PR's the lack of reviewers is the signal as to whether or not its somethign we want to merge
< morcos> but for other PR's we've agreed a priori that we want the functionality or fix and its just a matter of ensuring the code has been reviewed
< morcos> its the second case that i think we need to work on
< wumpus> and on the other side, some people actually do get review comments but then delay indefinitely in taking them into account *cough* rebroad *cough*
< sipax> maybe we should try to have a deadline on concept ack/nacks
< morcos> i know for example that i'll sometimes get caught up in a streak of coding and not doing enough reviewing
< morcos> and i certainly wouldn't mind if there were PR's that were in the second category that i got pinged on if they were in my wheelhouse
< morcos> but what i don't want is every random PR for someone to assign it to me to review
< wumpus> absolutely not all PRs should be treated equally, that's also certainly not what is happening, things that garner no interest are closed after a while
< morcos> so i think putting it entirely in the hands of the PR author isn't maybe right... but perhaps some of the senior project people could say to the author, hey, please ping a few reviewers for this code, we'd like to get it merged
< morcos> i dont know
< btcdrak> for #7648 how many reviewers do we need?
< wumpus> well as said, for some PRs it's clear who should be pinged for them, e.g. if there is some complicated mempool change I'll be sure to ping you morcos
< wumpus> but for a backport it's not nearly as clear cut
< morcos> 7648 looks good at this point, and 7543 is fairly trivial if you trust 7648.
< morcos> 7716 on the other hand is a problem. the 0.11 backport.
< morcos> i think thats always going to be a problem going back a version, i mean who is the poor sap who is going to review the segwit backport
< wumpus> yes #7648 looks good
< wumpus> btcdrak: you've introduced a new blockchain historical video media extension in #7648? *ducks* "BIP113 Media Time Past."
< morcos> my favorite is btcdrak's insistence on the acronym TDB
< helo> soon we will communicate using only acronyms <3
< sipax> ACK OR GTFO!
< wumpus> lol
< morcos> wumpus: would be nice to add first commit from https://github.com/bitcoin/bitcoin/pull/7707 as well, just commented on PR
< wumpus> morcos: sure, though usually we merge the master pull first before backporting anything
< btcdrak> wumpus: ahahaha
< wumpus> in this case, that it's a combination of a GUI change and a non-GUI change (which should be backported) complicates the process, otoh it's just one line so here goes..
< morcos> wumpus: yeah, thats why i didn't ACK that commit earlier, i was going to review the whole PR, but i've run out of time to do that (going out of town). but you could merge that commit into master and just make jonas rebase
< wumpus> yes good idea, I'll do that
< jonasschnelli> morcos, wumpus: should I open a PR with the non-gui oneliner against master and 0.12?
< wumpus> jonasschnelli: I was just going to do that, but sure go ahead :)
< jonasschnelli> okay... give me couple of minutes
< GitHub38> [bitcoin] jonasschnelli opened pull request #7739: [Wallet][RPC] add abandoned status to listtransactions (master...2016/03/aba_rpc) https://github.com/bitcoin/bitcoin/pull/7739
< GitHub56> [bitcoin] jonasschnelli opened pull request #7740: [0.12 BP] [Wallet][RPC] add abandoned status to listtransactions (0.12...2016/03/aba_rpc_012) https://github.com/bitcoin/bitcoin/pull/7740
< jonasschnelli> Anyone interested in reviewing my p2p-authentication and encryption BIP before submitting to the ML?
< GitHub102> [bitcoin] laanwj pushed 2 new commits to master: https://github.com/bitcoin/bitcoin/compare/3bdc583b3f07...09a079e6484a
< GitHub102> bitcoin/master 263de3d Jonas Schnelli: [Wallet][RPC] add abandoned status to listtransactions
< GitHub102> bitcoin/master 09a079e Wladimir J. van der Laan: Merge #7739: [Wallet][RPC] add abandoned status to listtransactions...
< GitHub61> [bitcoin] laanwj closed pull request #7739: [Wallet][RPC] add abandoned status to listtransactions (master...2016/03/aba_rpc) https://github.com/bitcoin/bitcoin/pull/7739
< GitHub170> [bitcoin] laanwj pushed 1 new commit to 0.12: https://github.com/bitcoin/bitcoin/commit/7ffc2bd9439b2ad4da653583f7e57915980522a3
< GitHub170> bitcoin/0.12 7ffc2bd Jonas Schnelli: [Wallet][RPC] add abandoned status to listtransactions...
< GitHub140> [bitcoin] laanwj closed pull request #7740: [0.12 BP] [Wallet][RPC] add abandoned status to listtransactions (0.12...2016/03/aba_rpc_012) https://github.com/bitcoin/bitcoin/pull/7740
< wumpus> jonasschnelli: sure
< wumpus> jonasschnelli: you should also approach warren about this ,he was very interested in this, maybe he can drum op some more reviewers
< jonasschnelli> wumpus: Yes. He show interest at the conference in Cambridge. Ping warren.
< wumpus> jonasschnelli: btw I didn't discover yet what the proposed layering is, but you should always encrypt-then-mac (verify mac before decryptiong), not mac-then-encrypt (eg have the message autehntication behind/inside the encryption)
< jonasschnelli> wumpus: Yes. I agree. But the authentication scheme is ECDSA bases. IMO the auth itself is encrypted.
< jonasschnelli> wumpus: and the proposed Auth does what "certificates" do in SSH. They ensure that the remote party sill possesses the private key (=identity).
< wumpus> jonasschnelli: ok, but I suppose you never have enc(auth(
< wumpus> jonasschnelli: then it's good
< jonasschnelli> Yes. No enc(auth()). Enc itself has no MITM protection.
< wumpus> jonasschnelli: so encryption and authentication is optional per message? I think the latter is risky, can't a MITMer insert a non-authenticated message inside the stream?
< wumpus> I think once authentication is initiated, every message should be authenticated
< sipa> agree
< wumpus> I'm not sure that should hold for encryption, though there is a point to do so: it makes traffic analysis harder, more haystack to search for needles in
< jonasschnelli> wumpus: I'm not sure if it would make sense to encrypt blocks. Why would it be risky?
< wumpus> jonasschnelli: yeah agreed
< wumpus> jonasschnelli: but why would you not encrypt everything?
< sipa> (i have not looked at your bips) i think it should be a single authentication+encryption extension that is either off or on; if the identity of the peer is not known, a randomly generated key is used, otherwise a known key is used
< wumpus> jonasschnelli: (once encryption is established, I mean)
< jonasschnelli> You could encrypt everything. Its just not a requirement in the BIP. It depends on the resources you have.
< wumpus> resources for encryption decryption are neglible compared to block processing, even deserialization
< jonasschnelli> Yes. I agree.
< wumpus> and if you don't want to encrypt, fine, don't establish it, it's an optional extension :)
< jonasschnelli> sipa: I have wrote two separate BIPs because auth could also make sense for non-encrypted coms.
< sipa> jonasschnelli: if i would redesign bitcoin p2p it would always be authenticated and always encrypted
< jonasschnelli> wumpus: Yes. It is probably bad if partial traffic will be unencrypted after enc-init.
< sipa> yes, authentication without encryption is iseful
< sipa> but if you're going through the trouble of proposing a change, i think you should immediately go all the way
< jonasschnelli> sipa: Agree. But there is a problem with the identity management (MITM).
< jonasschnelli> First time you connect to a trusted node, you might want to ensure it is the correct identity (preshared key over a different chan).
< sipa> that problem always exists for authentivation
< wumpus> jonasschnelli: yes, the same problem as ssh basically, you may want to verify the remote fingerprint
< sipa> whether or not you make encryption mandatory is indepebdent
< wumpus> right
< jonasschnelli> wumpus: Yes. The enc BIP i wrote does verify the fingerprint (base58c(ripemd160(sha256(pubkey))).
< jonasschnelli> Okay. I might want to add that to the BIP: once encryption is initialized, unencrypted traffic would lead to a disconnect and lost of the enc session.
< wumpus> jonasschnelli: but that's somewhat of a UI issue, how to show the fingerprint and make the user verify it, before storing it
< sipa> i'll read it later... the hardest problem imho is how do you not reveal your identity to those who do nkt already know it
< sipa> *not
< jonasschnelli> wumpus: Yes. I left that open in the BIP. Most easiest solution would be to just NOT connect if the fingerprint not matches the prev./prestored once
< wumpus> yes I think that makes sense: once the connection chooses encryption or authentication, all traffic from then on should stick to it
< jonasschnelli> sipa: Yes. That is a different problem not addresses in the BIP(s)
< jonasschnelli> sipa: You might also like the idea of the SHA256 context that hashes all the comms to identify missing ENC messages.
< gmaxwell> jonasschnelli: I don't think it's a different problem, in that the wrong crypto design makes it impossible to avoid having both sides broadcasting a persistant identity.
< wumpus> in any case props to jonasschnelli for starting work on this, I'm sure this won't be finalized in one day, but initiative matters
< jonasschnelli> gmaxwell: I mean you could do the same as SSH does. Ask the user if when he first connect to a unknown node (fingerprint), store the fingerprint and warn/reject connecting to changed fingerprints.
< sipa> yeah, i think we need this
< sipa> jonasschnelli: that means a node must reveal its fingerprint
< gmaxwell> jonasschnelli: that is the opposite of what we want.
< sipa> that would lead to a trivial... eh... fingerprinting attack
< jonasschnelli> But maybe there is some clever method to spread identities over Addrman? Not sure although.
< gmaxwell> jonasschnelli: what sipa and I are referring to is that we don't want bitcoin nodes sending data that distinguishes them (esp passively) from other nodes.
< sipa> that's something i've suggested in the past, but i'm not sure anymore that's a good idea
< jonasschnelli> gmaxwell: right. Thats why I proposed only fingerprint possibilities to connecting node AFTER they have successfully authed.
< sipa> how can you authenticate without knowing who you're authenticating to?
< sipa> (i should shut up and read the bip)
< jonasschnelli> sipa: the remote node would only reveal its identity if it accepts the auth (already know the pubkey / preshared).
< jonasschnelli> sipa: remote node checks pubkey (might ask the node op. to allow access), then reveal its pubkey, etc.
< jonasschnelli> Fingerprinting would only be possible for "authorized_peers".
< GitHub198> [bitcoin] laanwj pushed 2 new commits to master: https://github.com/bitcoin/bitcoin/compare/09a079e6484a...e5c35119e967
< GitHub198> bitcoin/master df9e923 João Barbosa: Fix lockunspents help message
< GitHub198> bitcoin/master e5c3511 Wladimir J. van der Laan: Merge #7646: Fix lockunspent help message...
< GitHub139> [bitcoin] laanwj closed pull request #7646: Fix lockunspent help message (master...support/fix-lockunspent-help-message) https://github.com/bitcoin/bitcoin/pull/7646
< cfields> jonasschnelli: not sure i discussed in the conversation above, but it's not clear from your BIP if the auth message carries the typical message header as well
< cfields> (as a prefix i mean, in addition to the wrapped one)
< gmaxwell> jonasschnelli: I would normally expect this to work so that evey (supporting) conenction was mac/encrypted with ephemeral keys; and then inside that channel, varrious bits of authentiction may or may not happen. This way that even if the auth is deanonymizing it would only be so for an acive attacker; also all communication then ends up private from a global passive observer, even if there are n
< gmaxwell> o auth credientials available.
< gmaxwell> as far as the auth goes, I think for bitcoin symmetric mutual auth is not really a perfect fit; -- often the connection-accepting side wants to know that their resources are not being wasted by sybils, but don't really care who it is otherwise... and clients want to know they're talking to the host they expect, but really don't want it to know who they are. The exception is basically when you
< gmaxwell> have your own trusted peers, in which case symmetric auth is probably fine.
< jonasschnelli> cfields: hmm... IIRC I wrote in both bips that the wrapped messages also contains the HDR.
< cfields> jonasschnelli: yes, but it's not clear if that's in addition to, or instead of, the normal header
< * jonasschnelli> is processing gmaxwell answer (takes couple of minutes)
< jonasschnelli> cfields: thanks... will clarify that in the BIP.
< cfields> jonasschnelli: note that imo if the answer is "instead of", that would likely be an issue
< jonasschnelli> cfields: both messages (container and the wrapped message) would have valid message headers. This would make sense I guess?
< cfields> jonasschnelli: perfect, thanks for clarifying :)
< sipa> jonasschnelli: i would expect any authentication information to be sent instead of the 4-byte checksum there is now
< jonasschnelli> sipa: Yes. But IMO its most straightforward to wrap an existing command. No changes in the message / header processing would be required.
< jonasschnelli> The "enc" message wrapper would provide the encryption checksum (for AES IV).
< sipa> that's oretty inefficient
< jonasschnelli> sipa: You mean the message wrapper approach? Its basically a "header" for the message-with-a-header...
< cfields> sipa: i was thinking the same thing
< jonasschnelli> I kinda like the wrapping approach. It reflects and optional encryption layer.
< sipa> and it's abit naive to think you don't need tovchange existing procesng; you're not going to implement encryptiin for every command separately anyway, so you'll want to do it generically
< jonasschnelli> And does resect an easy implementation (not sure if this is an argument though)
< gmaxwell> it results in lots of digital signatures, which is very slow.
< sipa> (sorry for typing, edge)
< cfields> sipa: hmm actually though, that means 2 possible header sizes. that's kinda nasty for parsing
< jonasschnelli> No...
< jonasschnelli> You have a message type "enc" that has a data set that contain a "normal" message (lets say a "version" message).
< sipa> cfields: implement it as a layer in between tcp and messages
< sipa> ?
< jonasschnelli> The "enc" message has its own normal message p2p header, then some encryption relevant data (hash / iv, maybe the same), then the wrappen "version" message header&data.
< cfields> sipa: could do, sure, but i'm not sure it's worth the added complexity?
< jonasschnelli> So you could pare the enc message with the standard process message function, then decrypt, and process the wrapped command with the same logic.
< gmaxwell> cfields: what sipa suggests seems most natural to me, you could think of it is a secure socket layer.
< sipa> jonasschnelli: so an inv becomes goes from 60 bytes to 112 bytes?
< jonasschnelli> I have also though about adding the encryption on a different layer But, because I also want to do the implementation, I was looking for something that can be implemented easily.
< sipa> or if you add a digital signature, 33 even more
< jonasschnelli> sipa: Yes. That's why I though enc should be optional by message.
< jonasschnelli> We could remove the message header from the submessage though.
< sipa> jonasschnelli: as i said, i disagree with that- ideally we move to a form where everything is just encrypted imho
< jonasschnelli> sipa: enc does not use DSA. Auth does.
< sipa> well yes, but you shoukd have both
< sipa> *should
< jonasschnelli> You mean signing the encrypted message?
< gmaxwell> jonasschnelli: the way you're doing authentication provides both authentication and non-repudiation. The latter is sometimes useful, but usually not--- the cost of it though is a really massive overhead compared to plain authentication.
< cfields> gmaxwell: hmm, seems jonasschnelli and I are thinking in terms of individual opt-in messages, and you and sipa are thinking in terms of the entire stream.
< sipa> i'm fine with doing it per message
< sipa> that's certainly easier
< sipa> but it shouldn't have such high overhead
< gmaxwell> cfields: working with the entire stream makes it easier to avoid attacks from selective dropping and replay.
< jonasschnelli> sipa: I agree. We might want to optimize the overhead.
< gmaxwell> and doing a dsa verify per message would be a noticible CPU load... and provides no particular value over a more traditional authentication scheme.
< jonasschnelli> Somehow i kinda likes to dual approach (encrypted and unencrypted messages) because of its CPU and bandwidth optimizations. I don't see a big value in encrypting blocks.
< jonasschnelli> gmaxwell: Right. I only proposes DSA for a one-time-auth to initiate the enc.
< sipa> jonasschnelli: using the more private approach shouldn't be more expensive :)
< jonasschnelli> auth is stateless (no session), enc initiate a session.
< sipa> jonasschnelli: encryption does not provide authenticity
< gmaxwell> Also one gain of an encrypted transport would be being able to reduce network attack surface to just 'trusted' peers, which mixing things cannot achieve.
< sipa> you *need* authentication for all data sent
< sipa> otherwise there may he attacks where an attacker modifies the stream
< jonasschnelli> sipa: For that purpose i have added the SHA256 context that starts with the authentication response.
< * jonasschnelli> needs to go afk soon.
< gmaxwell> jonasschnelli: standard encrypted transport, if done with a fast cipher/authentication can run with near memcpy speeds, it wouldn't necessarily make more than a negligible performance impact. And eventually there should be no whole 'blocks' sent except for history catchup.
< jonasschnelli> gmaxwell: +1 agree.
< jonasschnelli> Well,.. right. Once encryption is initiated it should cover everything. Agree.
< jonasschnelli> I try to find a more optimized message format (wrapper)
< jonasschnelli> but mind sipas contant time AES pr. :)
< gmaxwell> so, e.g. if we had something that initilized at handshake with ephemeral keys, then inside that identity-auth may or may not happen.-- so then a passive observer wouldn't even learn if you were using auth or not. (esp if where auth isn't used if we insert a dummy message of the same size)
< jonasschnelli> gmaxwell: my enc proposal uses ephemeral keys (ECDH) and right, with preshared key, an observer would not notice the auth (only the enc).
< gmaxwell> I'm not sure that we'd want to use AES for the normal connections; just because without hardware support, timing attack immune AES is not very fast. This is why chacha20-poly1305 is now in TLS and SSH; to be used on the many hosts where AES-GCM is slow.
< sipa> typical advice to encrypt first, and then put a mac on the encrypted form
< jonasschnelli> I need to go afk. Happy to discuss that more in detail later. Thanks for the feedback, also happy to get feedback on the bitcoin-dev mail.
< gmaxwell> The encrypted structure you have is not MACed, so junk can be injected into the stream. Internally authed messages wouldn't suffer from that becuase they're signed... but this kind of structure ends up with attacks where you corrupt some data and then learn something about the content based on if the far end changes its behavior or not.
< gmaxwell> One thing to keep in mind is that the word 'authenticate' has an overloaded meaning. It can mean the function of a keyed mac to make sure that the data is data created by someone knowing a particular secret. Or it can mean to establish that the party you are communicating with is the party you think you are (that there is no MITM). Sometimes we use some of the same tools for these things, usua
< gmaxwell> lly not.
< gmaxwell> so regardless of what is done with identity-authentication; the outer transport should be using authenticated-encryption, so that any corruption is immediately rejected before any further application processing which might reveal information about the state of the encrypted stream.
< gmaxwell> amusingly, since we already use this sha256 based "checksum", a switch to an authenticated/encrypted transport might actually make the network communications faster.
< gmaxwell> (if it were faster than the sha256)
< cfields> gmaxwell: heh, good point
< BCB> Any idea why bitcoin 0.12 would be disconnection from an ipv6 addy with "socket recv error Connection reset by peer (104)" after receiving pong message
< sipax> BCB: the only reason can be that the network layer actually returned a "Connection reset by peer" error...
< sipax> the most likely reason for which is that the remote side actually disconnected
< BCB> sipax: what is the x in your nic?
< BCB> sipax so the remote side will just reconnect?
< sipax> i don't know whether it will; only that based on the information you've given me, it seems that it does
< gmaxwell> hm. so I have a node that was offline for a week throwing "Bitcoin is downloading blocks" -- it's not caught up, and yet it shows no blocks inflight on any peers
< BCB> * looks at logs
< gmaxwell> and synced_blocks/synced_headers is -1 on every peer.
< sipax> gmaxwell: how long has the node been up?
< gmaxwell> 45 minutes.
< gmaxwell> oh sorry 15 minutes
< sipax> i've seen that before, but it always resolved itself
< gmaxwell> first connection was 23:15:25.
< gmaxwell> and this is a checkout of 0.12 from a few minutes before it started.
< sipax> wait until there's been a new block
< sipax> (we should still investigate, but if it resolves on itself on the first block, i'm not so worried)
< gmaxwell> sure, I don't care if this particular host is delayed.. but what data would be useful to resolve the bug?
< gmaxwell> I think I've been block inved while this was up.
< sipax> was this after ending a reindex?
< sipax> or maybe a lengthy activating best chain?
< gmaxwell> no. host cleanly shut itself down a week ago due to out of space (my debug lot made it to >100GB)
< gmaxwell> it came up, connected two block,
< gmaxwell> (402971 and 402972) and then hasn't made progress.
< gmaxwell> 2016-03-23 23:20:48 got inv: block 000000000000000000342cb0954d2b28c5c41fe0d1afa6a262ac0cef29394c28 new peer=21
< gmaxwell> 2016-03-23 23:20:48 sending: getheaders (997 bytes) peer=21
< gmaxwell> 2016-03-23 23:20:48 getheaders (402972) 000000000000000000342cb0954d2b28c5c41fe0d1afa6a262ac0cef29394c28 to peer=21
< gmaxwell> looks like that peer may have not responded to that getheaders.
< gmaxwell> that peer claims
< gmaxwell> "subver": "/Satoshi:0.11.2/",
< gmaxwell> "startingheight": 402972,
< gmaxwell> which is my height, my guess is that it's a fake node that just reflects whatever my starting height is.
< gmaxwell> and just ignored the getheaders request.
< BCB> gmaxwell: won't a misbehaving node be disconnected?
< sipax> BCB: in some cases where it's detectable...
< gmaxwell> BCB: impossible. _some_ kinds of very specific, detectable misbehavior will get things disconnected; but other kinds cannot be reliably detected.
< BCB> what's the ip
< gmaxwell> sipax: okay the initial wedge is because the first thing to connect to my node was my local p2pool daemon, which can't usefully reply
< gmaxwell> 2016-03-23 23:15:25 initial getheaders (402971) to peer=1 (startheight:0)
< gmaxwell> the wedge would have resolved when peer=21 offered me that block, but peer=21 didn't reply to the getheaders (as I'm in IBD, and so headers fetched instead of pulling it)
< gmaxwell> so someone with a fake node that relays blocks but doesn't conform to the protocol more generally seems to be unintentionally prolonging the wedge. I expect it will resolve when another peer offers me a block first.
< gmaxwell> as predicted, it unwedged.