News for hackers. Stuff that matters.
Re:GnuTLS considered harmful (2008) by lispm on Wednesday March 05, 2014 @12:00PM (#7348090)
No matter how you look at it, C is the wrong choice for security relevant systems software. But where is the alternative?
Re:GnuTLS considered harmful (2008) by mox1 on Wednesday March 05, 2014 @12:18PM (#7348201)
Java obviously, there are no security issues with java...

No wait! Ruby, that should be perfect, can't cause buffer overflow there....

Ermm.. wait I got , well use python!

Re:GnuTLS considered harmful (2008) by lispm on Wednesday March 05, 2014 @12:20PM (#7348219)
What do you think the Java runtime is written in? The Ruby runtime? The Python runtime?

Hint: it starts with a C.

If you build a house in a swamp, you are in trouble.

Re:GnuTLS considered harmful (2008) by aryastark on Wednesday March 05, 2014 @01:24PM (#7348715)
Wow, you're daft. Everything is, ultimately, getting turned into machine code. Not even Lisp Machines could get away from this fundamental fact: http://funcall.blogspot.com/2009/04/some-lisp-machine-minuti...

> Bogus objects — properly tagged words with invalid addresses that pointed at uninitialized memory or into the middle of object of a different type — which would cause the GC to corrupt memory would be left in registers or on the stack. These sort of problems were everywhere in the microcode.

Go build your cabin in the woods now.

Re:GnuTLS considered harmful (2008) by lispm on Wednesday March 05, 2014 @01:45PM (#7348888)
Sure one can corrupt memory on a Lisp Machine. System software like the micro code or the garbage collector can contain bugs.

Something like a buffer overflow was very very rare. This was not a systemic problem like it is in C.

Re:GnuTLS considered harmful (2008) by diminoten on Wednesday March 05, 2014 @12:59PM (#7348508)
> The Python runtime?

Why, Python, of course![0]

[0] - http://pypy.org/

(I jest, your point is entirely valid)

Re:GnuTLS considered harmful (2008) by mox1 on Wednesday March 05, 2014 @12:37PM (#7348340)
I was making a joke....

If C is the wrong choice, what is the right choice?

Re:GnuTLS considered harmful (2008) by jmz92 on Wednesday March 05, 2014 @12:42PM (#7348398)
In a couple years or so, my bet would be on Rust.
Re:GnuTLS considered harmful (2008) by bjourne on Wednesday March 05, 2014 @06:53PM (#7350848)
Java has several runtimes. The most popular one is Hotspot and written in C++.
Re:GnuTLS considered harmful (2008) by betterunix on Wednesday March 05, 2014 @09:38PM (#7351524)
You can write the Python runtime in something other than C:

http://pypy.org/

And there are Java compilers and runtimes written in Java, and Lisp compilers written in Lisp, etc.

Re:GnuTLS considered harmful (2008) by lmm on Wednesday March 05, 2014 @06:34PM (#7350771)
I can't speak for Ruby, but in both Java and Python I've never seen a bug this embarrassingly bad. I mean, this bug simply would not have happened in a language with a working boolean type, or with exceptions (I trust the ZeroMQ guy's judgement about as far as I can throw him).
Re:GnuTLS considered harmful (2008) by spiralpolitik on Wednesday March 05, 2014 @03:42PM (#7349736)
Actually C is an excellent choice for security relevant systems software because the issues for developing in C are well understood and can easily be mitigated by following 30 years worth of best practice patterns and using the correct development tools.

The issue is developers are not using the tools or following the best practices because they think they know better than 30 years worth of experience or get caught up in bikeshedding about ideology, licenses and which line the curly braces go on.

Re:GnuTLS considered harmful (2008) by betterunix on Wednesday March 05, 2014 @09:36PM (#7351520)
"Actually C is an excellent choice for security relevant systems software because the issues for developing in C are well understood and can easily be mitigated by following 30 years worth of best practice patterns and using the correct development tools."

Nevermind the copious undefined behavior, the fact that C programmers sometimes struggle to figure out what a valid C expression actually does, the fact that C programmers have to choose between code bloat and using "goto" for finalization, the fact that there are no standard error handling constructs, the fact that strings are null terminated, the lack of a standardized way to determine array lengths at runtime, etc., etc., etc. Even something as simple as this:

int f(int x, int y) { return x + y; }

Can lead to undefined behavior in C:

https://www.securecoding.cert.org/confluence/display/seccode...

Basically C should be at the bottom of the list of languages that programmers choose for cryptography or security software.

Re:GnuTLS considered harmful (2008) by serbaut on Wednesday March 05, 2014 @04:55PM (#7350221)
Can you link to the 30 years of best practice document, I must have missed it.
Re:GnuTLS considered harmful (2008) by Crito on Wednesday March 05, 2014 @08:18PM (#7351204)
Another good read (it probably does not reflect how you want to write C code, the rule about dynammic allocation is probably extreme if you are not writing code to fly spaceships, but I think it is good to read regardless): http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
Re:GnuTLS considered harmful (2008) by jobigoud on Thursday March 06, 2014 @04:08AM (#7352677)
C and C++ are specifically discouraged as programming languages in "Cryptography Engineering" (Niels Ferguson, Bruce Schneier, Tadayoshi Kohno, 2010).
Re:GnuTLS considered harmful (2008) by guelo on Wednesday March 05, 2014 @01:26PM (#7348728)
Rust seems like it might be a good choice in the not too distant future.
Re:GnuTLS considered harmful (2008) by kcbanner on Wednesday March 05, 2014 @08:44PM (#7351309)
A brand new language is the best choice for security software?
Re:GnuTLS considered harmful (2008) by lallysingh on Wednesday March 05, 2014 @02:17PM (#7349094)
Preferably something generated from a formal proof tool. It wouldn't be perfect (nothing is), but the mistakes would be less stupid. Which is a big jump!

There's a bit of research in this, but I don't know of anything that's ready to use.

Re:GnuTLS considered harmful (2008) by dllthomas on Wednesday March 05, 2014 @09:02PM (#7351389)
Well, there's Coq, which (per my understanding) may or may not make the cut depending on how you define "ready to use".
Re:GnuTLS considered harmful (2008) by lallysingh on Thursday March 06, 2014 @10:55AM (#7354431)
I know Coq as a tool to help generate proofs. Does it generate code? Either way, it's not a verified implementation of TLS.

For that, we'd need: (1) A set of properties to verify for an implementation (2) An implementation to verify

Looking at http://coq.inria.fr/related-tools, there may be some related tools that could do the job. Still, there's a research project there.

Re:GnuTLS considered harmful (2008) by dllthomas on Thursday March 06, 2014 @11:11AM (#7354550)
People absolutely use Coq to generate code. I don't know what else is involved.

A few substantiating links from my search results for "coq generating code":

http://coq.inria.fr/V8.1/refman/Reference-Manual021.html

http://research.microsoft.com/en-us/um/people/akenn/coq/LOLA...

http://research.microsoft.com/en-us/um/people/nick/coqasm.pd...

Re:GnuTLS considered harmful (2008) by lallysingh on Thursday March 06, 2014 @01:00PM (#7355395)
Oh great! Thanks. Upvoted.
Re:GnuTLS considered harmful (2008) by e12e on Thursday March 06, 2014 @04:24PM (#7356711)
Re:GnuTLS considered harmful (2008) by axaxs on Wednesday March 05, 2014 @09:00PM (#7351387)
In a few years, Go. It's native crypto libraries are impressive already, though not thoroughly vetted. There's nothing wrong with C though, as long as carefully written. The biggest asset is that every popular language can link to it.