News for hackers. Stuff that matters.
Re:Rolling Your Own Crypto by tptacek on Tuesday December 20, 2016 @01:52PM (#13222732)
It's the opposite, I think: Noise is good for less-involved cases, the kinds of problems you would ordinarily solve by just using TLS. Nacl is better for when you need something customized to an application.

Incidentally: Noise is great, but it's also fine to use TLS, if you're just a little careful.

See also:

https://gist.github.com/tqbf/be58d2d39690c3b366ad

Re:Rolling Your Own Crypto by an_account_name on Wednesday December 21, 2016 @03:56AM (#13227744)
A bit of Googling reveals this to be a reply to this blog entry by Colin Percival, for those interested:

http://www.daemonology.net/blog/2009-06-11-cryptographic-rig...

Re:Rolling Your Own Crypto by jjnoakes on Tuesday December 20, 2016 @03:15PM (#13223519)
The "Avoid /dev/random" recommendation, can you elaborate on that?
Re:Rolling Your Own Crypto by tptacek on Tuesday December 20, 2016 @03:43PM (#13223729)
Re:Rolling Your Own Crypto by jjnoakes on Tuesday December 20, 2016 @03:55PM (#13223845)
You should post these reasons in your gist. As I thought, there are a few reasons one might want to use /dev/random.

Blanket "don't use X" statements are much more useful with context and information about why not to use X (and when using X may be required, useful, or a better choice).

Re:Rolling Your Own Crypto by Dylan16807 on Tuesday December 20, 2016 @05:06PM (#13224594)
There's no reason to pull bytes out of /dev/random. In the rare circumstance that you're worried about it being early in the first boot and getrandom doesn't exist, you might throw away a single byte from /dev/random to make sure it's ready. But then you're done, and use urandom. And your program almost certainly doesn't need to worry about that circumstance.
Re:Rolling Your Own Crypto by jjnoakes on Tuesday December 20, 2016 @11:24PM (#13226780)
Unless no programs ever need to worry about that case (which is untrue), why not mention in a security gist purporting to be a list of crypto implementation suggestions?

Why not be complete and list the caveat, instead of incomplete and possibly lead that one in a thousand down the wrong path?

Re:Rolling Your Own Crypto by Dylan16807 on Wednesday December 21, 2016 @12:17AM (#13226960)
Far more than one in a thousand will use it as an excuse to do the wrong thing.

And lots of articles about best practice leave out very rare edge cases. No advice is always always right.

Re:Rolling Your Own Crypto by jjnoakes on Wednesday December 21, 2016 @08:17AM (#13228823)
> lots of articles about best practice leave out very rare edge cases

I don't think that's an argument in support of leaving out edge cases, and even if you disagree in general, I think security articles should be more diligent than random best-practices articles.

> Far more than one in a thousand will use it as an excuse to do the wrong thing.

If an article says "always do X" and someone does X and the implementation is subtly wrong or insecure, that's an argument to improve the article (which is what I'm suggesting).

But if an article says "almost always do X, and be aware of this edge case" and someone gets it wrong by not following instructions, then I don't think the article is at fault.

I would personally want my security advice to cover any edge case I could think of, even if only in the footnotes.

Re:Rolling Your Own Crypto by tptacek on Tuesday December 20, 2016 @03:59PM (#13223896)
No, there aren't. Don't use /dev/random.
Re:Rolling Your Own Crypto by jjnoakes on Tuesday December 20, 2016 @04:52PM (#13224441)
The reasons I know about for using /dev/random are quoted in the article you yourself just posted here...

https://sockpuppet.org/blog/2014/02/25/safely-generate-rando...

Re:Rolling Your Own Crypto by tptacek on Tuesday December 20, 2016 @05:05PM (#13224575)
Since I wrote that article, I'm pretty confident that it doesn't recommend ever using /dev/random.
Re:Rolling Your Own Crypto by jjnoakes on Tuesday December 20, 2016 @11:12PM (#13226732)
I said the article mentioned reasons one might want to use /dev/random (or be careful about blindly using /dev/urandom), not that the article recommends using /dev/random. But since you wrote the article you should realize this.

Just because the article recommends seeding over using /dev/random early at boot time doesn't mean the original gist shouldn't mention these issues so that readers are aware of them.

Just saying "use /dev/urandom all the time" without mentioning the caveats we're discussing here means someone might read your article and in a (misguided) appeal to authority implement something solely on your recommendation without doing their research properly first.

I would have thought someone writing security articles would want to avoid misleading someone into implementing something that's accidentally insecure. I hope I'm not wrong.

Re:Rolling Your Own Crypto by tptacek on Wednesday December 21, 2016 @07:58AM (#13228715)
Re:Rolling Your Own Crypto by jjnoakes on Wednesday December 21, 2016 @08:28AM (#13228879)
> Here's another article you can argue with: > http://www.2uo.de/myths-about-urandom/

Which backs up my point that using /dev/urandom blindly without knowing about some of the edge cases isn't a good idea, and lists those edge cases and what to do about them (which is what I suggested you do too).

> And another: > http://security.stackexchange.com/questions/3936/is-a-rand-f....

Which also lists the edge cases I'm talking about.

Hey look if you just want to say "I'm aware of the edge cases and don't want to put them in my gist for others to see" that's fine with me, but dodging the issue by claiming there are no edge cases (and then listing 3 articles which all mention the edge cases) isn't the right reply I think.

Don't be surprised if someone suggests that a gist listing security best practices list some edge cases that go along with the blind advice too. Feel free to disagree, but at least disagree honestly.

Re:Rolling Your Own Crypto by tptacek on Wednesday December 21, 2016 @10:47AM (#13229967)
I honestly disagree.
Re:Rolling Your Own Crypto by jjnoakes on Wednesday December 21, 2016 @12:52PM (#13231064)
Appreciated.