botan icon indicating copy to clipboard operation
botan copied to clipboard

Hard-coded usage of the system RNG in ffi_pk_op

Open dirkz opened this issue 1 year ago • 4 comments

Fixes https://github.com/randombit/botan/issues/4340

Open questions:

  • How best to unify the _with_rng versions with their original ones?

dirkz avatar Oct 27 '24 11:10 dirkz

Coverage Status

coverage: 91.145% (+0.01%) from 91.135% when pulling 598a45eff4a6b828e8e92cf8ad3b58751b93edde on plancksecurity:ffi_rng into d1ad41eef0d7039f79ac89d180f0d697936b09f1 on randombit:master.

coveralls avatar Oct 27 '24 13:10 coveralls

Zooming out a bit: Perhaps this could be answered in the context of #4318. Essentially, for C++ we're experimenting with a new builder-style API to configure the public key operations. For instance:

auto rng = AutoSeeded_RNG{};
auto sk = create_private_key("RSA", rng);

auto signer = sk->signer()
                  .with_rng(rng)
                  .with_padding("PSS")
                  .with_hash("SHA-256")
                  /* ... */
                  .create();

signer.sign(); 

In #4318 there's an open TODO on how to expose this paradigm via the FFI. I don't have a concrete proposal at this point. But perhaps its worth thinking in that direction and finding a usable (generic) design for this before creating many more FFI function with _with_rng().

(Please don't take this as actual opposition to these new functions from my side. I just try to connect some loose ends here.)

reneme avatar Oct 27 '24 14:10 reneme

In #4318 there's an open TODO on how to expose this paradigm via the FFI. I don't have a concrete proposal at this point. But perhaps its worth thinking in that direction and finding a usable (generic) design for this before creating many more FFI function with _with_rng().

Thank you very much for the heads up, this is something to consider.

dirkz avatar Oct 28 '24 07:10 dirkz

Some initial idea: https://github.com/randombit/botan/pull/4318#issuecomment-2451487304 The linked API suggestion is very much a work in progress. Feel free to join the discussion.

reneme avatar Nov 01 '24 08:11 reneme