GithubHelp home page GithubHelp logo

Comments (1)

resilar avatar resilar commented on July 17, 2024

I agree that the current behavior is non-ideal. A better approach is to return an error and prevent accessing encrypted databases if entropy generation fails. Maybe also spam error messages to stderr given the critical security implications of the failure. In practice, entropy generation should never be broken except maybe on emulators or early in the boot of embedded systems.

In my opinion, the best solution would be to avoid pseudorandom number generation altogether by switching to deterministic nonces based on counters or hashes. However, maintaining persistent counter(s) in a simple and efficient way is an unsolved problem in the context of SQLite3 encryption extensions. Hashing the plaintext contents of a database page incurs a small performance hit but would be easy to implement. Replacing the hash algorithm with keyed BLAKE2 (or other HMAC) would be nice as the result could serve as a MAC and nonce for ChaCha20 at the same time (allowing removal of Poly1305, but that would break compatibility).

Anyway, I will modify the code to return errors on failing entropy generation. And maybe consider the fancy HMAC nonces for the next major version of sqleet (if there ever will be one).

from sqleet.

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.