Live data from Hacker News

Rust Cryptography Should Be Written in Rust

briansmith.org

51–60 of 110 posts

Re: Rust Cryptography Should Be Written in Rust

#51
post #23

Earlier quoted context omitted.

For our client, we've developed a desktop application in Rust – with a thin GUI frontend in C++/Qt – to filter, process, and visualize sensor data streams (3D point cloud data from a Lidar). Each data stream was about 400-500 Mbit/s in 55k UDP packets per second, with support for at least 4 simultaneous streams. The focus was on high performance and development speed, security didn't matter at all. We chose Rust for…

Why use C++ for the front-end though?

We selected Qt as a cross-platform solution. The C++/Rust interface is the clunkiest and ugliest part of the application, and rather complex because some state is shared between several windows in the GUI and several threads in the backend, and any component might modify that state at any time, and updates have to be transmitted to the other components without introducing inconsistencies. However, using cxx [1] helped a little.

The project began in 2020, and I'm not sure what I'd choose as a GUI framework today – definitely not Qt Widgets, though.

[1] https://cxx.rs/

Re: Rust Cryptography Should Be Written in Rust

#52
post #40

I'd love this to be the case, but ring, which the author of the post created, is unfortunately not really maintained. It doesn't build on Windows ARM, which in turn inhibits rustls. It's a shame because I'd prefer to not depend on OpenSSL. Not that it's the author's fault. We shouldn't be reliant on a single person's contributions to have a working Rust cryptography toolchain.

Last I tried it also had issues with building on platforms like MIPS or PPC. If hardware acceleration is not available it should fall back to software not fail to build.

The problem with making it too easy to fall back is trivial misconfigurations end up using the fall back instead of being corrected.

Re: Rust Cryptography Should Be Written in Rust

#53
post #50
post #38

I reckon https://github.com/RustCrypto is an effort in this space.

I thought it weird that the post didn’t mention RustCrypto. It’s legit.

Agree. The problem with rustcrypto at the moment (or by design) is that there’s no TLS

Re: Rust Cryptography Should Be Written in Rust

#54
post #40

Earlier quoted context omitted.

Last I tried it also had issues with building on platforms like MIPS or PPC. If hardware acceleration is not available it should fall back to software not fail to build.

The problem with making it too easy to fall back is trivial misconfigurations end up using the fall back instead of being corrected.

Rust had pretty clear architecture conditionals. Not hard to just specify software for architectures without HW acceleration or where it has not been implemented yet.

Re: Rust Cryptography Should Be Written in Rust

#55
post #2

So far the only solid use case for Rust that I have seen in applications where security is extremely important. Not wonder it is becoming the de-facto language for building applications in the blockchain space. Does anyone else use Rust outside the blockchain/cryptography space? What are you working on?

Im using it for a highly multithreaded real time web app. Also i disagree with your assessment, i think rust can really be used for everything.

For the business im building the frontend is written in js but everything on the backend is rust. i needed one highly multithreaded realtime server and rust was the right choice for that. For everything else (api, file server) I decided to just use rust too, maintaining a node backend and a rust backend and having to deal with typescript build systems when i could just use rust for everything made my life easier.

What ive found is that open source authors interested in releasing libraries in python and nodejs choose to write it once in rust then release python and js libraries using rust ffi.

See polars, yrs, rapierjs, lancedb, candle, etc.

Re: Rust Cryptography Should Be Written in Rust

#56
post #49
post #2

So far the only solid use case for Rust that I have seen in applications where security is extremely important. Not wonder it is becoming the de-facto language for building applications in the blockchain space. Does anyone else use Rust outside the blockchain/cryptography space? What are you working on?

Yes, in fact I see hardly any cryptocurrency stuff with rust. I'm building an OS in rust, and write most firmware with rust too.

> Yes, in fact I see hardly any cryptocurrency stuff with rust.

Really?

Solana [0] a top 10 market cap cryptocurrency is written in Rust and so is its smart contracts.

NEAR Protocol is another [1] one as well as Sui [2] and Polkadot [3] written and using Rust.

[0] https://github.com/solana-labs/solana

[1] https://github.com/near/nearcore

[2] https://github.com/MystenLabs/sui

[3] https://github.com/paritytech/polkadot-sdk

Re: Rust Cryptography Should Be Written in Rust

#57
post #56
post #49

Earlier quoted context omitted.

Yes, in fact I see hardly any cryptocurrency stuff with rust. I'm building an OS in rust, and write most firmware with rust too.

> Yes, in fact I see hardly any cryptocurrency stuff with rust. Really? Solana [0] a top 10 market cap cryptocurrency is written in Rust and so is its smart contracts. NEAR Protocol is another [1] one as well as Sui [2] and Polkadot [3] written and using Rust. [0] https://github.com/solana-labs/solana [1] https://github.com/near/nearcore [2] https://github.com/MystenLabs/sui [3] https://github.com/paritytech/polkadot…

I didn't say it didn't exist. I said I don't personally ever see any cryptocurrency stuff in my Rust experience aside from coming across a few crates here or there related to it.

Re: Rust Cryptography Should Be Written in Rust

#58
post #49
post #2

So far the only solid use case for Rust that I have seen in applications where security is extremely important. Not wonder it is becoming the de-facto language for building applications in the blockchain space. Does anyone else use Rust outside the blockchain/cryptography space? What are you working on?

Yes, in fact I see hardly any cryptocurrency stuff with rust. I'm building an OS in rust, and write most firmware with rust too.

As an outsider with some good feelings towards Rust and some negative one towards crypto, almost all Rust jobs I’ve seen have been in crypto

Re: Rust Cryptography Should Be Written in Rust

#59
post #3
post #2

So far the only solid use case for Rust that I have seen in applications where security is extremely important. Not wonder it is becoming the de-facto language for building applications in the blockchain space. Does anyone else use Rust outside the blockchain/cryptography space? What are you working on?

> So far the only solid use case for Rust that I have seen in applications where security is extremely important. Playing devil's advocate, when is security not extremely important, except maybe in throwaway bash script-type applications?

Games. The attack surface for third-party input is very limited, and you can just secure those bits rather than adopting a new language for the entire program.

Like, you need to be able to sandbox mods if they're a thing, and Rust's memory safety only handles a tiny part of that.

Re: Rust Cryptography Should Be Written in Rust

#60

What are the language/tooling gaps specifically that prevent this today, and have there been RFCs to close them? Are the gaps primarily "in-language" or missing tooling for formal verification?

Deterministic builds, and inability to ensure constant-time operations are the two that come to mind. The first is a build security / supply chain issue, and the latter is a real vulnerability if the rust compiler "helpfully" optimizes away no-op operations in alternate code paths.
Post reply on HN