upvote
Rust does not fix existing third party callers.
reply
yes, it does. Please refer Rust's return types
reply
Existing third party callers don't use Rust, so Rust's return types can't possibly help here.
reply
Sometimes I like to think of how little performance would be lost and how much would be gained by just collectively deciding to use Option/Result instead of sentinel values.

Things like the dumb (not like I'm any individual being dumb. Just collective accumulated stupidity) a*hole vulnerability some weeks ago. That wasn't even performance sensitive.

reply
Be sure to let us know when your equivalent Rust crypto library is available.
reply
we don't need many crypto libraries, maybe just one for the whole world, written in Rust and then all functions are math-proofed.
reply
A crypto library written in Rust would not be available everywhere, so can not be the only one. And if you formally verify the code, you can also formally verify that it is memory safe, so there is not much point to have it in Rust. Crypto has properties which may be difficult to verify though.

If you want a safe interface that does not require passing random sizes around in extra arguments, this can also be done in C.

reply
it's too late for C/C++ developers.
reply
Rust and C developer there. C++ it's an unrelated beast, don't mix C99 users with these. On C, I compiled Gplaces (A barebones Gemini -protocol- client with Clang hardening CFLAGS and I linked it against BoehmGC. That in 32 bit.

On Rust, it's pure love in 64 bit, I acknowledge that (I use Cosmic DE with Pop!_OS so I can relate) and evcode it's my main IDE, Crabcraft being second. But compiling 'simple' TUI tools on Rust it's impossible on 32 bit, even with ZRAM and a total of 1.5GB of RAM.

If you want half-secure TUI tools on 32 bit Golang it's a saner option than C/C++ and the only actual altual alternative to Rust. For instance AERC can be safer than Mutt to read email, even under a Maildir mailbox and email fetched/sent with isync/msmtp.

reply
It's not just "math-proofed". You need a lot more to be a crypto library.

Like time-constant, and it's hard to be time-constant in a performance optimised language like Rust. LLVM is doing some magic, and you don't want any magic in a crypto library.

reply
You'd probably need a second one for FIPS.
reply
Does the alpha-stage WIP code you call 'Rust' compile for 32-bit yet? No? Ok.
reply
reply
If I am not mistaken, the default backend is aws-lc [1] which is... a C library (still better than having the frontend in C as well, though).

Meanwhile, ring [2] carries an explicit disclaimer of "This is an experiment".

[1] https://github.com/aws/aws-lc

[2] https://github.com/briansmith/ring

reply
The crypto primitives in OpenSSL have been pretty solid (although timing attacks come up from time to time).

Where OpenSSL has been bad to terrible over decades is protocol handling, api management, and lately locking.

Managing protocol in a more restrictive language is a good thing. Bonus if it has the potential to require less work from application developers around version updates. Maybe they got better, I was using <= 1.0.2; back then there was a chance some things would break between different letter releases on the same version number even though it still compiles, and going to a new version meant a lot of work.

reply
aws-lc is a lot of assembly, which you kinda need anyway. Neither Rust nor C are fully suitable for cryptography because common optimizing compiler backends (LLVM, GCC, MSVC) can introduce branches (even if you wrote it in a branchless manner!), making the crypto code vulnerable to side-channel attacks.

So the options are

  - write it in assembly
  - use a high-level language, then verify the generated assembly the compiler generates
  - write a new or modify an existing backend to support timing-independent code
aws-lc does the first, some other crypto libs try to do the 2nd but I don't know how solid that is and the 3rd one takes time.

base64 encode hopefully isn't used in places where it would be a timing channel, so it could still benefit from a safe Rust impl. And at least it's API could benefit from slices and Result

reply
You can also use a formally proven https://github.com/ctz/graviola/
reply