Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BoxedUint: add cond_map and cond_and_then #352

Merged
merged 1 commit into from
Nov 29, 2023

Commits on Nov 29, 2023

  1. BoxedUint: add cond_map and cond_and_then

    Unfortunately `BoxedUint` can't impl `subtle::ConditionallySelectable`
    due to a supertrait bound on `Copy`. See dalek-cryptography/subtle#94
    
    This bound is required by `CtOption::map` and `CtOption::and_then` which
    are important for writing constant-time code.
    
    As a workaround which makes it still possible to leverate `CtOption`,
    this adds special `BoxedUint`-specialized combinators that are able to
    work around this issue by generating a placeholder (zero) value to pass
    to the provided callbacks in the event `CtOption` is none.
    
    This requires branching on the output of `CtOption` (which is
    unavoidable without an upstream fix in `subtle` itself), but still
    ensures that the provided callback function is called with a `BoxedUint`
    of a matching number of limbs regardless of whether the `CtOption` is
    some or none, which is the best we can do for now (and really quite
    close to what `subtle` is doing under the hood anyway).
    tarcieri committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    cd90fbe View commit details
    Browse the repository at this point in the history