News for hackers. Stuff that matters.
Re:Frivpn – A multi-threaded OpenVPN client by ktpsns on Monday February 19, 2018 @08:24PM (#16417162)
This is a very interesting project as all our today's processors, even the Raspberryian ones, are multicores.

I assume the author does not want to rewrite OpenVPN from the scratch. Because "Multithreading", "networking" and "cryptography" immediately raises the head bells when it comes to C. People write this in Rust nowadays, isn't it? ;-)

Re:Frivpn – A multi-threaded OpenVPN client by extrapickles on Monday February 19, 2018 @11:03PM (#16417766)
I’m not sure I would want to do crypto multithreaded in any language. Too easy to leak information via timing even with a single core.
Re:Frivpn – A multi-threaded OpenVPN client by magnetic on Monday February 19, 2018 @11:26PM (#16417844)
Can you clarify what you mean? You seem to imply that using multiple threads is not a good idea, but then also express that not using multiple threads is also not a good idea. What's left?
Re:Frivpn – A multi-threaded OpenVPN client by cm2187 on Tuesday February 20, 2018 @02:51AM (#16418547)
I think encrypting independant packets on each thread is fine, what I believe he is refering to is encrypting a single packet on multiple threads. One of the many angles of attack against cryptography is side channel attacks, where for certain algorithms the path taken by the code depends on the value of the key/data. In which case you can leak some information by measuring the time it takes or power usage. Modern algorithms are carefully designed to not be path sensitive, which is hard enough when the algo executes on a single thread, but becomes really complex to manage on multiple threads. Just more opportunities to shoot oneself in the foot.
Re:Frivpn – A multi-threaded OpenVPN client by ktpsns on Tuesday February 20, 2018 @04:10AM (#16418892)
That's a fair argument, however we also want to exploit computational ressources. It's nothing new that clock speed stagnates but everything points to manycore architectures. Parallel crypto maybe hard but it is somewhat inevitable to research, investigate and implement.
Re:Frivpn – A multi-threaded OpenVPN client by krylon on Tuesday February 20, 2018 @05:09AM (#16419142)
Clock speed does not necessarily equal computational speed. I remember how ~15 years ago people predicted that single-core performance was not going to improve any longer, and that we would get more and more CPU cores over time.

My first multi-core machine was an Athlon64 X2 with two cores running at 2GHz. Today, my work laptop (ThinkPad L540) has a dual-core CPU (plus 2-way SMT) running at 2.6 GHz (3.2 GHz with TurboBost). But single-core performance has improved notably. Not as much as was common in the 1990s, but still. And for most desktop systems[1] more than two or four cores seem to be pointless, anyway, since they will sit idle most of the time.

[1] I am not talking about developer workstations, CAD machines or other high-end use cases, but the kind of machine where some office drone runs Outlook, Excel, and a web browser.

Re:Frivpn – A multi-threaded OpenVPN client by beagle3 on Tuesday February 20, 2018 @08:22AM (#16420078)
Most of this single core improvement, if I understand correctly, comes speculative execution and larger caches (rather than shorter pipelines), which -- in the context of crypto -- means that implementations go to great length to avoid the features that speed up execution, specifically BECAUSE they leak information.
Re:Frivpn – A multi-threaded OpenVPN client by krylon on Tuesday February 20, 2018 @10:02AM (#16420796)
Fair point.

Now, I know just enough about cryptography to know I know nearly nothing about it, so maybe someone can put this into context: Wouldn't a multi threaded crypto implementation open up a whole bunch of new potential attacks?

Re:Frivpn – A multi-threaded OpenVPN client by ktpsns on Tuesday February 20, 2018 @03:51PM (#16424081)
Good argument, but it is probably limited to the x86 architecture (and its contemporary grandchildren). In contrast, the OP explicitely mentions the Raspberry PI with its ARM CPU. This kind of RISC chips (more or less) secretly took over the world since virtually all mobile devices are equipped with such a SoC. It is common knowledge that these CPUs don't deliver the single core power of a desktop CPU but nevertheless parallelize. Without doubt it is worth in getting crypto fast(er) on such devices.
Re:Frivpn – A multi-threaded OpenVPN client by krylon on Wednesday February 21, 2018 @04:26AM (#16428097)
Fair point, I had not considered ARM and other low-power CPUs.
Re:Frivpn – A multi-threaded OpenVPN client by Nexxxeh on Tuesday February 20, 2018 @09:10AM (#16420379)
How many of those cores turbo boost to 3.2GHz though? Isn't it just one, even on the i5-8xxx laptop chips?
Re:Frivpn – A multi-threaded OpenVPN client by krylon on Tuesday February 20, 2018 @09:58AM (#16420756)
Probably. But I rarely push that computer to the point where it uses more than one core, except when I compress large amounts of data.
Re:Frivpn – A multi-threaded OpenVPN client by magnetic on Tuesday February 20, 2018 @12:09PM (#16421895)
I think I understand that, but wouldn't you think that adding an "unknown fuzz" by sharing computation on 1-or-many threads makes it harder for an external party to do timing attack?

The attacker now has a lot more possible outcomes depending on the number of threads handling that packet. I seems, on the surface, as if more threads add complexity to the attacker.

Debugging multithreaded code is much harder than single threaded, especially because of all the race conditions that can happen: it makes our brains burn hot from all the possible outcomes from identical runs run one after the other. My intuition would lead me to believe that this complexity is also now added to the attacker's side - but perhaps I'm missing something.

Re:Frivpn – A multi-threaded OpenVPN client by extrapickles on Wednesday February 21, 2018 @01:49AM (#16427419)
A general rule of thumb is that any added complexity to crypto algorithms makes the attackers job easier in the end as accounting for all of the side channels becomes much harder.

Timing attacks are somewhat annoying and noisy to conduct over the Internet, but you can measure the time a process takes with a resolution down to ~15ns[0]. I bet there is all sorts of cross core cache errata that leaks more time than that.

[0]: https://www.cs.rice.edu/~dwallach/pub/crosby-timing2009.pdf

Re:Frivpn – A multi-threaded OpenVPN client by austinshea on Tuesday February 20, 2018 @12:33AM (#16418081)
He's saying that it exacerbates an already complicated issue.
Re:Frivpn – A multi-threaded OpenVPN client by gonzo on Monday February 19, 2018 @11:52PM (#16417925)
Re:Frivpn – A multi-threaded OpenVPN client by williamaadams on Monday February 19, 2018 @11:02PM (#16417764)
I think it's more interesting than that. This is a mixture of C and Lua code!

Looking at it, I can imagine redoing it as LuaJIT and using ljsyscall to deal with the system calls on all platforms. Might be even more snappy.

Re:Frivpn – A multi-threaded OpenVPN client by mueslix on Tuesday February 20, 2018 @12:23PM (#16422018)
All the heavier processing is done in C already. Lua is only used for handling dis-/reconnects, rekeying and the likes. Hence I don't think LuaJIT would improve the performance much in this particular case.
Re:Frivpn – A multi-threaded OpenVPN client by signa11 on Tuesday February 20, 2018 @01:07AM (#16418191)
> ... redoing it as LuaJIT...

is luajit supported on versions beyond 5.1 ? just wondering...

Re:Frivpn – A multi-threaded OpenVPN client by hwh on Tuesday February 20, 2018 @02:28AM (#16418443)
This is a strangely worded question. LuaJIT is compatible with PUC Lua 5.1. It will thus not run (without problems/tweaking) run code that is designed for Lua >= 5.2. However, the differences are not really big in practice. It is rather more likely that the new options (especially the FFI) that come with LuaJIT will lead to the most work when switching over. Not that they would be absolutely needed, but it just makes it all so much smoother and faster - which is probably the reason to switch to LuaJIT in the first place.
Re:Frivpn – A multi-threaded OpenVPN client by signa11 on Tuesday February 20, 2018 @11:44AM (#16421678)
what a strangely worded response :)

all i can get from your response is a 'yes' to my earlier affirmation that luajit is compatible with Lua 5.1 honestly, responding to gp's comment, i also found lua's embedding in this application quite interesting.

imho, for something which might be living for a long time, considering using lua-jit might not be a good idea.

Re:Frivpn – A multi-threaded OpenVPN client by 0x0 on Tuesday February 20, 2018 @07:29AM (#16419827)
It's like the three major areas of programming where "things may appear to work but are in fact dangerously broken in hidden ways" converged. Compared to other software where the worst case is often crashing or not working, unproven crypto code bases might in fact appear to work (as in, traffic does appear to tunnel correctly), while in fact it could be broadcasting your private keys and plaintext data to anyone who comes knocking.
Re:Frivpn – A multi-threaded OpenVPN client by inamberclad on Tuesday February 20, 2018 @12:21AM (#16418032)
The rust people seem to shy away from rolling their own crypto.
Re:Frivpn – A multi-threaded OpenVPN client by acct1771 on Tuesday February 20, 2018 @12:27AM (#16418060)
Beside the non-zero amount of effort required, nobody wants to be the one responsible for bad crypto. Can't say I blame them.
Re:Frivpn – A multi-threaded OpenVPN client by dna_polymerase on Tuesday February 20, 2018 @05:30AM (#16419243)
My goodness, you Rustlings. There are lots of people out there perfectly able to write safe and sound C code even handling crypto, networking and multithreading.
Re:Frivpn – A multi-threaded OpenVPN client by lima on Tuesday February 20, 2018 @07:01AM (#16419699)
It's well established that writing safe and sound C code is an impossible feat (even OpenSSH had a number of memory corruption bugs in the past). Some people are better at it than others, yes.

That doesn't mean we should drop everything, throw away our C code and rewrite ot in Rust, but the issue is real.

Re:Frivpn – A multi-threaded OpenVPN client by hellohn123 on Tuesday February 20, 2018 @11:55AM (#16421764)
> It's well established that writing safe and sound C code is an impossible feat

You make it sound like this is somehow particular to C.

I hold the opinion that when you're using such an open definition of "sound and safe" (e.g. code will never do anything that could reasonably called a "bug" from a user's perspective) it is impossible to write "safe and sound" code in any programming language.

But that is not really a problem with the language, but with the definition of the term "sound and safe".

If you use a more constrained definition of "sound and safe"; one that would actually allow you to write "correct" code in a language, then C code can just be as sound and safe as rust code or Coq. It really just depends on your definitions.

In a way I agree with what I believe the grandparent tried to say; one thing that consistently rubs me about the Rust community is that they oftem seem to be using a very constrained definition of "safe" when advertising that rust is a "safe language", but a very open definition of safe when proclaiming that more or less every other systems language is "unsafe". That may be true using their definition of safe, but is a bit of dirty PR trick.

Re:Frivpn – A multi-threaded OpenVPN client by signa11 on Tuesday February 20, 2018 @11:40AM (#16421633)
> ... throw away our C code and rewrite ot (sic) in Rust...

well, to me at least, it seems a bit premature to compare the two languages at this juncture. rust is quite nascent, and doesn't have enough data points (imho) to make an objective comparison.

perhaps, when we have large code-bases available in rust doing safety+security critical applications (which might then be worthy targets) it might make more sense.

Re:Frivpn – A multi-threaded OpenVPN client by ktpsns on Tuesday February 20, 2018 @03:52PM (#16424092)
Did you notice the smiley ";-)" ? It indicated irony.