Hacker News new | ask | show | jobs
by sitkack 4342 days ago
Starting a new, blue water distributed encryption system in a non-safe language is odd at this point. The protocol is being _noodled_ through and the code is in C.

This is the coding style

https://github.com/irungentoo/toxcore/commit/84c28337d248bad...

this is openssl all over again

https://github.com/irungentoo/toxcore/commit/1d6c3934736c369...

3 comments

From a short look, I tend to agree with you.

> memcpy(packet + 1, &con->ping_request_id, sizeof(uint64_t));

Copying multi-byte values into a network packet is a typical error made by novice developers - this will bite you hard as soon as somebody compiles the code on a Big Endian machine. Even if you might get away with this on opaque elements like a ping ID, the general approach should not be followed.

endianess doesn't matter when you all you do with it is store it and check if it's equal to another.

In all cases where it does matter, the values are converted.

Tox has been confirmed working on big endian machines by many people.

C is far from a non-safe language; it's the language of choice for NASA systems that lives depend on after all.

I'm not sure what you're trying to point out with those links. How is this related to openssl?

Because NASA has used C means this guy writes code for the shuttle?

Read the code. Dig through the commit logs. This is the wrong choice on about every level. The best encryption won't save you when you have code like this.

What did we not learn about OpenSSL?

You're talking complete nonsense. Constructive criticism please.
the only thing I'm seeing from your posts is "I'm a fucking idiot who doesn't understand that C is safer than any interpreted pretend-you're-safe language"
When have you heard of a JavaScript dangling pointer problem? Buffer overrun? Segfault?
The only hope to make Tox less insecure would be to run it under emscripten or http://zerovm.org/
Comparing C to Javascript makes no sense, and Javascript is NOT a safe language. Those issues you mentioned are due to programmer incompetence. Bad programmers will make bad code no matter what language they program in. Security should not rely on a language hand-holding bad programmers.
The classes of problems that one encounters in Ada, Haskell, OCaml, Rust, D or Go are vastly different than in languages w/o memory safety.

Writing secure network code in an non-safe language is something that shouldn't be taken lightly. Given the nature of the commits it is hard to comprehend that this product will ever achieve its stated aims.

It is secure by side effect, not proof.

I don't know what cargo cult coding style you want adhere to, but there is nothing wrong with the linked diff's.

It's quite readable and has yet to tangle itself in the ifdef mess that is openssl.