News for hackers. Stuff that matters.
Re:Cryptography in the Browser by foobarqux on Tuesday October 29, 2013 @07:43PM (#6638378)
Compiling nacl to javascript is probably a very bad idea without some further analysis. There are almost certainly specialized code constructs that will be lost in the transformation, like branchless code paths, that are designed to prevent certain types of attacks.

In fact this is a pretty insidious mistake since you think you are doing the right thing by using a high-quality library.

Re:Cryptography in the Browser by _prometheus on Tuesday October 29, 2013 @08:14PM (#6638524)
Or, could use pepper.js.

http://trypepperjs.appspot.com/

https://github.com/google/pepper.js

(note the `google` in the link).

Re:Cryptography in the Browser by pcwalton on Tuesday October 29, 2013 @08:37PM (#6638625)
Different NaCl. djb's NaCl is a crypto library. Google's NaCl is a "native code in the browser" component of Chrome/Chromium.

It's terribly confusing, especially since this article talks about both :)

Re:Cryptography in the Browser by nlacasse on Tuesday October 29, 2013 @09:06PM (#6638751)
What's worse is that djb's crypto NaCl wants to be pronounced "salt".
Re:Cryptography in the Browser by nlacasse on Tuesday October 29, 2013 @08:09PM (#6638494)
Emscripten compiles the input source with LLVM, then converts the LLVM bytecode to JS. Most of the optimization passes are done by the LLVM compiler. Are you suggesting that LLVM (or optimizing compilers in general) should not be used to compile crypto libraries?

I completely agree that further analysis is needed on js-nacl, but I hadn't considered that compiler optimizations might lead to vulnerabilities.

Re:Cryptography in the Browser by tptacek on Tuesday October 29, 2013 @09:05PM (#6638747)
That's might be a sign you don't pay enough attention cryptographic research; compiler optimization side channels are not news.

Of course, the notion that the compiler is a threat here is getting a bit ahead of ourselves, because you don't even know what side channels are in the runtime.

Re:Cryptography in the Browser by foobarqux on Tuesday October 29, 2013 @09:07PM (#6638756)
My primary concern is the LLVM bytecode to JS transformation.

Even on the LLVM side certain optimizations may be dangerous in crypto code. I wouldn't play with optimization settings unless I was sure I knew what I was doing. And I'd still think twice.