Giter VIP home page Giter VIP logo

Comments (3)

hannesm avatar hannesm commented on June 18, 2024

I'm not sure I understand what you try to achieve here, sorry. Could you elaborate on the use case you have in mind?

from mirage-crypto.

dinosaure avatar dinosaure commented on June 18, 2024

So, I have an application (functorized over the Mirage_random.S given by mirage) which expects the g state to be able to generate something random from this state. So I need to pass it from whatever it comes from. In the MirageOS context, due to Mirage_random.S, the type g is completely abstract and I don't have any way to get/create it and use it. It would be nice to have this g state at the start function to pass it then to my application (and ensure a full control of how the application generate random stuffs).

More concretely, a SMTP submission service needs Random.g to generate a stamp needed for the SMTP authentication.

Of course, I can rely on the global state but I lost the ability to fully control the behavior of my application.

from mirage-crypto.

hannesm avatar hannesm commented on June 18, 2024

hmm, I fail to understand your requirement. do you need to preserve the generator state for later (potentially a restart)?

Indeed, g is abstract and global. it also changes quickly over time (using rdrand/rdseed and lwt enter_hook). if you have the requirement to preserve g and re-generate the exact same random, my best bet would be to generate random data (with Mirage_crypto_rng.generate) and then construct your own generator (e.g. https://github.com/mirleft/ocaml-x509/blob/v0.14.1/lib/private_key.ml#L23-L26). Since g is abstract, you won't be able to dump and restore it.

In other applications (see the X509 code as well) I've just used an optonal g -- would that be an option for you as well?

from mirage-crypto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.