Conversation

Jarkko Sakkinen

This is first pure #Rust #crypto crate that I actually like. There's been a few #libsodium alike attempts but nothing quite as good as the original. This really feels like done right: https://github.com/brndnmtthws/dryoc #rustlang
1
0
0

@jarkko even though it looks like a straight port, what I’d like to see is an expert panel-reviewed library. Some functions need to be constant time, for example. The https://github.com/RustCrypto org claims to have at least a couple reviewed, but this is critical.

Frankly, I’m surprised that, unlike many other frameworks’ standard libraries, - advertised as a secure language - has no crypto.

1
0
1
@heaths I actually will use this to PoC stuff that I use kernel's crypto for so I have something quicker than e.g. libssl to get a concept :-) Not putting to production... Understand your point.
1
0
0
@heaths I often sort of circle through bunch of languages when doing a concept. Like something started with Rust might end up being written in C or might even start with a spreadsheet :-) Rewriting is quite easy really once you have a gist of design...

Python is pretty nice for emulating a C program as you can make it call same things as with C. So I actually have like crypto libraries for trying out stuff because they have smooth API and then use something else for the end product.
1
0
0

Jarkko Sakkinen

Edited 5 months ago
@heaths I actually also think that Rust's stdlib is quite bad.

Rust is a modern language, and e.g. I like the idea of procedural macros. But why create standard library, which takes greatest hits of 80s POSIX tape-drive alike File API and container types from 90s Java that I don't get.

It was pretty apparent in 2016 that you mostly just map memory, and storage is non-volatile RAM. There's lot of these types of contradictions in Rust, and variance in stock API quality.

Personally I use this as my basic memory API https://github.com/rust-vmm/vm-memory, and more like to to this direction should have been I/O API design of stdlib in 2016 (despite being part of rust-vmm, it can do all types of mmaps).

Not even joking when I say that this my favorite part of Rust's stdlib: https://doc.rust-lang.org/std/marker/struct.PhantomData.html. This one I do like.

The comment about crypto library is IMHO even more to the point given that not only Rust was designed with the borrow checker but it was also made by Mozilla for use in Web Browser development. The first presentation I saw about Rust was at LinuxCon EU 2014, and it was more about Servo than Rust itself.
0
0
1
Yeah well the language itself is nice and especially when fallible alloc's are a stable feature :-) And I'd expect that there will be clippy switch to make them enforced if you want... so things will get fixed eventually.
0
0
0
@pinkforest Anyway, I have a small little project to work on where macros in Rust work great :-) Also small set of dependencies I'd like to see it compiling gccrs and rustc and find ways to keep that constraint. Probably have something together in August.
1
0
0

Jarkko Sakkinen

Edited 5 months ago

@pinkforest Like for instance. What would you possibly do with a re-allocating vector in any modern systems software? For small chunks, create large enough fixed arrays. For data that needs to scale dynamically however many gigabytes of addresses can be mapped with a total zero cost, and the #PF handler takes care of the rest. Finally there is an option to manually scale the space down with fallocate() (FALLOC_FL_PUNCH_HOLE).

This is standard stuff in modern C systems software. If this is over the top, then I tend to think that probably Java or Go would be better picks in the first place.I just use Python then because more than liking a tool, I like measurable value, which cannot be just my liking. Self-deception IMHO :-)

1
0
0

Jarkko Sakkinen

Edited 5 months ago
@pinkforest Right and obviously you can use mmap() in addition to extend and truncate the address space on the run. FALLOC_FL_PUNCH_HOLE just removes page from reserved set, and does not unmap page. As soon as it is accessed a new page is created the of course in this case. So anyway, there is all of this really nice stuff just in plain Linux uapi that you can use to do amazing things with memory, and de-facto Rust installation is totally unaware of their existence. Quite lame to put it as I really think it is :-)
0
0
0