Live data from Hacker News

Rustls: new, modern TLS library written in Rust

github.com

61–70 of 112 posts

Re: Rustls: new, modern TLS library written in Rust

#61
post #9
post #6

Earlier quoted context omitted.

I take it to mean "uses current, best practices." For example: - C++: uses C++11 features, avoids non-RAII resources, prefers standard libraries over older, platform-specific libraries, not written as "C with classes." - C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. - in general: has a test suite, probably uses continuous testing like Travis, uses modern language features to achieve cl…

> C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. Can you elaborate?

From the tcmalloc paper[0]:

> Speed is important for a malloc implementation because if malloc is not fast enough, application writers are inclined to write their own custom free lists on top of malloc. This can lead to extra complexity, and more memory usage unless the application writer is very careful to appropriately size the free lists and scavenge idle objects out of the free list.

An example of such an optimization is the arena allocator[1][2] employed by protobuf. Custom memory management schemes are not uncommon in performance critical code.

0: http://goog-perftools.sourceforge.net/doc/tcmalloc.html

1: https://en.m.wikipedia.org/wiki/Region-based_memory_manageme...

2: https://developers.google.com/protocol-buffers/docs/referenc...

Re: Rustls: new, modern TLS library written in Rust

#62
post #9
post #6

Earlier quoted context omitted.

I take it to mean "uses current, best practices." For example: - C++: uses C++11 features, avoids non-RAII resources, prefers standard libraries over older, platform-specific libraries, not written as "C with classes." - C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. - in general: has a test suite, probably uses continuous testing like Travis, uses modern language features to achieve cl…

> C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. Can you elaborate?

http://www.tedunangst.com/flak/post/analysis-of-openssl-free... http://www.tedunangst.com/flak/post/heartbleed-vs-mallocconf

Re: Rustls: new, modern TLS library written in Rust

#63
post #4

I'm developing a twitch whenever I see the word "modern" in a software description. It doesn't actually say anything about what you're doing.

It does. There are distinct properties attached to Modernism and Modern. (I'm architect, hence I'm very much attached to these terms. Unlike SW people who didn't grow up with that).

First of all, it's the opposite of Post-Modern, to the perl style do it all in myriads of ways, everything is allowed, OpenSSL style. With Modern, only the best API and implementation is allowed. API's are Stanford style well-planned ahead of time, and not adhoc added New-Jersey style. Changes to the API need a rename, not just a major version bump. Hand-waving simplified development models are okay for a post-modern everything is allowed world, whilst modernism aims for long-term goals, making it easier for the user, not the developer.

Modernism is based on "Form Follows Function", and not the other way round. Reduce it, abstract it. Functionalism is everything, marketing is less important.

And to avoid popular misconceptions, in our current era "Modern" doesn't mean "New" at all. Modern is more old Stanford-style development. Check the Unix Haters handbook e.g. Rust is new, but this choice alone doesn't allow the use of Modern. Rust is better, because of its superior semantics and guarantees, whilst still adhering to the C ABI. It's a library for everybody afterall, and not comparable to the latest ocaml, haskell or lisp TLS library, which only adheres to their ABI and needs wrappers to be useful for projects in other languages.

Re: Rustls: new, modern TLS library written in Rust

#64
post #9
post #6

Earlier quoted context omitted.

I take it to mean "uses current, best practices." For example: - C++: uses C++11 features, avoids non-RAII resources, prefers standard libraries over older, platform-specific libraries, not written as "C with classes." - C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. - in general: has a test suite, probably uses continuous testing like Travis, uses modern language features to achieve cl…

> C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. Can you elaborate?

He might be referring to "sbrk" [0]

[0] http://linux.die.net/man/2/sbrk

Re: Rustls: new, modern TLS library written in Rust

#65

Earlier quoted context omitted.

Most high-level languages don't provide guaranteed-constant-time behavior at all. That's a big reason why ring uses lots of BoringSSL's/OpenSSL's assembly language code. Also, one of my goals with the ring project is to identify exactly what constant-time utilities are needed for a crypto library, so that I can draft a proposal for improving the Rust language and libraries to provide such features.

> Most high-level languages don't provide guaranteed-constant-time behavior at all. Does even C provide such guarantees? Isn't the compiler free to rewrite the code it's compiling in whatever way it wishes as long as the output is the same?

C doesn't and even Assembler doesn't entirely. DJB has pushed and is still pushing(?) Intel to publish more information about these things.

Re: Rustls: new, modern TLS library written in Rust

#66
post #61
post #9

Earlier quoted context omitted.

> C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. Can you elaborate?

From the tcmalloc paper[0]: > Speed is important for a malloc implementation because if malloc is not fast enough, application writers are inclined to write their own custom free lists on top of malloc. This can lead to extra complexity, and more memory usage unless the application writer is very careful to appropriately size the free lists and scavenge idle objects out of the free list. An example of such an optimiz…

> An example of such an optimization is the arena allocator[1][2] employed by protobuf.

I work on the protobuf team at Google, so I'm aware of this.

Two things about that:

1. The underlying blocks for the arena allocator still come from the system allocator.

2. Because the arena allocator inhibits the capabilities of standard malloc-debugging tools like ASAN and Valgrind, the protobuf arena allocator includes special ASAN-aware code to mitigate this:

https://github.com/google/protobuf/blob/d64a2d9941c36a7bc2a7...

However, that code is ASAN-specific. It won't help other tools like Valgrind. So yes, different allocators are sometimes warranted for specific patterns like arenas. But if all you want is plain malloc()/free(), you should call malloc()/free().

If you're writing a library, letting the user specify their own allocation callback is also great, since it lets the user do whatever custom bookkeeping/pooling/etc. they want to do. But by default just call malloc()/free() (IMHO).

Re: Rustls: new, modern TLS library written in Rust

#67
post #63
post #4

I'm developing a twitch whenever I see the word "modern" in a software description. It doesn't actually say anything about what you're doing.

It does. There are distinct properties attached to Modernism and Modern. (I'm architect, hence I'm very much attached to these terms. Unlike SW people who didn't grow up with that). First of all, it's the opposite of Post-Modern, to the perl style do it all in myriads of ways, everything is allowed, OpenSSL style. With Modern, only the best API and implementation is allowed. API's are Stanford style well-planned ahea…

You've given a while bunch of definitions for what you interpret modern to mean but none of those are inherent in the word which is what (I think) the op meant when complaining about its over usage.

So while I appreciate your attempt to redefine "modern" with all the above I'd rather people just used the more verbose explanation instead of using the meaningless term.

Re: Rustls: new, modern TLS library written in Rust

#68
post #63
post #4

I'm developing a twitch whenever I see the word "modern" in a software description. It doesn't actually say anything about what you're doing.

It does. There are distinct properties attached to Modernism and Modern. (I'm architect, hence I'm very much attached to these terms. Unlike SW people who didn't grow up with that). First of all, it's the opposite of Post-Modern, to the perl style do it all in myriads of ways, everything is allowed, OpenSSL style. With Modern, only the best API and implementation is allowed. API's are Stanford style well-planned ahea…

Another interpretation of Modernist Development is team size:

A modern SW project consists typically of 1-2, max. 3 devs, a typical post-modern project of 20-200. With such member sizes consensus is rarely practical, political correctness and CoC discussions are taking over development, ABI and API's are driven by design and not by functionality and longevity.

I.e. modern development is small, functional and not designed by committee.

Re: Rustls: new, modern TLS library written in Rust

#69
post #67
post #63

Earlier quoted context omitted.

It does. There are distinct properties attached to Modernism and Modern. (I'm architect, hence I'm very much attached to these terms. Unlike SW people who didn't grow up with that). First of all, it's the opposite of Post-Modern, to the perl style do it all in myriads of ways, everything is allowed, OpenSSL style. With Modern, only the best API and implementation is allowed. API's are Stanford style well-planned ahea…

You've given a while bunch of definitions for what you interpret modern to mean but none of those are inherent in the word which is what (I think) the op meant when complaining about its over usage. So while I appreciate your attempt to redefine "modern" with all the above I'd rather people just used the more verbose explanation instead of using the meaningless term.

My personal list of "I'd rather" is pretty large. We should get together and compare notes.

Re: Rustls: new, modern TLS library written in Rust

#70

I'm so happy to see something like this in development. Every time there's a discussion about OpenSSL vulnerabilities, the topic of a future replacement written in Rust comes up, but no one was stepping up to the plate. Now we have some real progress towards a safer future.

There is also Thrussh, a Rust library for SSH. Rust now begins to shine where it was designed for -- in security.

According to https://doc.rust-lang.org/book/ffi.html it is possible to make callbacks from C code to Rust functions. This way other languages could take advantage of Rust's safe libraries.

Post reply on HN