Live data from Hacker News

TinySSH is a small SSH server using NaCl, TweetNaCl

tinyssh.org

51–60 of 64 posts

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#51
post #24

Outstanding! Not only are the slightly mysterious authors of this project not inventing their own crypto, they rely on djb's[0] much acclaimed NaCL/TweetNaCl. The codebase is accordingly small: $ wc -l source/*/*c | tail -n1 11308 total $ wc -l source/crypto/*c | tail -n1 1293 total The first line suggests a measure of total code ballast, whereas the second incantation might hint at the amount of core crypto code. Th…

this is pretty slick. i'm glad people are making more modular implementations of the programs that i depend upon in addition to creating fancy new programs that i might find useful.

for comparison, the openbsd version of openssh's sshd compiles just under 20k lines, and the openbsd version is supposed to be much smaller than the "portable" version of openssh.

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#52
post #49
post #47

Earlier quoted context omitted.

This code is attempting to be portable to C89, or why not just use C99's stdint.h? I don't believe your statement "C89 says the same thing," do you have a source to point to? Do you have the section number in the latest freely available C99 working draft? The "Types" section (which 6.something in the draft) simply says what I said earlier about scalar rank. And 5.4.4.2.1 doesn't seem to exist in the draft.

Sorry, I mistyped the section number. Updated the parent comment with corrections and links. I assume the intent of tweetnacl is to be C89-compatible, but due to the long long (and char, although that one's pretty pedantic) issue there's little guarantee of success.

Huh, learned something new today, thanks. (For anyone following along, the C89 doc mentions the limits.h guidelines as well, search for "UINT_MAX".)

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#53
post #50
post #45

Earlier quoted context omitted.

"You (presumably) and I have beaten ourselves into submission to the Linux style; the authors' haven't." An awakening! Is it really so terrible to have things compile quickly and without the usual ./configure nonsense? It seems there are an infinite number of ways an author can organise her project using ./configure; for every one I have to spend time figuring out what they have done. One of my favourite aspects of d…

I'm just curious, where does the parent post mention anything about the build system? The "Linux style" referred to there seems to be the Linux code style, not "configure".

On top of that "configure" has nothing to do with Linux.

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#54
Every function name in tinyssh/buf.c starts with an underscore...

To quote the standard:

"All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces. ... If the program declares or defines an identifier in a context in which it is reserved (other than as allowed by 7.1.4), or defines a reserved identifier as a macro name, the behavior is undefined."

-- ISO/IEC 9899:1999, Section 7.1.3 Reserved Identifiers

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#55
post #40

Earlier quoted context omitted.

stdint.h is C99 and while I'd love to believe that every C compiler is C99 capable by now, I don't know if that is actually the case. Does stdint.h exist on Win32 these days?

Microsoft's poor support for standard C is no excuse not to use these types everywhere else and either define them yourself on windows or get stdint from boost, from one of the stdint.h replacements or from MSVC 2012. IMHO, of course.

I hate Microsoft as much as the next guy, but FYI, MSVC 2013 supports most of C99.

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#56
post #25
post #22

Earlier quoted context omitted.

[deleted]

Yes, I did see that post. The multiple statements per line thing is really fishy for a security critical piece of infrastructure.

This is essentially just a bikeshed.

"Wait, this code is hard to understand and requires deep domain knowledge. Better nitpick the code style instead. Also, bikesheds should clearly be orange. Green is way too fishy."

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#57
post #40

Earlier quoted context omitted.

Microsoft's poor support for standard C is no excuse not to use these types everywhere else and either define them yourself on windows or get stdint from boost, from one of the stdint.h replacements or from MSVC 2012. IMHO, of course.

I hate Microsoft as much as the next guy, but FYI, MSVC 2013 supports most of C99.

That's good to hear, and maybe we can finally move on to more universal use of a 14 year old standard!

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#58
post #25

Earlier quoted context omitted.

Yes, I did see that post. The multiple statements per line thing is really fishy for a security critical piece of infrastructure.

This is essentially just a bikeshed. "Wait, this code is hard to understand and requires deep domain knowledge. Better nitpick the code style instead. Also, bikesheds should clearly be orange. Green is way too fishy."

I have domain knowledge and I've read a lot of code in my time. The style in use there is peculiar. That doesn't mean it is malicious or incorrect but it might make it easier to hide if it was.

Sorry you don't see that.

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#59
post #53
post #50

Earlier quoted context omitted.

I'm just curious, where does the parent post mention anything about the build system? The "Linux style" referred to there seems to be the Linux code style, not "configure".

On top of that "configure" has nothing to do with Linux.

Who said it did? Consider that I was commenting in a general sense.

djb's work, whether it's coding style or build system or something else, tends to differ from what is "popular".

The parent's comment is along the lines of: what is unfamiliar can appear more difficult, but after the adjustment it may actually appear easier than the prior alternative.

If you view the parent's comment in this light, then you will see that both the Linux kernel coding style and the GNU build system are very familiar for lots of folks.

If you are migrating to using tinyssh and other software that follow's djb's style for the first time, then you will no doubt have to "get used to it" and you might even perceive it as being difficult.

To be crystal clear, I'm not singling out the Linux kernel or the GNU build system. The GNU build system is but one example; the Linux kernel coding style is another.

I could make a lengthy list of "familiar", popular approaches that I could argue are inferior to djb's approach to the same task.

It's just my opinion. If you disagree, feel free to state your own opinion.

Re: TinySSH is a small SSH server using NaCl, TweetNaCl

#60
post #14
post #8

I find use of TweetNaCl curious. For curve25519, why wouldn't one use http://code.google.com/p/curve25519-donna/ instead? djb's cryptography is great, but djb's implementations leave something to be desired.

What do they leave to be desired? Style is a personal preference, of course - but merit? Every single djb implementation I've seen (a lot of them) is fast, efficient, secure, and clear, once you get his style.

Mostly his disregard for packaging conventions and unwillingness to acomodate them. The code is usually A grade, but the odd use of the filesystem, runtime configs, daemons etc. means it will never get into any mainstream distro without heavy patching.

There's a reason why libsodium's tag line is "P(ortable|ackageable) NaCl-based crypto library".

The word of distros/packagers isn't gospel, but it counts for a lot, considering that (for better or worse) most people won't even think about using something not available as a package.

Post reply on HN