Where is INADDR_ANY for std::net?


#1

I’m just trying to get started with rust, and (having now translated into rust the NaCl crypto library for practice), and starting looking at network programming using UDP. I am immediately halted by the lack of any equivalent of INADDR_ANY, with no documentation indicating how to get this functionality. I know it has a value of 0 (or 0.0.0.0), at least on linux, but am uncomfortable with regard to portability. Am I missing something here? I presume that I can just specify 0.0.0.0 as an address, but is there some reason that no such constant is provided in rust?

David Roundy


#2

Do you have a link to this? Interested to see if you address timing attacks with the llvm back end in play here. I think this is an issue for rust-crypto although not 100% sure there. There is a sodiumoxide crate that provides some nice neat ffi bindings to libsodium. I am not sure if you have seen this.


#3

It’s not really intended for public consumption, and has several poor (and evolving design changes going on), but it is available at:

in the “crypto” submodule. I believe it should have the timing attack features that NaCl has, since it (like NaCl) doesn’t index arrays with secret information or base branches on secret information. But you shouldn’t trust me for anything where security is really important. I am confident it’s way slower than TweetNaCl is, since I have various extra copies (to initialize things, in particular), and due to array bounds checking, but I don’t think anything should reduce the security. But given that I am not a cryptographer, what I think should be taken with a good deal of caution.

David